Skip to content

Commit

Permalink
Fixup db.models.fields.Field overloads for pyright 1.1.378 (#265)
Browse files Browse the repository at this point in the history
Fix for #264
  • Loading branch information
minmax authored Sep 2, 2024
1 parent 7eec985 commit 7f9bd0d
Show file tree
Hide file tree
Showing 27 changed files with 223 additions and 141 deletions.
2 changes: 1 addition & 1 deletion django-stubs/contrib/admin/templatetags/base.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class InclusionAdminNode(InclusionNode):
args: list[Any]
func: Callable[..., Any]
kwargs: dict[Any, Any]
takes_context: bool
takes_context: bool # pyright: ignore[reportIncompatibleVariableOverride]
template_name: str = ...
def __init__(
self,
Expand Down
2 changes: 1 addition & 1 deletion django-stubs/contrib/contenttypes/fields.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ class GenericForeignKey(FieldCacheMixin):
def __set__(self, instance: Model, value: Any | None) -> None: ...

class GenericRel(ForeignObjectRel):
field: GenericRelation
field: GenericRelation # pyright: ignore[reportIncompatibleVariableOverride]
def __init__(
self,
field: GenericRelation,
Expand Down
4 changes: 3 additions & 1 deletion django-stubs/contrib/contenttypes/models.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ class ContentType(models.Model):
id: int
app_label: models.CharField[Any] = ...
model: models.CharField[Any] = ...
objects: ClassVar[ContentTypeManager] = ...
objects: ClassVar[ # pyright: ignore[reportIncompatibleVariableOverride]
ContentTypeManager
] = ...
permission_set: Manager[Permission]
@property
def name(self) -> str: ...
Expand Down
8 changes: 5 additions & 3 deletions django-stubs/contrib/postgres/fields/array.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,18 @@ class ArrayField(CheckFieldDefaultMixin, Generic[_V], Field[_V | Combinable, _V]
from_db_value: Any = ...
base_field: Field[_V, _V] = ...
@overload
def __new__( # type: ignore [misc]
def __new__(
cls,
base_field: Field[Any, _V],
size: int | None = ...,
verbose_name: str | None = ...,
*,
name: str | None = ...,
primary_key: bool = ...,
max_length: int | None = ...,
unique: bool = ...,
blank: bool = ...,
null: Literal[False] = ...,
null: Literal[False] = False,
db_index: bool = ...,
default: list[_V] | Callable[[], list[_V]] | None = ...,
editable: bool = ...,
Expand All @@ -51,12 +52,13 @@ class ArrayField(CheckFieldDefaultMixin, Generic[_V], Field[_V | Combinable, _V]
base_field: Field[Any, _V],
size: int | None = ...,
verbose_name: str | None = ...,
*,
name: str | None = ...,
primary_key: bool = ...,
max_length: int | None = ...,
unique: bool = ...,
blank: bool = ...,
null: Literal[True] = ...,
null: Literal[True],
db_index: bool = ...,
default: list[_V] | Callable[[], list[_V]] | None = ...,
editable: bool = ...,
Expand Down
18 changes: 12 additions & 6 deletions django-stubs/contrib/postgres/fields/citext.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,13 @@ class CICharField(CIText, CharField[_C]):
def __init__(
self: CICharField[str],
verbose_name: str | bytes | None = ...,
*,
name: str | None = ...,
primary_key: bool = ...,
max_length: int | None = ...,
unique: bool = ...,
blank: bool = ...,
null: Literal[False] = ...,
null: Literal[False] = False,
db_index: bool = ...,
default: Any = ...,
editable: bool = ...,
Expand All @@ -45,12 +46,13 @@ class CICharField(CIText, CharField[_C]):
def __init__(
self: CICharField[str | None],
verbose_name: str | bytes | None = ...,
*,
name: str | None = ...,
primary_key: bool = ...,
max_length: int | None = ...,
unique: bool = ...,
blank: bool = ...,
null: Literal[True] = ...,
null: Literal[True],
db_index: bool = ...,
default: Any = ...,
editable: bool = ...,
Expand All @@ -74,12 +76,13 @@ class CIEmailField(CIText, EmailField[_C]):
def __init__(
self: CIEmailField[str],
verbose_name: str | bytes | None = ...,
*,
name: str | None = ...,
primary_key: bool = ...,
max_length: int | None = ...,
unique: bool = ...,
blank: bool = ...,
null: Literal[False] = ...,
null: Literal[False] = False,
db_index: bool = ...,
default: Any = ...,
editable: bool = ...,
Expand All @@ -99,12 +102,13 @@ class CIEmailField(CIText, EmailField[_C]):
def __init__(
self: CIEmailField[str | None],
verbose_name: str | bytes | None = ...,
*,
name: str | None = ...,
primary_key: bool = ...,
max_length: int | None = ...,
unique: bool = ...,
blank: bool = ...,
null: Literal[True] = ...,
null: Literal[True],
db_index: bool = ...,
default: Any = ...,
editable: bool = ...,
Expand All @@ -128,12 +132,13 @@ class CITextField(CIText, TextField[_C]):
def __init__(
self: CITextField[str],
verbose_name: str | bytes | None = ...,
*,
name: str | None = ...,
primary_key: bool = ...,
max_length: int | None = ...,
unique: bool = ...,
blank: bool = ...,
null: Literal[False] = ...,
null: Literal[False] = False,
db_index: bool = ...,
default: Any = ...,
editable: bool = ...,
Expand All @@ -153,12 +158,13 @@ class CITextField(CIText, TextField[_C]):
def __init__(
self: CITextField[str | None],
verbose_name: str | bytes | None = ...,
*,
name: str | None = ...,
primary_key: bool = ...,
max_length: int | None = ...,
unique: bool = ...,
blank: bool = ...,
null: Literal[True] = ...,
null: Literal[True],
db_index: bool = ...,
default: Any = ...,
editable: bool = ...,
Expand Down
6 changes: 4 additions & 2 deletions django-stubs/contrib/postgres/fields/hstore.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,13 @@ class HStoreField(Generic[_T], CheckFieldDefaultMixin, Field[Any, Any]):
def __init__(
self: HStoreField[dict[str, str | None]],
verbose_name: str | bytes | None = ...,
*,
name: str | None = ...,
primary_key: bool = ...,
max_length: int | None = ...,
unique: bool = ...,
blank: bool = ...,
null: Literal[False] = ...,
null: Literal[False] = False,
db_index: bool = ...,
default: Any = ...,
editable: bool = ...,
Expand All @@ -44,12 +45,13 @@ class HStoreField(Generic[_T], CheckFieldDefaultMixin, Field[Any, Any]):
def __init__(
self: HStoreField[dict[str, str | None] | None],
verbose_name: str | bytes | None = ...,
*,
name: str | None = ...,
primary_key: bool = ...,
max_length: int | None = ...,
unique: bool = ...,
blank: bool = ...,
null: Literal[True] = ...,
null: Literal[True],
db_index: bool = ...,
default: Any = ...,
editable: bool = ...,
Expand Down
2 changes: 1 addition & 1 deletion django-stubs/core/files/base.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class File(FileProxyMixin, IO[Any]):
def close(self) -> None: ...

class ContentFile(File):
file: StringIO
file: StringIO # pyright: ignore[reportIncompatibleVariableOverride]
size: Any = ...
def __init__(self, content: bytes | str, name: str | None = ...) -> None: ...
def write(self, data: str) -> int: ... # type: ignore[override]
Expand Down
12 changes: 6 additions & 6 deletions django-stubs/core/mail/message.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -26,25 +26,25 @@ class MIMEMixin: ...

class SafeMIMEMessage(MIMEMixin, MIMEMessage):
defects: list[Any]
epilogue: None
epilogue: None # pyright: ignore[reportIncompatibleVariableOverride]
policy: Policy # type: ignore [no-any-unimported]
preamble: None
preamble: None # pyright: ignore[reportIncompatibleVariableOverride]

class SafeMIMEText(MIMEMixin, MIMEText):
defects: list[Any]
epilogue: None
epilogue: None # pyright: ignore[reportIncompatibleVariableOverride]
policy: Policy # type: ignore [no-any-unimported]
preamble: None
preamble: None # pyright: ignore[reportIncompatibleVariableOverride]
encoding: str = ...
def __init__(
self, _text: str, _subtype: str = ..., _charset: str = ...
) -> None: ...

class SafeMIMEMultipart(MIMEMixin, MIMEMultipart):
defects: list[Any]
epilogue: None
epilogue: None # pyright: ignore[reportIncompatibleVariableOverride]
policy: Policy # type: ignore [no-any-unimported]
preamble: None
preamble: None # pyright: ignore[reportIncompatibleVariableOverride]
encoding: str = ...
def __init__(
self,
Expand Down
2 changes: 1 addition & 1 deletion django-stubs/core/serializers/json.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@ class DjangoJSONEncoder(json.JSONEncoder):
allow_nan: bool
check_circular: bool
ensure_ascii: bool
indent: int
indent: int # pyright: ignore[reportIncompatibleVariableOverride]
skipkeys: bool
sort_keys: bool
4 changes: 2 additions & 2 deletions django-stubs/core/servers/basehttp.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ class WSGIRequestHandler(simple_server.WSGIRequestHandler):
close_connection: bool
connection: WSGIRequest
request: WSGIRequest
rfile: BytesIO
wfile: BytesIO
rfile: BytesIO # pyright: ignore[reportIncompatibleVariableOverride]
wfile: BytesIO # pyright: ignore[reportIncompatibleVariableOverride]
protocol_version: str = ...
def address_string(self) -> str: ...
def log_message(self, format: str, *args: Any) -> None: ...
Expand Down
Loading

0 comments on commit 7f9bd0d

Please sign in to comment.