Set type parameters for Field in get_fields() (#882)

* Set type parameters for Field in get_fields()

This fixes an issue with Pyright strict type checking where Pyright complains that the type parameters aren't known.

* Fix type parameters in other methods
This commit is contained in:
w0rp
2022-03-24 17:14:16 -04:00
committed by GitHub
parent 32a33c332d
commit 1672b54c89

View File

@@ -93,8 +93,8 @@ class Options(Generic[_M]):
def installed(self): ...
def contribute_to_class(self, cls: Type[Model], name: str) -> None: ...
def add_manager(self, manager: Manager) -> None: ...
def add_field(self, field: Union[GenericForeignKey, Field], private: bool = ...) -> None: ...
def setup_pk(self, field: Field) -> None: ...
def add_field(self, field: Union[GenericForeignKey, Field[Any, Any]], private: bool = ...) -> None: ...
def setup_pk(self, field: Field[Any, Any]) -> None: ...
def setup_proxy(self, target: Type[Model]) -> None: ...
def can_migrate(self, connection: Union[BaseDatabaseWrapper, str]) -> bool: ...
@property
@@ -104,7 +104,7 @@ class Options(Generic[_M]):
@property
def many_to_many(self) -> List[ManyToManyField]: ...
@property
def fields_map(self) -> Dict[str, Union[Field, ForeignObjectRel]]: ...
def fields_map(self) -> Dict[str, Union[Field[Any, Any], ForeignObjectRel]]: ...
@property
def managers(self) -> List[Manager]: ...
@property
@@ -119,4 +119,4 @@ class Options(Generic[_M]):
def get_path_from_parent(self, parent: Type[Model]) -> List[PathInfo]: ...
def get_fields(
self, include_parents: bool = ..., include_hidden: bool = ...
) -> List[Union[Field, ForeignObjectRel]]: ...
) -> List[Union[Field[Any, Any], ForeignObjectRel]]: ...