1414import pathlib
1515from enum import Enum
1616from functools import lru_cache
17- from typing import TYPE_CHECKING , Any , Generic , List , Literal , Optional , Type , TypeVar , Union , cast
17+ from typing import TYPE_CHECKING , Any , Generic , List , Literal , Optional , Type , TypeVar , Union
1818
1919from plumpy .base .utils import call_with_super_check , super_check
2020from pydantic import BaseModel , ConfigDict , create_model
@@ -95,7 +95,7 @@ def __call__(self, backend: 'StorageBackend') -> Self:
9595 """Get or create a cached collection using a new backend."""
9696 if backend is self ._backend :
9797 return self
98- return self .get_cached (self .entity_type , backend = backend ) # type: ignore[arg-type]
98+ return self .get_cached (self .entity_type , backend = backend )
9999
100100 @property
101101 def entity_type (self ) -> Type [EntityType ]:
@@ -213,7 +213,7 @@ def as_input_model(cls: Type[EntityModelType]) -> Type[EntityModelType]:
213213
214214 # Derive the input model from the original model
215215 new_name = cls .__qualname__ .replace ('.Model' , 'InputModel' )
216- InputModel = create_model (
216+ InputModel = create_model ( # noqa: N806
217217 new_name ,
218218 __base__ = cls ,
219219 __doc__ = f'Input version of { cls .__name__ } .' ,
@@ -225,7 +225,7 @@ def as_input_model(cls: Type[EntityModelType]) -> Type[EntityModelType]:
225225 readonly_fields = [
226226 name
227227 for name , field in InputModel .model_fields .items ()
228- if getattr (field , 'json_schema_extra' , {}) and field . json_schema_extra .get ('readOnly' )
228+ if getattr (field , 'json_schema_extra' , {}).get ('readOnly' )
229229 ]
230230
231231 # Remove read-only fields
@@ -247,7 +247,7 @@ def _prune_field_decorators(field_decorators: dict[str, Any]) -> dict[str, Any]:
247247 decorators .field_validators = _prune_field_decorators (decorators .field_validators )
248248 decorators .field_serializers = _prune_field_decorators (decorators .field_serializers )
249249
250- return cast ( Type [ EntityModelType ], InputModel )
250+ return InputModel
251251
252252 @classmethod
253253 def model_to_orm_fields (cls ) -> dict [str , FieldInfo ]:
@@ -297,7 +297,7 @@ def to_model(self, repository_path: Optional[pathlib.Path] = None, unstored: boo
297297 """
298298 fields = {}
299299
300- Model = self .Model .as_input_model () if unstored else self .Model
300+ Model = self .Model .as_input_model () if unstored else self .Model # noqa: N806
301301
302302 for key , field in Model .model_fields .items ():
303303 if orm_to_model := get_metadata (field , 'orm_to_model' ):
@@ -360,7 +360,7 @@ def from_serialized(cls, unstored: bool = False, **kwargs: dict[str, Any]) -> 'E
360360 cls ._logger .warning (
361361 'Serialization through pydantic is still an experimental feature and might break in future releases.'
362362 )
363- Model = cls .Model .as_input_model () if unstored else cls .Model
363+ Model = cls .Model .as_input_model () if unstored else cls .Model # noqa: N806
364364 return cls .from_model (Model (** kwargs )) # type: ignore[arg-type]
365365
366366 @classproperty
0 commit comments