Skip to content

Reenable flake8-pyi's Y011 and Y015 #9551

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jan 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 2 additions & 6 deletions .flake8
Original file line number Diff line number Diff line change
Expand Up @@ -23,22 +23,18 @@
# Currently can't be enabled due to a few lingering bugs in mypy regarding
# PEP 604 type aliases (see #4819).

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

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

Expand Down
3 changes: 1 addition & 2 deletions stubs/PyScreeze/pyscreeze/__init__.pyi
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import sys
from _typeshed import Incomplete, StrOrBytesPath
from collections.abc import Callable, Generator
from typing import NamedTuple, SupportsFloat, TypeVar, overload
Expand All @@ -18,7 +17,7 @@ _R = TypeVar("_R")
_Mat: TypeAlias = Incomplete

useOpenCV: bool
RUNNING_PYTHON_2 = sys.version_info < (3,)
RUNNING_PYTHON_2: Literal[False]
GRAYSCALE_DEFAULT: Literal[False]
USE_IMAGE_NOT_FOUND_EXCEPTION: bool
scrotExists: bool
Expand Down
30 changes: 17 additions & 13 deletions stubs/pywin32/win32/lib/ntsecuritycon.pyi
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
from typing_extensions import TypeAlias

_SixIntTuple: TypeAlias = tuple[int, int, int, int, int, int]

DELETE: int
READ_CONTROL: int
WRITE_DAC: int
Expand Down Expand Up @@ -32,12 +36,12 @@ FILE_ALL_ACCESS: int
FILE_GENERIC_READ: int
FILE_GENERIC_WRITE: int
FILE_GENERIC_EXECUTE: int
SECURITY_NULL_SID_AUTHORITY = (0, 0, 0, 0, 0, 0)
SECURITY_WORLD_SID_AUTHORITY = (0, 0, 0, 0, 0, 1)
SECURITY_LOCAL_SID_AUTHORITY = (0, 0, 0, 0, 0, 2)
SECURITY_CREATOR_SID_AUTHORITY = (0, 0, 0, 0, 0, 3)
SECURITY_NON_UNIQUE_AUTHORITY = (0, 0, 0, 0, 0, 4)
SECURITY_RESOURCE_MANAGER_AUTHORITY = (0, 0, 0, 0, 0, 9)
SECURITY_NULL_SID_AUTHORITY: _SixIntTuple
SECURITY_WORLD_SID_AUTHORITY: _SixIntTuple
SECURITY_LOCAL_SID_AUTHORITY: _SixIntTuple
SECURITY_CREATOR_SID_AUTHORITY: _SixIntTuple
SECURITY_NON_UNIQUE_AUTHORITY: _SixIntTuple
SECURITY_RESOURCE_MANAGER_AUTHORITY: _SixIntTuple
SECURITY_NULL_RID: int
SECURITY_WORLD_RID: int
SECURITY_LOCAL_RID: int
Expand All @@ -46,7 +50,7 @@ SECURITY_CREATOR_GROUP_RID: int
SECURITY_CREATOR_OWNER_SERVER_RID: int
SECURITY_CREATOR_GROUP_SERVER_RID: int
SECURITY_CREATOR_OWNER_RIGHTS_RID: int
SECURITY_NT_AUTHORITY = (0, 0, 0, 0, 0, 5)
SECURITY_NT_AUTHORITY: _SixIntTuple
SECURITY_DIALUP_RID: int
SECURITY_NETWORK_RID: int
SECURITY_BATCH_RID: int
Expand Down Expand Up @@ -98,19 +102,19 @@ DOMAIN_ALIAS_RID_CRYPTO_OPERATORS: int
DOMAIN_ALIAS_RID_CACHEABLE_PRINCIPALS_GROUP: int
DOMAIN_ALIAS_RID_NON_CACHEABLE_PRINCIPALS_GROUP: int
DOMAIN_ALIAS_RID_EVENT_LOG_READERS_GROUP: int
SECURITY_MANDATORY_LABEL_AUTHORITY = (0, 0, 0, 0, 0, 16)
SECURITY_MANDATORY_LABEL_AUTHORITY: _SixIntTuple
SECURITY_MANDATORY_UNTRUSTED_RID: int
SECURITY_MANDATORY_LOW_RID: int
SECURITY_MANDATORY_MEDIUM_RID: int
SECURITY_MANDATORY_HIGH_RID: int
SECURITY_MANDATORY_SYSTEM_RID: int
SECURITY_MANDATORY_PROTECTED_PROCESS_RID: int
SECURITY_MANDATORY_MAXIMUM_USER_RID: int
SYSTEM_LUID = (999, 0)
ANONYMOUS_LOGON_LUID = (998, 0)
LOCALSERVICE_LUID = (997, 0)
NETWORKSERVICE_LUID = (996, 0)
IUSER_LUID = (995, 0)
SYSTEM_LUID: tuple[int, int]
ANONYMOUS_LOGON_LUID: tuple[int, int]
LOCALSERVICE_LUID: tuple[int, int]
NETWORKSERVICE_LUID: tuple[int, int]
IUSER_LUID: tuple[int, int]
SE_GROUP_MANDATORY: int
SE_GROUP_ENABLED_BY_DEFAULT: int
SE_GROUP_ENABLED: int
Expand Down
8 changes: 3 additions & 5 deletions stubs/tensorflow/tensorflow/__init__.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,8 @@ class Variable(Tensor, metaclass=_VariableMetaclass):
dtype: _DTypeLike | None = None,
import_scope: str | None = None,
constraint: Callable[[Tensor], Tensor] | None = None,
synchronization: VariableSynchronization = VariableSynchronization.AUTO,
aggregation: VariableAggregation = VariableAggregation.NONE,
synchronization: VariableSynchronization = ...,
aggregation: VariableAggregation = ...,
shape: _ShapeLike | None = None,
experimental_enable_variable_lifting: _bool = True,
) -> None: ...
Expand All @@ -121,9 +121,7 @@ class RaggedTensor(metaclass=ABCMeta):
self, axis: _TensorCompatible | None = None, name: str | None = None, out_type: _DTypeLike | None = None
) -> Tensor: ...
@classmethod
def from_sparse(
cls, st_input: SparseTensor, name: str | None = None, row_splits_dtype: _DTypeLike = int64
) -> RaggedTensor: ...
def from_sparse(cls, st_input: SparseTensor, name: str | None = None, row_splits_dtype: _DTypeLike = ...) -> RaggedTensor: ...
def to_sparse(self, name: str | None = None) -> SparseTensor: ...
def to_tensor(
self, default_value: float | str | None = None, name: str | None = None, shape: _ShapeLike | None = None
Expand Down