Skip to content

Commit

Permalink
Another try to fix linter issues
Browse files Browse the repository at this point in the history
  • Loading branch information
lpozo committed Jun 24, 2024
1 parent bb1e42a commit 7876c95
Show file tree
Hide file tree
Showing 9 changed files with 18 additions and 35 deletions.
3 changes: 1 addition & 2 deletions python-protocol/adder_v1.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@


class Adder(Protocol):
def add(self, x, y):
...
def add(self, x, y): ...


class IntAdder:
Expand Down
3 changes: 1 addition & 2 deletions python-protocol/adder_v2.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@


class Adder(Protocol):
def add(self, x: float, y: float) -> float:
...
def add(self, x: float, y: float) -> float: ...


class IntAdder:
Expand Down
3 changes: 1 addition & 2 deletions python-protocol/adder_v3.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@


class Adder(Protocol):
def add(self, x: int | float, y: int | float) -> int | float:
...
def add(self, x: int | float, y: int | float) -> int | float: ...


class IntAdder:
Expand Down
5 changes: 2 additions & 3 deletions python-protocol/adder_v4.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@


class Adder(Protocol[T]):
def add(self, x: T, y: T) -> T:
...
def add(self, x: T, y: T) -> T: ...


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

add(IntAdder())
add(FloatAdder())
add(StrAdder())
add(StrAdder())
3 changes: 1 addition & 2 deletions python-protocol/adder_v5.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@


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


class IntAdder:
Expand Down
3 changes: 1 addition & 2 deletions python-protocol/adder_v6.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@


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


class IntAdder:
Expand Down
9 changes: 3 additions & 6 deletions python-protocol/contents.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,19 @@


class ContentCreator(Protocol):
def create_content(self) -> str:
...
def create_content(self) -> str: ...


class Blogger(ContentCreator, Protocol):
posts: List[str]

def add_post(self, title: str, content: str) -> None:
...
def add_post(self, title: str, content: str) -> None: ...


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

def add_video(self, title: str, path: str) -> None:
...
def add_video(self, title: str, path: str) -> None: ...


class Blog:
Expand Down
18 changes: 6 additions & 12 deletions python-protocol/members.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,25 +6,19 @@ class ProtocolMembersDemo(Protocol):
class_attribute: ClassVar[int]
instance_attribute: str

def instance_method(self, arg: int) -> str:
...
def instance_method(self, arg: int) -> str: ...

@classmethod
def class_method(cls) -> str:
...
def class_method(cls) -> str: ...

@staticmethod
def static_method(arg: int) -> str:
...
def static_method(arg: int) -> str: ...

@property
def property_name(self) -> str:
...
def property_name(self) -> str: ...

@property_name.setter
def property_name(self, value: str) -> None:
...
def property_name(self, value: str) -> None: ...

@abstractmethod
def abstract_method(self) -> str:
...
def abstract_method(self) -> str: ...
6 changes: 2 additions & 4 deletions python-protocol/shapes_v2.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,9 @@


class Shape(Protocol):
def get_area(self) -> float:
...
def get_area(self) -> float: ...

def get_perimeter(self) -> float:
...
def get_perimeter(self) -> float: ...


class Circle:
Expand Down

0 comments on commit 7876c95

Please sign in to comment.