Skip to content
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

Use assignment instead of annotation in third party enums #11957

Merged
merged 3 commits into from
May 18, 2024
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
4 changes: 2 additions & 2 deletions stubs/antlr4-python3-runtime/antlr4/atn/ATNType.pyi
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from enum import IntEnum

class ATNType(IntEnum):
LEXER: int
PARSER: int
LEXER = 0
PARSER = 1
@classmethod
def fromOrdinal(cls, i: int): ...
16 changes: 8 additions & 8 deletions stubs/antlr4-python3-runtime/antlr4/atn/LexerAction.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ from enum import IntEnum
Lexer: Incomplete

class LexerActionType(IntEnum):
CHANNEL: int
CUSTOM: int
MODE: int
MORE: int
POP_MODE: int
PUSH_MODE: int
SKIP: int
TYPE: int
CHANNEL = 0
CUSTOM = 1
MODE = 2
MORE = 3
POP_MODE = 4
PUSH_MODE = 5
SKIP = 6
TYPE = 7

class LexerAction:
actionType: Incomplete
Expand Down
6 changes: 3 additions & 3 deletions stubs/antlr4-python3-runtime/antlr4/atn/PredictionMode.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ from antlr4.atn.ATNState import RuleStopState as RuleStopState
from antlr4.atn.SemanticContext import SemanticContext as SemanticContext

class PredictionMode(Enum):
SLL: int
LL: int
LL_EXACT_AMBIG_DETECTION: int
SLL = 0
LL = 1
LL_EXACT_AMBIG_DETECTION = 2
@classmethod
def hasSLLConflictTerminatingPrediction(cls, mode: PredictionMode, configs: ATNConfigSet): ...
@classmethod
Expand Down
4 changes: 2 additions & 2 deletions stubs/flake8/flake8/options/manager.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ from _typeshed import Incomplete
from collections.abc import Callable, Sequence
from enum import Enum
from logging import Logger
from typing import Any, Final
from typing import Any

from ..plugins.finder import Plugins

LOG: Logger

class _ARG(Enum):
NO: Final = 1
NO = 1

class Option:
short_option_name: Incomplete
Expand Down
12 changes: 6 additions & 6 deletions stubs/flake8/flake8/style_guide.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,16 @@ from .statistics import Statistics
__all__ = ("StyleGuide",)

class Selected(enum.Enum):
Explicitly: str
Implicitly: str
Explicitly = "explicitly selected"
Implicitly = "implicitly selected"

class Ignored(enum.Enum):
Explicitly: str
Implicitly: str
Explicitly = "explicitly ignored"
Implicitly = "implicitly ignored"

class Decision(enum.Enum):
Ignored: str
Selected: str
Ignored = "ignored error"
Selected = "selected error"

class DecisionEngine:
cache: Incomplete
Expand Down
4 changes: 2 additions & 2 deletions stubs/fpdf2/fpdf/enums.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@ class TableCellFillMode(CoerciveEnum):
def should_fill_cell(self, i: int, j: int) -> bool: ...

class TableSpan(CoerciveEnum):
ROW: Literal["ROW"]
COL: Literal["COL"]
ROW = "ROW"
COL = "COL"

class TableHeadingsDisplay(CoerciveIntEnum):
NONE = 0
Expand Down
70 changes: 35 additions & 35 deletions stubs/regex/regex/_regex_core.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -44,42 +44,42 @@ class RegexFlag(enum.IntFlag):
X = 0x40
VERBOSE = X

A: int
ASCII: int
B: int
BESTMATCH: int
D: int
DEBUG: int
E: int
ENHANCEMATCH: int
F: int
FULLCASE: int
I: int
IGNORECASE: int
L: int
LOCALE: int
M: int
MULTILINE: int
P: int
POSIX: int
R: int
REVERSE: int
T: int
TEMPLATE: int
S: int
DOTALL: int
U: int
UNICODE: int
V0: int
VERSION0: int
V1: int
VERSION1: int
W: int
WORD: int
X: int
VERBOSE: int
A = RegexFlag.A
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should all of the module constants in this file be Final?

Suggested change
A = RegexFlag.A
A: Final = RegexFlag.A

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea, done.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like pytype isn't happy about this change

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah well, thanks for trying! :-)

ASCII = RegexFlag.ASCII
B = RegexFlag.B
BESTMATCH = RegexFlag.BESTMATCH
D = RegexFlag.D
DEBUG = RegexFlag.DEBUG
E = RegexFlag.E
ENHANCEMATCH = RegexFlag.ENHANCEMATCH
F = RegexFlag.F
FULLCASE = RegexFlag.FULLCASE
I = RegexFlag.I
IGNORECASE = RegexFlag.IGNORECASE
L = RegexFlag.L
LOCALE = RegexFlag.LOCALE
M = RegexFlag.M
MULTILINE = RegexFlag.MULTILINE
P = RegexFlag.P
POSIX = RegexFlag.POSIX
R = RegexFlag.R
REVERSE = RegexFlag.REVERSE
T = RegexFlag.T
TEMPLATE = RegexFlag.TEMPLATE
S = RegexFlag.S
DOTALL = RegexFlag.DOTALL
U = RegexFlag.U
UNICODE = RegexFlag.UNICODE
V0 = RegexFlag.V0
VERSION0 = RegexFlag.VERSION0
V1 = RegexFlag.V1
VERSION1 = RegexFlag.VERSION1
W = RegexFlag.W
WORD = RegexFlag.WORD
X = RegexFlag.X
VERBOSE = RegexFlag.VERBOSE

DEFAULT_VERSION: int
DEFAULT_VERSION: RegexFlag

_Lexicon: TypeAlias = list[tuple[AnyStr, Callable[[Scanner[AnyStr], AnyStr], Any]]]

Expand Down