From be35c804127870c4c900d349965ceb7bd5020ce9 Mon Sep 17 00:00:00 2001 From: collerek Date: Sun, 1 Nov 2020 08:32:12 +0100 Subject: [PATCH] remove unused pydantic_types vars --- ormar/fields/base.py | 1 - ormar/fields/foreign_key.py | 1 - ormar/fields/many_to_many.py | 1 - ormar/fields/model_fields.py | 14 -------------- 4 files changed, 17 deletions(-) diff --git a/ormar/fields/base.py b/ormar/fields/base.py index e57dc64..7b86277 100644 --- a/ormar/fields/base.py +++ b/ormar/fields/base.py @@ -14,7 +14,6 @@ if TYPE_CHECKING: # pragma no cover class BaseField(FieldInfo): __type__ = None - __pydantic_type__ = None column_type: sqlalchemy.Column constraints: List = [] diff --git a/ormar/fields/foreign_key.py b/ormar/fields/foreign_key.py index 0974746..26334b4 100644 --- a/ormar/fields/foreign_key.py +++ b/ormar/fields/foreign_key.py @@ -47,7 +47,6 @@ def ForeignKey( # noqa CFQ002 ) namespace = dict( __type__=__type__, - __pydantic_type__=__type__, to=to, name=name, nullable=nullable, diff --git a/ormar/fields/many_to_many.py b/ormar/fields/many_to_many.py index 0573a86..d53106a 100644 --- a/ormar/fields/many_to_many.py +++ b/ormar/fields/many_to_many.py @@ -29,7 +29,6 @@ def ManyToMany( ) namespace = dict( __type__=__type__, - __pydantic_type__=__type__, to=to, through=through, name=name, diff --git a/ormar/fields/model_fields.py b/ormar/fields/model_fields.py index 29755a5..e766aa7 100644 --- a/ormar/fields/model_fields.py +++ b/ormar/fields/model_fields.py @@ -22,7 +22,6 @@ def is_field_nullable( class ModelFieldFactory: _bases: Any = (BaseField,) _type: Any = None - _pydantic_type: Any = None def __new__(cls, *args: Any, **kwargs: Any) -> Type[BaseField]: # type: ignore cls.validate(**kwargs) @@ -33,7 +32,6 @@ class ModelFieldFactory: namespace = dict( __type__=cls._type, - __pydantic_type__=cls._pydantic_type, name=kwargs.pop("name", None), primary_key=kwargs.pop("primary_key", False), default=default, @@ -60,7 +58,6 @@ class ModelFieldFactory: class String(ModelFieldFactory, str): _type = str - _pydantic_type = pydantic.ConstrainedStr def __new__( # type: ignore # noqa CFQ002 cls, @@ -99,7 +96,6 @@ class String(ModelFieldFactory, str): class Integer(ModelFieldFactory, int): _type = int - _pydantic_type = pydantic.ConstrainedInt def __new__( # type: ignore cls, @@ -134,7 +130,6 @@ class Integer(ModelFieldFactory, int): class Text(ModelFieldFactory, str): _type = str - _pydantic_type = pydantic.ConstrainedStr def __new__( # type: ignore cls, *, allow_blank: bool = True, strip_whitespace: bool = False, **kwargs: Any @@ -157,7 +152,6 @@ class Text(ModelFieldFactory, str): class Float(ModelFieldFactory, float): _type = float - _pydantic_type = pydantic.ConstrainedFloat def __new__( # type: ignore cls, @@ -186,7 +180,6 @@ class Float(ModelFieldFactory, float): class Boolean(ModelFieldFactory, int): _type = bool - _pydantic_type = bool @classmethod def get_column_type(cls, **kwargs: Any) -> Any: @@ -195,7 +188,6 @@ class Boolean(ModelFieldFactory, int): class DateTime(ModelFieldFactory, datetime.datetime): _type = datetime.datetime - _pydantic_type = datetime.datetime @classmethod def get_column_type(cls, **kwargs: Any) -> Any: @@ -204,7 +196,6 @@ class DateTime(ModelFieldFactory, datetime.datetime): class Date(ModelFieldFactory, datetime.date): _type = datetime.date - _pydantic_type = datetime.date @classmethod def get_column_type(cls, **kwargs: Any) -> Any: @@ -213,7 +204,6 @@ class Date(ModelFieldFactory, datetime.date): class Time(ModelFieldFactory, datetime.time): _type = datetime.time - _pydantic_type = datetime.time @classmethod def get_column_type(cls, **kwargs: Any) -> Any: @@ -222,7 +212,6 @@ class Time(ModelFieldFactory, datetime.time): class JSON(ModelFieldFactory, pydantic.Json): _type = pydantic.Json - _pydantic_type = pydantic.Json @classmethod def get_column_type(cls, **kwargs: Any) -> Any: @@ -231,7 +220,6 @@ class JSON(ModelFieldFactory, pydantic.Json): class BigInteger(Integer, int): _type = int - _pydantic_type = pydantic.ConstrainedInt def __new__( # type: ignore cls, @@ -266,7 +254,6 @@ class BigInteger(Integer, int): class Decimal(ModelFieldFactory, decimal.Decimal): _type = decimal.Decimal - _pydantic_type = pydantic.ConstrainedDecimal def __new__( # type: ignore # noqa CFQ002 cls, @@ -321,7 +308,6 @@ class Decimal(ModelFieldFactory, decimal.Decimal): class UUID(ModelFieldFactory, uuid.UUID): _type = uuid.UUID - _pydantic_type = uuid.UUID @classmethod def get_column_type(cls, **kwargs: Any) -> Any: