Skip to content

Commit

Permalink
upgrade code to python 3.10
Browse files Browse the repository at this point in the history
  • Loading branch information
edenhaus committed Apr 8, 2022
1 parent 0738a30 commit 1d0b0e3
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ repos:
rev: v2.31.1
hooks:
- id: pyupgrade
args: [--py39-plus]
args: [--py310-plus]
- repo: https://github.com/psf/black
rev: 22.3.0
hooks:
Expand Down
6 changes: 3 additions & 3 deletions bumper/mqtt/helper_bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,17 @@ class CommandDto:
def __init__(self, payload_type: str) -> None:
self._payload_type = payload_type
self._event = asyncio.Event()
self._response: Union[str, bytes]
self._response: str | bytes

async def wait_for_response(self) -> Union[str, dict[str, Any]]:
async def wait_for_response(self) -> str | dict[str, Any]:
"""Wait for the response to be received."""
await self._event.wait()
if self._payload_type == "j":
return json.loads(self._response) # type:ignore[no-any-return]

return str(self._response)

def add_response(self, response: Union[str, bytes]) -> None:
def add_response(self, response: str | bytes) -> None:
"""Add received response."""
self._response = response
self._event.set()
Expand Down
2 changes: 1 addition & 1 deletion bumper/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def get_logger(name: str, rotate: RotatingFileHandler = None) -> logging.Logger:
return logger


def convert_to_millis(seconds: Union[int, float]) -> int:
def convert_to_millis(seconds: int | float) -> int:
"""Convert seconds to milliseconds."""
return int(round(seconds * 1000))

Expand Down
2 changes: 1 addition & 1 deletion bumper/web/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ class WebServer:

_EXCLUDE_FROM_LOGGING = ["base", "remove-bot", "remove-client", "restart-service"]

def __init__(self, bindings: Union[list[WebserverBinding], WebserverBinding]):
def __init__(self, bindings: list[WebserverBinding] | WebserverBinding):
self._runners: list[web.AppRunner] = []

if isinstance(bindings, WebserverBinding):
Expand Down
2 changes: 1 addition & 1 deletion mypy.ini
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[mypy]
python_version = 3.9
python_version = 3.10
show_error_codes = true
follow_imports = silent
ignore_missing_imports = true
Expand Down

0 comments on commit 1d0b0e3

Please sign in to comment.