Skip to content

Refactor code for improved performance and type safety across multiple modules#190

Merged
soumendrak merged 9 commits intomainfrom
enhancements
Dec 2, 2025
Merged

Refactor code for improved performance and type safety across multiple modules#190
soumendrak merged 9 commits intomainfrom
enhancements

Conversation

@soumendrak
Copy link
Owner

  • Replace shuffle-and-slice pattern with random.sample in _odianames.py for better performance
  • Add zero-division guard in _summarization.py word frequency calculation
  • Remove unnecessary list comprehension brackets in set comprehension
  • Remove redundant ABC inheritance from WordFrequency class
  • Expand static translations dictionary in _translate.py with bidirectional test cases
  • Add type hints to word_tokenizer and sentence_tokenizer

…e modules

- Replace shuffle-and-slice pattern with random.sample in _odianames.py for better performance
- Add zero-division guard in _summarization.py word frequency calculation
- Remove unnecessary list comprehension brackets in set comprehension
- Remove redundant ABC inheritance from WordFrequency class
- Expand static translations dictionary in _translate.py with bidirectional test cases
- Add type hints to word_tokenizer and sentence_tokenizer
@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Dec 2, 2025

Deploying openodia with  Cloudflare Pages  Cloudflare Pages

Latest commit: 19c886d
Status: ✅  Deploy successful!
Preview URL: https://633e6919.openodia.pages.dev
Branch Preview URL: https://enhancements.openodia.pages.dev

View logs

@codecov
Copy link

codecov bot commented Dec 2, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.48%. Comparing base (ac2db15) to head (19c886d).
⚠️ Report is 10 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #190      +/-   ##
==========================================
- Coverage   99.49%   99.48%   -0.02%     
==========================================
  Files           9        9              
  Lines         199      193       -6     
==========================================
- Hits          198      192       -6     
  Misses          1        1              
Flag Coverage Δ
pytest 99.48% <100.00%> (-0.02%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
openodia/__init__.py 100.00% <ø> (ø)
openodia/_letters.py 100.00% <ø> (ø)
openodia/_odianames.py 100.00% <100.00%> (ø)
openodia/_summarization.py 98.36% <100.00%> (+0.05%) ⬆️
openodia/_translate.py 100.00% <100.00%> (ø)
openodia/_understandData.py 100.00% <100.00%> (ø)
openodia/corpus/dictionary.py 100.00% <100.00%> (ø)

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ac2db15...19c886d. Read the comment docs.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

- Format long tuples and dictionaries with proper line breaks in _translate.py
- Fix whitespace inconsistencies in _understandData.py
- Add blank lines after docstrings in test modules for PEP 8 compliance
- Replace single quotes with double quotes for string literals across test files
- Remove trailing whitespace and fix indentation in test cases
- Improve code readability with consistent formatting in test_constants.py, test_corpus
…olete encoding declarations

- Remove `# -*- coding: utf-8 -*-` encoding declarations (Python 3 default)
- Remove shebang line from _summarization.py
- Replace `typing.List` with built-in `list` type hint
- Replace `typing.Set` with built-in `set` type hint
- Replace `typing.Dict` with built-in `dict` type hint
- Replace `typing.Tuple` with built-in `tuple` type hint
- Replace `typing.Union` with pipe operator `|` for union types
- Remove
- Add mkdocs>=1.2.2 for documentation generation
- Add mkdocs-git-revision-date-localized-plugin>=0.10.0 for git-based page dates
- Add mkdocs-material>=7.3.2 for Material theme support
- Remove numpy>=1.22.3 from project dependencies
- Remove unused pytest import from test_corpus_init.py
- Remove unused time import from test_edge_cases.py
- Remove unused sys import from test_main.py
- Reorder imports alphabetically in test files
- Remove redundant "r" mode from file open calls (default mode)
- Fix variable naming in test_edge_cases.py (summary -> result)
- Add STOPWORDS to __all__ exports in openodia/__init__.py
- Remove unused pytest imports from test_constants.py, test_init.py, test_letters.py, and test_main.py
- Remove unused mock_open import from test_dictionary.py
- Move threading import to top of test_edge_cases.py and reorder imports alphabetically
- Add noqa comment for intentional unused import in test_main.py
- Rename variable in test_odianames.py to avoid shadowing built-in name
@soumendrak soumendrak self-assigned this Dec 2, 2025
@soumendrak soumendrak merged commit 2245014 into main Dec 2, 2025
28 of 29 checks passed
@soumendrak soumendrak deleted the enhancements branch December 2, 2025 19:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant