8000 Reenable flake8-pyi's Y011 and Y015 (#9551) · python/typeshed@2b9f200 · GitHub
[go: up one dir, main page]

Skip to content

Commit 2b9f200

Browse files
authored
Reenable flake8-pyi's Y011 and Y015 (#9551)
1 parent 597e1a0 commit 2b9f200

File tree

4 files changed

+23
-26
lines changed
  • < 8000 svg aria-hidden="true" focusable="false" class="octicon octicon-chevron-down" viewBox="0 0 12 12" width="12" height="12" fill="currentColor" display="inline-block" overflow="visible" style="vertical-align:text-bottom">
    stubs

4 files changed

+23
-26
lines changed

.flake8

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,22 +23,18 @@
2323
# Currently can't be enabled due to a few lingering bugs in mypy regarding
2424
# PEP 604 type aliases (see #4819).
2525

26-
# Outdated rules in flake8-pyi that should possibly be deprecated altogether:
27-
# Y011 All default values for typed function arguments must be `...`
28-
# Y015 Attribute must not have a default value other than `...`
29-
#
3026
# A bugbear rule that has many false positives:
3127
# B028 consider using the `!r` conversion flag instead of manually surrounding things in quotes
3228

3329
[flake8]
3430
per-file-ignores =
3531
*.py: B028, E203, E301, E302, E305, E501
36-
*.pyi: B, E301, E302, E305, E501, E701, E741, F401, F403, F405, F822, Y011, Y015, Y037
32+
*.pyi: B, E301, E302, E305, E501, E701, E741, F401, F403, F405, F822, Y037
3733
# Since typing.pyi defines "overload" this is not recognized by flake8 as typing.overload.
3834
# Unfortunately, flake8 does not allow to "noqa" just a specific error inside the file itself.
3935
# https://github.com/PyCQA/flake8/issues/1079
4036
# F811 redefinition of unused '...'
41-
stdlib/typing.pyi: B, E301, E302, E305, E501, E701, E741, F401, F403, F405, F811, F822, Y011, Y015, Y037
37+
stdlib/typing.pyi: B, E301, E302, E305, E501, E701, E741, F401, F403, F405, F811, F822, Y037
4238
# Generated protobuf files include docstrings
4339
*_pb2.pyi: B, E301, E302, E305, E501, E701, Y021, Y026
4440

stubs/PyScreeze/pyscreeze/__init__.pyi

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import sys
21
from _typeshed import Incomplete, StrOrBytesPath
32
from collections.abc import Callable, Generator
43
from typing import NamedTuple, SupportsFloat, TypeVar, overload
@@ -18,7 +17,7 @@ _R = TypeVar("_R")
1817
_Mat: TypeAlias = Incomplete
1918

2019
useOpenCV: bool
21-
RUNNING_PYTHON_2 = sys.version_info < (3,)
20+
RUNNING_PYTHON_2: Literal[False]
2221
GRAYSCALE_DEFAULT: Literal[False]
2322
USE_IMAGE_NOT_FOUND_EXCEPTION: bool
2423
scrotExists: bool

stubs/pywin32/win32/lib/ntsecuritycon.pyi

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
from typing_extensions import TypeAlias
2+
3+
_SixIntTuple: TypeAlias = tuple[int, int, int, int, int, int]
4+
15
DELETE: int
26
READ_CONTROL: int
37
WRITE_DAC: int
@@ -32,12 +36,12 @@ FILE_ALL_ACCESS: int
3236
FILE_GENERIC_READ: int
3337
FILE_GENERIC_WRITE: int
3438
FILE_GENERIC_EXECUTE: int
35-
SECURITY_NULL_SID_AUTHORITY = (0, 0, 0, 0, 0, 0)
36-
SECURITY_WORLD_SID_AUTHORITY = (0, 0, 0, 0, 0, 1)
37-
SECURITY_LOCAL_SID_AUTHORITY = (0, 0, 0, 0, 0, 2)
38-
SECURITY_CREATOR_SID_AUTHORITY = (0, 0, 0, 0, 0, 3)
39-
SECURITY_NON_UNIQUE_AUTHORITY = (0, 0, 0, 0, 0, 4)
40-
SECURITY_RESOURCE_MANAGER_AUTHORITY = (0, 0, 0, 0, 0, 9)
39+
SECURITY_NULL_SID_AUTHORITY: _SixIntTuple
40+
SECURITY_WORLD_SID_AUTHORITY: _SixIntTuple
41+
SECURITY_LOCAL_SID_AUTHORITY: _SixIntTuple
42+
SECURITY_CREATOR_SID_AUTHORITY: _SixIntTuple
43+
SECURITY_NON_UNIQUE_AUTHORITY: _SixIntTuple
44+
SECURITY_RESOURCE_MANAGER_AUTHORITY: _SixIntTuple
4145
SECURITY_NULL_RID: int
4246
SECURITY_WORLD_RID: int
4347
SECURITY_LOCAL_RID: int
@@ -46,7 +50,7 @@ SECURITY_CREATOR_GROUP_RID: int
4650
SECURITY_CREATOR_OWNER_SERVER_RID: int
4751
SECURITY_CREATOR_GROUP_SERVER_RID: int
4852
SECURITY_CREATOR_OWNER_RIGHTS_RID: int
49-
SECURITY_NT_AUTHORITY = (0, 0, 0, 0, 0, 5)
53+
SECURITY_NT_AUTHORITY: _SixIntTuple
5054
SECURITY_DIALUP_RID: int
5155
SECURITY_NETWORK_RID: int
5256
SECURITY_BATCH_RID: int
@@ -98,19 +102,19 @@ DOMAIN_ALIAS_RID_CRYPTO_OPERATORS: int
98102
DOMAIN_ALIAS_RID_CACHEABLE_PRINCIPALS_GROUP: int
99103
DOMAIN_ALIAS_RID_NON_CACHEABLE_PRINCIPALS_GROUP: int
100104
DOMAIN_ALIAS_RID_EVENT_LOG_READERS_GROUP: int
101-
SECURITY_MANDATORY_LABEL_AUTHORITY = (0, 0, 0, 0, 0, 16)
105+
SECURITY_MANDATORY_LABEL_AUTHORITY: _SixIntTuple
102106
SECURITY_MANDATORY_UNTRUSTED_RID: int
103107
SECURITY_MANDATORY_LOW_RID: int
104108
SECURITY_MANDATORY_MEDIUM_RID: int
105109
SECURITY_MANDATORY_HIGH_RID: int
106110
SECURITY_MANDATORY_SYSTEM_RID: int
107111
SECURITY_MANDATORY_PROTECTED_PROCESS_RID: int
108112
SECURITY_MANDATORY_MAXIMUM_USER_RID: int
109-
SYSTEM_LUID = (999, 0)
110-
ANONYMOUS_LOGON_LUID = (998, 0)
111-
LOCALSERVICE_LUID = (997, 0)
112-
NETWORKSERVICE_LUID = (996, 0)
113-
IUSER_LUID = (995, 0)
113+
SYSTEM_LUID: tuple[int, int]
114+
ANONYMOUS_LOGON_LUID: tuple[int, int]
115+
LOCALSERVICE_LUID: tuple[int, int]
116+
NETWORKSERVICE_LUID: tuple[int, int]
117+
IUSER_LUID: tuple[int, int]
114118
SE_GROUP_MANDATORY: int
115119
SE_GROUP_ENABLED_BY_DEFAULT: int
116120
SE_GROUP_ENABLED: int

stubs/tensorflow/tensorflow/__init__.pyi

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -109,8 +109,8 @@ class Variable(Tensor, metaclass=_VariableMetaclass):
109109
dtype: _DTypeLike | None = None,
110110
import_scope: str | None = None,
111111
constraint: Callable[[Tensor], Tensor] | None = None,
112-
synchronization: VariableSynchronization = VariableSynchronization.AUTO,
113-
aggregation: VariableAggregation = VariableAggregation.NONE,
112+
synchronization: VariableSynchronization = ...,
113+
aggregation: VariableAggregation = ...,
114114
shape: _ShapeLike | None = None,
115115
experimental_enable_variable_lifting: _bool = True,
116116
) -> None: ...
@@ -121,9 +121,7 @@ class RaggedTensor(metaclass=ABCMeta):
121121
self, axis: _TensorCompatible | None = None, name: str | None = None, out_type: _DTypeLike | None = None
122122
) -> Tensor: ...
123123
@classmethod
124-
def from_sparse(
125-
cls, st_input: SparseTensor, name: str | None = None, row_splits_dtype: _DTypeLike = int64
126-
) -> RaggedTensor: ...
124+
def from_sparse(cls, st_input: SparseTensor, name: str | None = None, row_splits_dtype: _DTypeLike = ...) -> RaggedTensor: ...
127125
def to_sparse(self, name: str | None = None) -> SparseTensor: ...
128126
def to_tensor(
129127
self, default_value: float | str | None = None, name: str | None = None, shape: _ShapeLike | None = None

0 commit comments

Comments
 (0)
0