8000 Fixup `db.models.fields.Field` overloads for pyright 1.1.378 (#265) · sbdchd/django-types@7f9bd0d · GitHub 8000
[go: up one dir, main page]

Skip to content

Commit 7f9bd0d

Browse files
authored
Fixup db.models.fields.Field overloads for pyright 1.1.378 (#265)
Fix for #264
1 parent 7eec985 commit 7f9bd0d

File tree

27 files changed

+223
-141
lines changed

27 files changed

+223
-141
lines changed

django-stubs/contrib/admin/templatetags/base.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ class InclusionAdminNode(InclusionNode):
1010
args: list[Any]
1111
func: Callable[..., Any]
1212
kwargs: dict[Any, Any]
13-
takes_context: bool
13+
takes_context: bool # pyright: ignore[reportIncompatibleVariableOverride]
1414
template_name: str = ...
1515
def __init__(
1616
self,

django-stubs/contrib/contenttypes/fields.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ class GenericForeignKey(FieldCacheMixin):
6767
def __set__(self, instance: Model, value: Any | None) -> None: ...
6868

6969
class GenericRel(ForeignObjectRel):
70-
field: GenericRelation
70+
field: GenericRelation # pyright: ignore[reportIncompatibleVariableOverride]
7171
def __init__(
7272
self,
7373
field: GenericRelation,

django-stubs/contrib/contenttypes/models.pyi

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,9 @@ class ContentType(models.Model):
2222
id: int
2323
app_label: models.CharField[Any] = ...
2424
model: models.CharField[Any] = ...
25-
objects: ClassVar[ContentTypeManager] = ...
25+
objects: ClassVar[ # pyright: ignore[reportIncompatibleVariableOverride]
26+
ContentTypeManager
27+
] = ...
2628
permission_set: Manager[Permission]
2729
@property
2830
def name(self) -> str: ...

django-stubs/contrib/postgres/fields/array.pyi

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,17 +17,18 @@ class ArrayField(CheckFieldDefaultMixin, Generic[_V], Field[_V | Combinable, _V]
1717
from_db_value: Any = ...
1818
base_field: Field[_V, _V] = ...
1919
@overload
20-
def __new__( # type: ignore [misc]
20+
def __new__(
2121
cls,
2222
base_field: Field[Any, _V],
2323
size: int | None = ...,
2424
verbose_name: str | None = ...,
25+
*,
2526
name: str | None = ...,
2627
primary_key: bool = ...,
2728
max_length: int | None = ...,
2829
unique: bool = ...,
2930
blank: bool = ...,
30-
null: Literal[False] = ...,
31+
null: Literal[False] = False,
3132
db_index: bool = ...,
3233
default: list[_V] | Callable[[], list[_V]] | None = ...,
3334
editable: bool = ...,
@@ -51,12 +52,13 @@ class ArrayField(CheckFieldDefaultMixin, Generic[_V], Field[_V | Combinable, _V]
5152
base_field: Field[Any, _V],
5253
size: int | None = ...,
5354
verbose_name: str | None = ...,
55+
*,
5456
name: str | None = ...,
5557
primary_key: bool = ...,
5658
max_length: int | None = ...,
5759
unique: bool = ...,
5860
blank: bool = ...,
59-
null: Literal[True] = ...,
61+
null: Literal[True],
6062
db_index: bool = ...,
6163
default: list[_V] | Callable[[], list[_V]] | None = ...,
6264
editable: bool = ...,

django-stubs/contrib/postgres/fields/citext.pyi

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,13 @@ class CICharField(CIText, CharField[_C]):
2020
def __init__(
2121
self: CICharField[str],
2222
verbose_name: str | bytes | None = ...,
23+
*,
2324
name: str | None = ...,
2425
primary_key: bool = ...,
2526
max_length: int | None = ...,
2627
unique: bool = ...,
2728
blank: bool = ...,
28-
null: Literal[False] = ...,
29+
null: Literal[False] = False,
2930
db_index: bool = ...,
3031
default: Any = ...,
3132
editable: bool = ...,
@@ -45,12 +46,13 @@ class CICharField(CIText, CharField[_C]):
4546
def __init__(
4647
self: CICharField[str | None],
4748
verbose_name: str | bytes | None = ...,
49+
*,
4850
name: str | None = ...,
4951
primary_key: bool = ...,
5052
max_length: int | None = ...,
5153
unique: bool = ...,
5254
blank: bool = ...,
53-
null: Literal[True] = ...,
55+
null: Literal[True],
5456
db_index: bool = ...,
5557
default: Any = ...,
5658
editable: bool = ...,
@@ -74,12 +76,13 @@ class CIEmailField(CIText, EmailField[_C]):
7476
def __init__(
7577
self: CIEmailField[str],
7678
verbose_name: str | bytes | None = ...,
79+
*,
7780
name: str | None = ...,
7881
primary_key: bool = ...,
7982
max_length: int | None = ...,
8083
unique: bool = ...,
8184
blank: bool = ...,
82-
null: Literal[False] = ...,
85+
null: Literal[False] = False,
8386
db_index: bool = ...,
8487
default: Any = ...,
8588
editable: bool = ...,
@@ -99,12 +102,13 @@ class CIEmailField(CIText, EmailField[_C]):
99102
def __init__(
100103
self: CIEmailField[str | None],
101104
verbose_name: str | bytes | None = ...,
105+
*,
102106
name: str | None = ...,
103107
primary_key: bool = ...,
104108
max_length: int | None = ...,
105109
unique: bool = ...,
106110
blank: bool = ...,
107-
null: Literal[True] = ...,
111+
null: Literal[True],
108112
db_index: bool = ...,
109113
default: Any = ...,
110114
editable: bool = ...,
@@ -128,12 +132,13 @@ class CITextField(CIText, TextField[_C]):
128132
def __init__(
129133
self: CITextField[str],
130134
verbose_name: str | bytes | None = ...,
135+
*,
131136
name: str | None = ...,
132137
primary_key: bool = ...,
133138
max_length: int | None = ...,
134139
unique: bool = ...,
135140
blank: bool = ...,
136-
null: Literal[False] = ...,
141+
null: Literal[False] = False,
137142
db_index: bool = ...,
138143
default: Any = ...,
139144
editable: bool = ...,
@@ -153,12 +158,13 @@ class CITextField(CIText, TextField[_C]):
153158
def __init__(
154159
self: CITextField[str | None],
155160
verbose_name: str | bytes | None = ...,
161+
*,
156162
name: str | None = ...,
157163
primary_key: bool = ...,
158164
max_length: int | None = ...,
159165
unique: bool = ...,
160166
blank: bool = ...,
161-
null: Literal[True] = ...,
167+
null: Literal[True],
162168
db_index: bool = ...,
163169
default: Any = ...,
164170
editable: bool = ...,

django-stubs/contrib/postgres/fields/hstore.pyi

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,13 @@ class HStoreField(Generic[_T], CheckFieldDefaultMixin, Field[Any, Any]):
1919
def __init__(
2020
self: HStoreField[dict[str, str | None]],
2121
verbose_name: str | bytes | None = ...,
22+
*,
2223
name: str | None = ...,
2324
primary_key: bool = ...,
2425
max_length: int | None = ...,
2526
unique: bool = ...,
2627
blank: bool = ...,
27-
null: Literal[False] = ...,
28+
null: Literal[False] = False,
2829
db_index: bool = ...,
2930
default: Any = ...,
3031
editable: bool = ...,
@@ -44,12 +45,13 @@ class HStoreField(Generic[_T], CheckFieldDefaultMixin, Field[Any, Any]):
4445
def __init__(
4546
self: HStoreField[dict[str, str | None] | None],
4647
verbose_name: str | bytes | None = ...,
48+
*,
4749
name: str | None = ...,
4850
primary_key: bool = ...,
4951
max_length: int | None = ...,
5052
unique: bool = ...,
5153
blank: bool = ...,
52-
null: Literal[True] = ...,
54+
null: Literal[True],
5355
db_index: bool = ...,
5456
default: Any = ...,
5557
editable: bool = ...,

django-stubs/core/files/base.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ class File(FileProxyMixin, IO[Any]):
3131
def close(self) -> None: ...
3232

3333
class ContentFile(File):
34-
file: StringIO
34+
file: StringIO # pyright: ignore[reportIncompatibleVariableOverride]
3535
size: Any = ...
3636
def __init__(self, content: bytes | str, name: str | None = ...) -> None: ...
3737
def write(self, data: str) -> int: ... # type: ignore[override]

django-stubs/core/mail/message.pyi

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,25 +26,25 @@ class MIMEMixin: ...
2626

2727
class SafeMIMEMessage(MIMEMixin, MIMEMessage):
2828
defects: list[Any]
29-
epilogue: None
29+
epilogue: None # pyright: ignore[reportIncompatibleVariableOverride]
3030
policy: Policy # type: ignore [no-any-unimported]
31-
preamble: None
31+
preamble: None # pyright: ignore[reportIncompatibleVariableOverride]
3232

3333
class SafeMIMEText(MIMEMixin, MIMEText):
3434
defects: list[Any]
35-
epilogue: None
35+
epilogue: None # pyright: ignore[reportIncompatibleVariableOverride]
3636
policy: Policy # type: ignore [no-any-unimported]
37-
preamble: None
37+
preamble: None # pyright: ignore[reportIncompatibleVariableOverride]
3838
encoding: str = ...
3939
def __init__(
4040
self, _text: str, _subtype: str = ..., _charset: str = ...
4141
) -> None: ...
4242

4343
class SafeMIMEMultipart(MIMEMixin, MIMEMultipart):
4444
defects: list[Any]
45-
epilogue: None
45+
epilogue: None # pyright: ignore[reportIncompatibleVariableOverride]
4646
policy: Policy # type: ignore [no-any-unimported]
47-
preamble: None
47+
preamble: None # pyright: ignore[reportIncompatibleVariableOverride]
4848
encoding: str = ...
4949
def __init__(
5050
self,

django-stubs/core/serializers/json.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,6 @@ class DjangoJSONEncoder(json.JSONEncoder):
1212
allow_nan: bool
1313
check_circular: bool
1414
ensure_ascii: bool
15-
indent: int
15+
indent: int # pyright: ignore[reportIncompatibleVariableOverride]
1616
skipkeys: bool
1717
sort_keys: bool

django-stubs/core/servers/basehttp.pyi

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ class WSGIRequestHandler(simple_server.WSGIRequestHandler):
2828
close_connection: bool
2929
connection: WSGIRequest
3030
request: WSGIRequest
31-
rfile: BytesIO
32-
wfile: BytesIO
31+
rfile: BytesIO # pyright: ignore[reportIncompatibleVariableOverride]
32+
wfile: BytesIO # pyright: ignore[reportIncompatibleVariableOverride]
3333
protocol_version: str = ...
3434
def address_string(self) -> str: ...
3535
def log_message(self, format: str, *args: Any) -> None: ...

0 commit comments

Comments
 (0)
0