Skip to content

Commit

Permalink
chore: Remove from __future__ import annotations
Browse files Browse the repository at this point in the history
  • Loading branch information
rumpelsepp committed Dec 18, 2024
1 parent 5d1d222 commit 83ac315
Show file tree
Hide file tree
Showing 10 changed files with 132 additions and 164 deletions.
2 changes: 0 additions & 2 deletions src/gallia/cli/cursed_hr.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
#
# SPDX-License-Identifier: Apache-2.0

from __future__ import annotations

import curses
import curses.ascii
import gzip
Expand Down
18 changes: 6 additions & 12 deletions src/gallia/log.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
#
# SPDX-License-Identifier: Apache-2.0

from __future__ import annotations

import atexit
import dataclasses
import datetime
Expand All @@ -25,14 +23,10 @@
from pathlib import Path
from queue import Queue
from types import TracebackType
from typing import TYPE_CHECKING, Any, BinaryIO, Self, TextIO, TypeAlias, cast
from typing import Any, BinaryIO, Self, TextIO, TypeAlias, cast

import zstandard

if TYPE_CHECKING:
from logging import _ExcInfoType


gmt_offset = time.localtime().tm_gmtoff
tz = datetime.timezone(datetime.timedelta(seconds=gmt_offset))

Expand Down Expand Up @@ -153,7 +147,7 @@ class PenlogPriority(IntEnum):
TRACE = 8

@classmethod
def from_str(cls, string: str) -> PenlogPriority:
def from_str(cls, string: str) -> "PenlogPriority":
"""Converts a string to an instance of PenlogPriority.
``string`` can be a numeric value (0 to 8 inclusive)
or a string with a case insensitive name of the level
Expand Down Expand Up @@ -185,7 +179,7 @@ def from_str(cls, string: str) -> PenlogPriority:
raise ValueError(f"{string} not a valid priority")

@classmethod
def from_level(cls, value: int) -> PenlogPriority:
def from_level(cls, value: int) -> "PenlogPriority":
"""Converts an int value (e.g. from python's logging module)
to an instance of this class.
"""
Expand Down Expand Up @@ -766,7 +760,7 @@ def trace(
self,
msg: Any,
*args: Any,
exc_info: _ExcInfoType = None,
exc_info: Any = None,
stack_info: bool = False,
extra: dict[str, Any] | None = None,
**kwargs: Any,
Expand All @@ -786,7 +780,7 @@ def notice(
self,
msg: Any,
*args: Any,
exc_info: _ExcInfoType = None,
exc_info: Any = None,
stack_info: bool = False,
extra: dict[str, Any] | None = None,
**kwargs: Any,
Expand All @@ -806,7 +800,7 @@ def result(
self,
msg: Any,
*args: Any,
exc_info: _ExcInfoType = None,
exc_info: Any = None,
stack_info: bool = False,
extra: dict[str, Any] | None = None,
**kwargs: Any,
Expand Down
2 changes: 0 additions & 2 deletions src/gallia/services/uds/core/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
#
# SPDX-License-Identifier: Apache-2.0

from __future__ import annotations

import asyncio
import struct
from collections.abc import Sequence
Expand Down
6 changes: 2 additions & 4 deletions src/gallia/services/uds/core/exception.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
#
# SPDX-License-Identifier: Apache-2.0

from __future__ import annotations

import asyncio
from abc import ABC
from typing import Any
Expand Down Expand Up @@ -72,7 +70,7 @@ class UnexpectedResponse(ResponseException):

class UnexpectedNegativeResponse(UnexpectedResponse, ABC):
RESPONSE_CODE: UDSErrorCodes
_CONCRETE_EXCEPTIONS: dict[UDSErrorCodes | None, type[UnexpectedNegativeResponse]] = {}
_CONCRETE_EXCEPTIONS: dict[UDSErrorCodes | None, type["UnexpectedNegativeResponse"]] = {}

def __init_subclass__(cls, /, response_code: UDSErrorCodes, **kwargs: Any) -> None:
super().__init_subclass__(**kwargs)
Expand All @@ -93,7 +91,7 @@ def __init__(
@staticmethod
def parse_dynamic(
request: UDSRequest, response: NegativeResponse, message: str | None = None
) -> UnexpectedNegativeResponse:
) -> "UnexpectedNegativeResponse":
return UnexpectedNegativeResponse._CONCRETE_EXCEPTIONS[response.response_code](
request, response, message
)
Expand Down
Loading

0 comments on commit 83ac315

Please sign in to comment.