Movatterモバイル変換


[0]ホーム

URL:


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

Sign up
Appearance settings

Commit5837e94

Browse files
committed
MNT: remove a private helper class
- The definition of `__hash__` was doing nothing- having a copy of a 1 line function in two sub-classes is simpler than having doing inheritance- fixes an issues with mypy failing on an Enum class with no entries
1 parent18d42a6 commit5837e94

File tree

2 files changed

+12
-13
lines changed

2 files changed

+12
-13
lines changed

‎lib/matplotlib/_enums.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,11 @@
1414
frommatplotlibimport_docstring
1515

1616

17-
class_AutoStringNameEnum(Enum):
17+
class__AutoStringNameEnum(Enum):
1818
"""Automate the ``name = 'name'`` part of making a (str, Enum)."""
1919

20-
def_generate_next_value_(name,start,count,last_values):
21-
returnname
22-
23-
def__hash__(self):
24-
returnstr(self).__hash__()
2520

26-
27-
classJoinStyle(str,_AutoStringNameEnum):
21+
classJoinStyle(str,Enum):
2822
"""
2923
Define how the connection between two line segments is drawn.
3024
@@ -79,6 +73,9 @@ class JoinStyle(str, _AutoStringNameEnum):
7973
8074
"""
8175

76+
def_generate_next_value_(name,start,count,last_values):
77+
returnname
78+
8279
miter=auto()
8380
round=auto()
8481
bevel=auto()
@@ -116,7 +113,7 @@ def plot_angle(ax, x, y, angle, style):
116113
+"}"
117114

118115

119-
classCapStyle(str,_AutoStringNameEnum):
116+
classCapStyle(str,Enum):
120117
r"""
121118
Define how the two endpoints (caps) of an unclosed line are drawn.
122119
@@ -151,6 +148,9 @@ class CapStyle(str, _AutoStringNameEnum):
151148
CapStyle.demo()
152149
153150
"""
151+
def_generate_next_value_(name,start,count,last_values):
152+
returnname
153+
154154
butt=auto()
155155
projecting=auto()
156156
round=auto()

‎lib/matplotlib/_enums.pyi

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,16 @@
11
fromtypingimportcast
22
fromenumimportEnum
33

4-
class_AutoStringNameEnum(Enum):
5-
def__hash__(self)->int: ...
64

7-
classJoinStyle(str,_AutoStringNameEnum):
5+
classJoinStyle(str,Enum):
86
miter=cast(str, ...)
97
round=cast(str, ...)
108
bevel=cast(str, ...)
119
@staticmethod
1210
defdemo()->None: ...
1311

14-
classCapStyle(str,_AutoStringNameEnum):
12+
13+
classCapStyle(str,Enum):
1514
butt=cast(str, ...)
1615
projecting=cast(str, ...)
1716
round=cast(str, ...)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp