Skip to content

Conversation

@shenanigansd
Copy link
Member

Still not sure how to test this.

@shenanigansd shenanigansd self-assigned this Mar 24, 2024
@shenanigansd shenanigansd changed the title Make functions generic and reusable Break apart codebase Apr 20, 2024
Copilot AI review requested due to automatic review settings January 15, 2026 00:11
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>
@codspeed-hq
Copy link

codspeed-hq bot commented Jan 15, 2026

CodSpeed Performance Report

Merging this PR will not alter performance

Comparing br/generics (94d325f) with main (20c05c8)

Summary

✅ 2 untouched benchmarks

@codecov
Copy link

codecov bot commented Jan 15, 2026

Codecov Report

❌ Patch coverage is 88.57143% with 8 lines in your changes missing coverage. Please review.
✅ Project coverage is 91.75%. Comparing base (20c05c8) to head (94d325f).
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
src/imsosorry/uwuification/uwuifier.py 78.94% 8 Missing ⚠️
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.
📢 Have feedback on the report? Share it here.

Copy link

Copilot AI left a 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.py into multiple modules: constants.py, uwuifier.py, and a replacers subpackage
  • Extracted regex replacement logic into a reusable re_sub_maybe function
  • 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.

Comment on lines +9 to +10
if TYPE_CHECKING:
import re
Copy link

Copilot AI Jan 15, 2026

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.

Suggested change
if TYPE_CHECKING:
import re
import re
if TYPE_CHECKING:

Copilot uses AI. Check for mistakes.
Comment on lines +76 to +81
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:
Copy link

Copilot AI Jan 15, 2026

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'.

Suggested change
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:

Copilot uses AI. Check for mistakes.
word_replace,
nyaify,
char_replace,
stutter,
Copy link

Copilot AI Jan 15, 2026

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.

Suggested change
stutter,

Copilot uses AI. Check for mistakes.


def _tildify_string(_text: str) -> str:
"""Repeat the last character in a string."""
Copy link

Copilot AI Jan 15, 2026

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.'

Suggested change
"""Repeat the last character in a string."""
"""Return a tilde character."""

Copilot uses AI. Check for mistakes.
import re

REGEX_WORD_REPLACE = re.compile(r"(?<!w)[lr](?!w)")
"""A regex that to detect certain characters to change to "w"s."""
Copy link

Copilot AI Jan 15, 2026

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').

Copilot uses AI. Check for mistakes.
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."""
Copy link

Copilot AI Jan 15, 2026

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.

Suggested change
"""A regex to to nyaify words."""
"""A regex to nyaify words."""

Copilot uses AI. Check for mistakes.
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.

2 participants