mirror of
https://github.com/malmeloo/FindMy.py.git
synced 2026-04-17 21:53:57 +02:00
fix: resolve typing errors
This commit is contained in:
@@ -9,12 +9,13 @@ import logging
|
||||
import plistlib
|
||||
import uuid
|
||||
from abc import ABC, abstractmethod
|
||||
from collections.abc import Callable
|
||||
from datetime import datetime, timedelta, timezone
|
||||
from functools import wraps
|
||||
from typing import (
|
||||
TYPE_CHECKING,
|
||||
Any,
|
||||
Callable,
|
||||
Concatenate,
|
||||
Literal,
|
||||
TypedDict,
|
||||
TypeVar,
|
||||
@@ -24,7 +25,7 @@ from typing import (
|
||||
|
||||
import bs4
|
||||
import srp._pysrp as srp
|
||||
from typing_extensions import Concatenate, ParamSpec, override
|
||||
from typing_extensions import ParamSpec, override
|
||||
|
||||
from findmy import util
|
||||
from findmy.errors import (
|
||||
|
||||
@@ -12,7 +12,7 @@ from abc import ABC, abstractmethod
|
||||
from datetime import datetime, timezone
|
||||
from io import BytesIO
|
||||
from pathlib import Path
|
||||
from typing import BinaryIO, Literal, TypedDict, Union
|
||||
from typing import BinaryIO, Literal, TypedDict
|
||||
|
||||
from anisette import Anisette, AnisetteHeaders
|
||||
from typing_extensions import override
|
||||
@@ -36,7 +36,7 @@ class LocalAnisetteMapping(TypedDict):
|
||||
prov_data: str | None
|
||||
|
||||
|
||||
AnisetteMapping = Union[RemoteAnisetteMapping, LocalAnisetteMapping]
|
||||
AnisetteMapping = RemoteAnisetteMapping | LocalAnisetteMapping
|
||||
|
||||
|
||||
def get_provider_from_mapping(
|
||||
|
||||
@@ -9,7 +9,7 @@ import logging
|
||||
import struct
|
||||
from collections import defaultdict
|
||||
from datetime import datetime, timedelta, timezone
|
||||
from typing import TYPE_CHECKING, Literal, TypedDict, Union, overload
|
||||
from typing import TYPE_CHECKING, Literal, TypedDict, overload
|
||||
|
||||
from cryptography.hazmat.backends import default_backend
|
||||
from cryptography.hazmat.primitives.asymmetric import ec
|
||||
@@ -49,7 +49,7 @@ class LocationReportDecryptedMapping(TypedDict):
|
||||
key: KeyPairMapping
|
||||
|
||||
|
||||
LocationReportMapping = Union[LocationReportEncryptedMapping, LocationReportDecryptedMapping]
|
||||
LocationReportMapping = LocationReportEncryptedMapping | LocationReportDecryptedMapping
|
||||
|
||||
|
||||
class LocationReport(HasHashedPublicKey, util.abc.Serializable[LocationReportMapping]):
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import random
|
||||
from typing import TYPE_CHECKING, Any, Generic, TypeVar, Union
|
||||
from typing import TYPE_CHECKING, Any, Generic, TypeVar
|
||||
|
||||
from typing_extensions import Self
|
||||
|
||||
@@ -14,7 +14,7 @@ if TYPE_CHECKING:
|
||||
from types import TracebackType
|
||||
|
||||
_S = TypeVar("_S", bound=Serializable)
|
||||
_SC = TypeVar("_SC", bound=Union[Serializable, Closable])
|
||||
_SC = TypeVar("_SC", bound=Serializable | Closable)
|
||||
|
||||
|
||||
class _BaseSessionManager(Generic[_SC]):
|
||||
@@ -67,7 +67,7 @@ class _BaseSessionManager(Generic[_SC]):
|
||||
self.save()
|
||||
|
||||
|
||||
class MixedSessionManager(_BaseSessionManager[Union[Serializable, Closable]]):
|
||||
class MixedSessionManager(_BaseSessionManager[Serializable | Closable]):
|
||||
"""Allows any Serializable or Closable object."""
|
||||
|
||||
def new(
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
"""Utility types."""
|
||||
|
||||
from collections.abc import Coroutine
|
||||
from typing import TypeVar, Union
|
||||
from typing import TypeAlias, TypeVar
|
||||
|
||||
_T = TypeVar("_T")
|
||||
|
||||
# Cannot use `|` operator (PEP 604) in python 3.9,
|
||||
# even with __future__ import since it is evaluated directly
|
||||
MaybeCoro = Union[_T, Coroutine[None, None, _T]]
|
||||
MaybeCoro: TypeAlias = _T | Coroutine[None, None, _T]
|
||||
|
||||
Reference in New Issue
Block a user