Skip to content

Commit

Permalink
Remove redundant code in lockfiles
Browse files Browse the repository at this point in the history
  • Loading branch information
oz123 committed Dec 10, 2023
1 parent 54419ad commit 1693b41
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions src/plette/lockfiles.py
Expand Up @@ -85,7 +85,7 @@ def _copy_jsonsafe(value):
class Lockfile(BaseModel):
"""Representation of a Pipfile.lock."""

_meta: field(init=False)
_meta: Optional[Meta]
default: Optional[dict] = field(default_factory=dict)
develop: Optional[dict] = field(default_factory=dict)

Expand All @@ -97,11 +97,7 @@ def __post_init__(self):
The validation is performed by calling a function named:
`validate_<field_name>(self, value, field) -> field.type`
"""

for name, field in self.__dataclass_fields__.items():
if (method := getattr(self, f"validate_{name}", None)):
setattr(self, name, method(getattr(self, name), field=field))

super().__post_init__()
self.meta = self._meta

def validate__meta(self, value, field):
Expand Down

0 comments on commit 1693b41

Please sign in to comment.