Skip to content

Commit

Permalink
Fix __str__ methods
Browse files Browse the repository at this point in the history
  • Loading branch information
bdragon300 committed Nov 3, 2024
1 parent 955cae4 commit a6379c6
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
3 changes: 2 additions & 1 deletion pyzkaccess/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@
Tuple,
Type,
TypeVar,
Union, )
Union
)

import fire
import prettytable
Expand Down
2 changes: 1 addition & 1 deletion pyzkaccess/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ def __deepcopy__(self: _DocValueT, memodict: Optional[dict] = None) -> _DocValue
return obj

def __reduce__(self: _DocValueT) -> Tuple[Type[_DocValueT], Tuple[_DocValueValueT, str]]:
return self.__class__, (self._self_value, self._self_doc)
return type(self), (self._self_value, self._self_doc)

def __reduce_ex__(self: _DocValueT, _: Any) -> Tuple[Type[_DocValueT], Tuple[_DocValueValueT, str]]:
return self.__reduce__()
Expand Down
4 changes: 2 additions & 2 deletions pyzkaccess/event.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def __init__(self, s: str):
def description(self) -> str:
msg = (
f'Event[{self.time}]: "{self.event_type.doc}" at door "{self.door}" for card "{self.card}" -- '
f"{self.entry_exit.name.capitalize()}"
f"{self.entry_exit.name.capitalize()}]"
)
return msg

Expand Down Expand Up @@ -70,7 +70,7 @@ def __ne__(self, other: Any) -> bool:
return not self.__eq__(other)

def __str__(self) -> str:
return f"Event({', '.join([f'{k}={getattr(self, k)}' for k in self.__slots__])}"
return f"Event({', '.join([f'{k}={getattr(self, k)}' for k in self.__slots__])})"

def __repr__(self) -> str:
return self.__str__()
Expand Down

0 comments on commit a6379c6

Please sign in to comment.