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.
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 |
There was a problem hiding this comment.
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: |
There was a problem hiding this comment.
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, |
There was a problem hiding this comment.
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.""" |
There was a problem hiding this comment.
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.""" |
There was a problem hiding this comment.
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.""" |
There was a problem hiding this comment.
Duplicate word 'to' in documentation.
| """A regex to to nyaify words.""" | |
| """A regex to nyaify words.""" |
Still not sure how to test this.