Skip to content

Commit

Permalink
fix: inflector dependency replaced by inflection. First steps to publ…
Browse files Browse the repository at this point in the history
…ish library to Conda. Related to #706 (#719)
  • Loading branch information
marcosschroh authored Aug 14, 2024
1 parent 8f60744 commit 0f16702
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 19 deletions.
12 changes: 3 additions & 9 deletions dataclasses_avroschema/fields/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,11 @@
import typing
from collections import OrderedDict

from inflector import Inflector
import inflection
from typing_extensions import get_args

from dataclasses_avroschema import utils

p = Inflector()

logger = logging.getLogger(__name__)


Expand Down Expand Up @@ -52,7 +50,7 @@ def _get_self_reference_type(a_type: typing.Any) -> str:

@staticmethod
def get_singular_name(name: str) -> str:
return p.singularize(name)
return inflection.singularize(name)

def get_metadata(self) -> typing.List[typing.Tuple[str, str]]:
return [(name, value) for name, value in self.metadata.items()]
Expand Down Expand Up @@ -126,11 +124,7 @@ def fake(self) -> typing.Any:

def exist_type(self) -> int:
# filter by the same field types
same_types = [
field.type
for field in self.parent._user_defined_types
if field.type == self.type
]
same_types = [field.type for field in self.parent._user_defined_types if field.type == self.type]

# If length > 0, means that it is the first appearance
# of this type, otherwise exist already.
Expand Down
14 changes: 7 additions & 7 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,13 @@ python = "^3.8"
fastavro = "^1.7.3"
dacite = "^1.8.0"
faker = {version = ">=26.0.0,<27.0.0", optional = true}
inflector = "^3.1.1"
faust-streaming = {version = ">=0.10.11,<0.12.0", optional = true}
casefy = "^0.1.7"
typing-extensions = "^4.2.0"
pydantic = {version = "^2.4.2", optional = true, extras = ["email"]}
python-dateutil = "^2.9.0.post0"
dc-avro = {version =">=0.6.4,<0.9.0", optional = true}
inflection = "^0.5.1"

[tool.poetry.group.dev.dependencies]
mypy = "^1.8.0"
Expand Down
2 changes: 1 addition & 1 deletion tests/schemas/avro/user_array_address_alias.avsc
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
],
"doc": "An Address"
},
"name": "addres"
"name": "address"
}
}
],
Expand Down
2 changes: 1 addition & 1 deletion tests/schemas/avro/user_map_address_alias.avsc
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
],
"doc": "An Address"
},
"name": "addres"
"name": "address"
}
}
],
Expand Down

0 comments on commit 0f16702

Please sign in to comment.