Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 0189df7

Browse filesBrowse files
tacaswelltimhoffm
authored andcommitted
TYP: semantics of enums in stub files changed
See https://typing.readthedocs.io/en/latest/spec/enums.html#defining-members for details
1 parent a3682f3 commit 0189df7
Copy full SHA for 0189df7

File tree

Expand file treeCollapse file tree

6 files changed

+80
-79
lines changed
Filter options
Expand file treeCollapse file tree

6 files changed

+80
-79
lines changed

‎lib/matplotlib/_enums.pyi

Copy file name to clipboard
+7-6Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,19 @@
1+
from typing import cast
12
from enum import Enum
23

34
class _AutoStringNameEnum(Enum):
45
def __hash__(self) -> int: ...
56

67
class JoinStyle(str, _AutoStringNameEnum):
7-
miter: str
8-
round: str
9-
bevel: str
8+
miter = cast(str, ...)
9+
round = cast(str, ...)
10+
bevel = cast(str, ...)
1011
@staticmethod
1112
def demo() -> None: ...
1213

1314
class CapStyle(str, _AutoStringNameEnum):
14-
butt: str
15-
projecting: str
16-
round: str
15+
butt = cast(str, ...)
16+
projecting = cast(str, ...)
17+
round = cast(str, ...)
1718
@staticmethod
1819
def demo() -> None: ...

‎lib/matplotlib/backend_bases.pyi

Copy file name to clipboardExpand all lines: lib/matplotlib/backend_bases.pyi
+8-8Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -236,11 +236,11 @@ class LocationEvent(Event):
236236
) -> None: ...
237237

238238
class MouseButton(IntEnum):
239-
LEFT: int
240-
MIDDLE: int
241-
RIGHT: int
242-
BACK: int
243-
FORWARD: int
239+
LEFT = 1
240+
MIDDLE = 2
241+
RIGHT = 3
242+
BACK = 8
243+
FORWARD = 9
244244

245245
class MouseEvent(LocationEvent):
246246
button: MouseButton | Literal["up", "down"] | None
@@ -398,9 +398,9 @@ class FigureManagerBase:
398398
cursors = Cursors
399399

400400
class _Mode(str, Enum):
401-
NONE: str
402-
PAN: str
403-
ZOOM: str
401+
NONE = ""
402+
PAN = "pan/zoom"
403+
ZOOM = "zoom rect"
404404

405405
class NavigationToolbar2:
406406
toolitems: tuple[tuple[str, ...] | tuple[None, ...], ...]

‎lib/matplotlib/backend_tools.pyi

Copy file name to clipboardExpand all lines: lib/matplotlib/backend_tools.pyi
+8-8Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,16 @@ from matplotlib.backend_managers import ToolManager, ToolEvent
66
from matplotlib.figure import Figure
77
from matplotlib.scale import ScaleBase
88

9-
from typing import Any
9+
from typing import Any, cast
1010

1111
class Cursors(enum.IntEnum):
12-
POINTER: int
13-
HAND: int
14-
SELECT_REGION: int
15-
MOVE: int
16-
WAIT: int
17-
RESIZE_HORIZONTAL: int
18-
RESIZE_VERTICAL: int
12+
POINTER = cast(int, ...)
13+
HAND = cast(int, ...)
14+
SELECT_REGION = cast(int, ...)
15+
MOVE = cast(int, ...)
16+
WAIT = cast(int, ...)
17+
RESIZE_HORIZONTAL = cast(int, ...)
18+
RESIZE_VERTICAL = cast(int, ...)
1919

2020
cursors = Cursors
2121

‎lib/matplotlib/backends/registry.pyi

Copy file name to clipboardExpand all lines: lib/matplotlib/backends/registry.pyi
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ from types import ModuleType
33

44

55
class BackendFilter(Enum):
6-
INTERACTIVE: int
7-
NON_INTERACTIVE: int
6+
INTERACTIVE = 0
7+
NON_INTERACTIVE = 1
88

99

1010
class BackendRegistry:

‎lib/matplotlib/dviread.pyi

Copy file name to clipboardExpand all lines: lib/matplotlib/dviread.pyi
+5-5Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@ from typing import NamedTuple
88
from typing_extensions import Self # < Py 3.11
99

1010
class _dvistate(Enum):
11-
pre: int
12-
outer: int
13-
inpage: int
14-
post_post: int
15-
finale: int
11+
pre = ...
12+
outer = ...
13+
inpage = ...
14+
post_post = ...
15+
finale = ...
1616

1717
class Page(NamedTuple):
1818
text: list[Text]

‎lib/matplotlib/ft2font.pyi

Copy file name to clipboardExpand all lines: lib/matplotlib/ft2font.pyi
+50-50Lines changed: 50 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from enum import Enum, Flag
22
import sys
3-
from typing import BinaryIO, Literal, TypedDict, final, overload
3+
from typing import BinaryIO, Literal, TypedDict, final, overload, cast
44
from typing_extensions import Buffer # < Py 3.12
55

66
import numpy as np
@@ -10,62 +10,62 @@ __freetype_build_type__: str
1010
__freetype_version__: str
1111

1212
class FaceFlags(Flag):
13-
SCALABLE: int
14-
FIXED_SIZES: int
15-
FIXED_WIDTH: int
16-
SFNT: int
17-
HORIZONTAL: int
18-
VERTICAL: int
19-
KERNING: int
20-
FAST_GLYPHS: int
21-
MULTIPLE_MASTERS: int
22-
GLYPH_NAMES: int
23-
EXTERNAL_STREAM: int
24-
HINTER: int
25-
CID_KEYED: int
26-
TRICKY: int
27-
COLOR: int
28-
# VARIATION: int # FT 2.9
29-
# SVG: int # FT 2.12
30-
# SBIX: int # FT 2.12
31-
# SBIX_OVERLAY: int # FT 2.12
13+
SCALABLE = cast(int, ...)
14+
FIXED_SIZES = cast(int, ...)
15+
FIXED_WIDTH = cast(int, ...)
16+
SFNT = cast(int, ...)
17+
HORIZONTAL = cast(int, ...)
18+
VERTICAL = cast(int, ...)
19+
KERNING = cast(int, ...)
20+
FAST_GLYPHS = cast(int, ...)
21+
MULTIPLE_MASTERS = cast(int, ...)
22+
GLYPH_NAMES = cast(int, ...)
23+
EXTERNAL_STREAM = cast(int, ...)
24+
HINTER = cast(int, ...)
25+
CID_KEYED = cast(int, ...)
26+
TRICKY = cast(int, ...)
27+
COLOR = cast(int, ...)
28+
# VARIATION = cast(int, ...) # FT 2.9
29+
# SVG = cast(int, ...) # FT 2.12
30+
# SBIX = cast(int, ...) # FT 2.12
31+
# SBIX_OVERLAY = cast(int, ...) # FT 2.12
3232

3333
class Kerning(Enum):
34-
DEFAULT: int
35-
UNFITTED: int
36-
UNSCALED: int
34+
DEFAULT = cast(int, ...)
35+
UNFITTED = cast(int, ...)
36+
UNSCALED = cast(int, ...)
3737

3838
class LoadFlags(Flag):
39-
DEFAULT: int
40-
NO_SCALE: int
41-
NO_HINTING: int
42-
RENDER: int
43-
NO_BITMAP: int
44-
VERTICAL_LAYOUT: int
45-
FORCE_AUTOHINT: int
46-
CROP_BITMAP: int
47-
PEDANTIC: int
48-
IGNORE_GLOBAL_ADVANCE_WIDTH: int
49-
NO_RECURSE: int
50-
IGNORE_TRANSFORM: int
51-
MONOCHROME: int
52-
LINEAR_DESIGN: int
53-
NO_AUTOHINT: int
54-
COLOR: int
55-
COMPUTE_METRICS: int # FT 2.6.1
56-
# BITMAP_METRICS_ONLY: int # FT 2.7.1
57-
# NO_SVG: int # FT 2.13.1
39+
DEFAULT = cast(int, ...)
40+
NO_SCALE = cast(int, ...)
41+
NO_HINTING = cast(int, ...)
42+
RENDER = cast(int, ...)
43+
NO_BITMAP = cast(int, ...)
44+
VERTICAL_LAYOUT = cast(int, ...)
45+
FORCE_AUTOHINT = cast(int, ...)
46+
CROP_BITMAP = cast(int, ...)
47+
PEDANTIC = cast(int, ...)
48+
IGNORE_GLOBAL_ADVANCE_WIDTH = cast(int, ...)
49+
NO_RECURSE = cast(int, ...)
50+
IGNORE_TRANSFORM = cast(int, ...)
51+
MONOCHROME = cast(int, ...)
52+
LINEAR_DESIGN = cast(int, ...)
53+
NO_AUTOHINT = cast(int, ...)
54+
COLOR = cast(int, ...)
55+
COMPUTE_METRICS = cast(int, ...) # FT 2.6.1
56+
# BITMAP_METRICS_ONLY = cast(int, ...) # FT 2.7.1
57+
# NO_SVG = cast(int, ...) # FT 2.13.1
5858
# The following should be unique, but the above can be OR'd together.
59-
TARGET_NORMAL: int
60-
TARGET_LIGHT: int
61-
TARGET_MONO: int
62-
TARGET_LCD: int
63-
TARGET_LCD_V: int
59+
TARGET_NORMAL = cast(int, ...)
60+
TARGET_LIGHT = cast(int, ...)
61+
TARGET_MONO = cast(int, ...)
62+
TARGET_LCD = cast(int, ...)
63+
TARGET_LCD_V = cast(int, ...)
6464

6565
class StyleFlags(Flag):
66-
NORMAL: int
67-
ITALIC: int
68-
BOLD: int
66+
NORMAL = cast(int, ...)
67+
ITALIC = cast(int, ...)
68+
BOLD = cast(int, ...)
6969

7070
class _SfntHeadDict(TypedDict):
7171
version: tuple[int, int]

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.