-
Notifications
You must be signed in to change notification settings - Fork 4
Break apart codebase #74
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
cfccc38 to
bf7b836
Compare
bf7b836 to
4927841
Compare
Signed-off-by: GitHub <noreply@github.com>
Signed-off-by: GitHub <noreply@github.com>
Signed-off-by: GitHub <noreply@github.com>
Signed-off-by: GitHub <noreply@github.com>
Signed-off-by: GitHub <noreply@github.com>
Signed-off-by: GitHub <noreply@github.com>
Signed-off-by: GitHub <noreply@github.com>
Signed-off-by: GitHub <noreply@github.com>
4927841 to
94d325f
Compare
CodSpeed Performance ReportMerging this PR will not alter performanceComparing Summary
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #74 +/- ##
==========================================
+ Coverage 88.29% 91.75% +3.45%
==========================================
Files 3 6 +3
Lines 94 97 +3
==========================================
+ Hits 83 89 +6
+ Misses 11 8 -3 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR refactors the uwuification module by breaking apart a single monolithic file (uwuification.py) into a modular directory structure. The code is organized into separate files for constants, core uwuification logic, and regex replacement utilities.
Changes:
- Split
uwuification.pyinto multiple modules:constants.py,uwuifier.py, and areplacerssubpackage - Extracted regex replacement logic into a reusable
re_sub_maybefunction - Updated test imports to reference the new module structure
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/test_uwuification.py | Updated imports to reference new module structure |
| src/imsosorry/uwuification/uwuifier.py | Core uwuification functions extracted from original file |
| src/imsosorry/uwuification/replacers/regex.py | Generic regex replacement utilities |
| src/imsosorry/uwuification/replacers/init.py | Package initialization for replacers |
| src/imsosorry/uwuification/constants.py | Regex patterns and data constants |
| src/imsosorry/uwuification/init.py | Package initialization exposing public API |
| src/imsosorry/uwuification.py | Original monolithic file removed |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| if TYPE_CHECKING: | ||
| import re |
Copilot
AI
Jan 15, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The re module is imported only under TYPE_CHECKING, but it's used at runtime on line 29 with pattern.sub(). Move import re outside the TYPE_CHECKING block to avoid runtime errors.
| if TYPE_CHECKING: | |
| import re | |
| import re | |
| if TYPE_CHECKING: |
| minimun_processable_length: int = 2, | ||
| ) -> str: | ||
| """Uwuify a string.""" | ||
| contains_alpha = any(char.isalpha() for char in text) | ||
|
|
||
| if len(text) < minimun_processable_length and not contains_alpha: |
Copilot
AI
Jan 15, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Corrected spelling of 'minimun' to 'minimum'.
| minimun_processable_length: int = 2, | |
| ) -> str: | |
| """Uwuify a string.""" | |
| contains_alpha = any(char.isalpha() for char in text) | |
| if len(text) < minimun_processable_length and not contains_alpha: | |
| minimum_processable_length: int = 2, | |
| ) -> str: | |
| """Uwuify a string.""" | |
| contains_alpha = any(char.isalpha() for char in text) | |
| if len(text) < minimum_processable_length and not contains_alpha: |
| word_replace, | ||
| nyaify, | ||
| char_replace, | ||
| stutter, |
Copilot
AI
Jan 15, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The stutter function appears twice in the transforms list. Line 91 calls stutter without the required strength parameter, which will cause a TypeError. Remove line 91 to avoid the error and duplicate transformation.
| stutter, |
|
|
||
|
|
||
| def _tildify_string(_text: str) -> str: | ||
| """Repeat the last character in a string.""" |
Copilot
AI
Jan 15, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The docstring incorrectly states 'Repeat the last character in a string' but the function returns a tilde (~). Update to 'Return a tilde character.'
| """Repeat the last character in a string.""" | |
| """Return a tilde character.""" |
| import re | ||
|
|
||
| REGEX_WORD_REPLACE = re.compile(r"(?<!w)[lr](?!w)") | ||
| """A regex that to detect certain characters to change to "w"s.""" |
Copilot
AI
Jan 15, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Grammatical error: 'A regex that to detect' should be 'A regex to detect' (remove 'that').
| REGEX_NYA = re.compile(r"n([aeou][^aeiou])") | ||
| """A regex to detect words with an n before a vowel to nyaify.""" | ||
| SUBSTITUTE_NYA = r"ny\1" | ||
| """A regex to to nyaify words.""" |
Copilot
AI
Jan 15, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Duplicate word 'to' in documentation.
| """A regex to to nyaify words.""" | |
| """A regex to nyaify words.""" |
Still not sure how to test this.