Skip to content

Commit

Permalink
feat(requirements): internalize inflection
Browse files Browse the repository at this point in the history
  • Loading branch information
Caceresenzo committed Oct 26, 2024
1 parent cb816df commit 5654adc
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 4 deletions.
3 changes: 1 addition & 2 deletions crunch/api/errors.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@
import sys
import typing

import inflection

from .. import utils
from ..external import inflection
from .domain import *


Expand Down
19 changes: 19 additions & 0 deletions crunch/external/inflection.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# https://pypi.org/project/inflection/

import re


# from inflection/__init.py
def underscore(word: str) -> str:
word = re.sub(r"([A-Z]+)([A-Z][a-z])", r'\1_\2', word)
word = re.sub(r"([a-z\d])([A-Z])", r'\1_\2', word)
word = word.replace("-", "_")
return word.lower()


# from inflection/__init.py
def camelize(string: str, uppercase_first_letter: bool = True) -> str:
if uppercase_first_letter:
return re.sub(r"(?:^|_)(.)", lambda m: m.group(1).upper(), string)
else:
return string[0].lower() + camelize(string)[1:]
1 change: 0 additions & 1 deletion requirements/default.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ coloredlogs
dataclasses_json
gitignorefile
importlib_metadata
inflection
inquirer
joblib
networkx
Expand Down
1 change: 0 additions & 1 deletion requirements/runner.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ click
dataclasses_json


inflection

joblib

Expand Down

0 comments on commit 5654adc

Please sign in to comment.