8000 Another try to fix linter issues · realpython/materials@7876c95 · GitHub
[go: up one dir, main page]

Skip to content

Commit 7876c95

Browse files
committed
Another try to fix linter issues
1 parent bb1e42a commit 7876c95

File tree

9 files changed

+18
-35
lines changed

9 files changed

+18
-35
lines changed

python-protocol/adder_v1.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@
22

33

44
class Adder(Protocol):
5-
def add(self, x, y):
6-
...
5+
def add(self, x, y): ...
76

87

98
class IntAdder:

python-protocol/adder_v2.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@
22

33

44
class Adder(Protocol):
5-
def add(self, x: float, y: float) -> float:
6-
...
5+
def add(self, x: float, y: float) -> float: ...
76

87

98
class IntAdder:

python-protocol/adder_v3.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@
22

33

44
class Adder(Protocol):
5-
def add(self, x: int | float, y: int | float) -> int | float:
6-
...
5+
def add(self, x: int | float, y: int | float) -> int | float: ...
76

87

98
class IntAdder:

python-protocol/adder_v4.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@
44

55

66
class Adder(Protocol[T]):
7-
def add(self, x: T, y: T) -> T:
8-
...
7+
def add(self, x: T, y: T) -> T: ...
98

109

1110
class IntAdder:
@@ -29,4 +28,4 @@ def add(adder: Adder) -> None:
2928

3029
add(IntAdder())
3130
add(FloatAdder())
32-
add(StrAdder())
31+
add(StrAdder())

python-protocol/adder_v5.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@
22

33

44
class Adder(Protocol):
5-
def add[T: int | float | str](self, x: T, y: T) -> T:
6-
...
5+
def add[T: int | float | str](self, x: T, y: T) -> T: ...
76

87

98
class IntAdder:

python-protocol/adder_v6.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@
22

33

44
class Adder(Protocol):
5-
def add[T: int | float | str](self, x: T, y: T) -> T:
6-
...
5+
def add[T: int | float | str](self, x: T, y: T) -> T: ...
76

87

98
class IntAdder:

python-protocol/contents.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,19 @@
22

33

44
class ContentCreator(Protocol):
5-
def create_content(self) -> str:
6-
...
5+
def create_content(self) -> str: ...
76

87

98
class Blogger(ContentCre 6855 ator, Protocol):
109
posts: List[str]
1110

12-
def add_post(self, title: str, content: str) -> None:
13-
...
11+
def add_post(self, title: str, content: str) -> None: ...
1412

1513

1614
class Vlogger(ContentCreator, Protocol):
1715
videos: List[str]
1816

19-
def add_video(self, title: str, path: str) -> None:
20-
...
17+
def add_video(self, title: str, path: str) -> None: ...
2118

2219

2320
class Blog:

python-protocol/members.py

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,25 +6,19 @@ class ProtocolMembersDemo(Protocol):
66
class_attribute: ClassVar[int]
77
instance_attribute: str
88

9-
def instance_method(self, arg: int) -> str:
10-
...
9+
def instance_method(self, arg: int) -> str: ...
1110

1211
@classmethod
13-
def class_method(cls) -> str:
14-
...
12+
def class_method(cls) -> str: ...
1513

1614
@staticmethod
17-
def static_method(arg: int) -> str:
18-
...
15+
def static_method(arg: int) -> str: ...
1916

2017
@property
21-
def property_name(self) -> str:
22-
...
18+
def property_name(self) -> str: ...
2319

2420
@property_name.setter
25-
def property_name(self, value: str) -> None:
26-
...
21+
def property_name(self, value: str) -> None: ...
2722

2823
@abstractmethod
29-
def abstract_method(self) -> str:
30-
...
24+
def abstract_method(self) -> str: ...

python-protocol/shapes_v2.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,9 @@
33

44

55
class Shape(Protocol):
6-
def get_area(self) -> float:
7-
...
6+
def get_area(self) -> float: ...
87

9-
def get_perimeter(self) -> float:
10-
...
8+
def get_perimeter(self) -> float: ...
119

1210

1311
class Circle:

0 commit comments

Comments
 (0)
0