finish mypy checks add reqs and linting

This commit is contained in:
collerek
2020-09-29 17:06:41 +02:00
parent 3caa87057e
commit d9aa269f7a
16 changed files with 122 additions and 81 deletions

View File

@ -20,11 +20,11 @@ class RelationType(Enum):
class Relation:
def __init__(
self,
manager: "RelationsManager",
type_: RelationType,
to: Type["Model"],
through: Type["Model"] = None,
self,
manager: "RelationsManager",
type_: RelationType,
to: Type["Model"],
through: Type["Model"] = None,
) -> None:
self.manager = manager
self._owner: "Model" = manager.owner
@ -37,7 +37,9 @@ class Relation:
else None
)
def _find_existing(self, child: "Model") -> Optional[int]:
def _find_existing(
self, child: Union["NewBaseModel", Type["NewBaseModel"]]
) -> Optional[int]:
if not isinstance(self.related_models, RelationProxy): # pragma nocover
raise ValueError("Cannot find existing models in parent relation type")
for ind, relation_child in enumerate(self.related_models[:]):