Skip to content

Commit

Permalink
Remove "deprecated" type aliases
Browse files Browse the repository at this point in the history
  • Loading branch information
kg583 committed May 28, 2024
1 parent 3ed832a commit e33f51b
Show file tree
Hide file tree
Showing 11 changed files with 22 additions and 20 deletions.
3 changes: 2 additions & 1 deletion tivars/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,9 @@
import copy
import inspect

from collections.abc import Callable
from math import ceil
from typing import Callable, TypeVar
from typing import TypeVar
from warnings import warn


Expand Down
6 changes: 3 additions & 3 deletions tivars/flags.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
"""


from collections.abc import Mapping
from functools import total_ordering
from math import ceil
from typing import Mapping
from warnings import warn

from .data import *
Expand Down Expand Up @@ -80,7 +80,7 @@ class Flags(Converter, dict, Mapping[int, int]):

_T = 'Flags'

def __init__(self, bitsets: Mapping[int, int] | 'Flags' = None, *, width: int = 8):
def __init__(self, bitsets: Mapping[int, int] = None, *, width: int = 8):
"""
Creates an empty `Flags` instance with a given initial state and width
Expand All @@ -105,7 +105,7 @@ def __int__(self) -> int:
def __str__(self) -> str:
return ''.join([str(bit) for bit in self.values()][::-1])

def __contains__(self, bitsets: Mapping[int, int] | 'Flags') -> bool:
def __contains__(self, bitsets: Mapping[int, int]) -> bool:
return all(self[bit] == int(bool(bitsets[bit])) for bit in bitsets)

has = __contains__
Expand Down
6 changes: 3 additions & 3 deletions tivars/flash.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

from io import BytesIO
from sys import version_info
from typing import BinaryIO, Type
from typing import BinaryIO
from warnings import warn

from .data import *
Expand Down Expand Up @@ -556,7 +556,7 @@ def checksum(self) -> bytes:
return self.raw.checksum

@classmethod
def get_type(cls, type_id: int) -> Type['TIFlashHeader'] | None:
def get_type(cls, type_id: int) -> type['TIFlashHeader'] | None:
"""
Gets the subclass corresponding to a type ID if one is registered
Expand Down Expand Up @@ -595,7 +595,7 @@ def next_header_length(stream: BinaryIO) -> int:
return entry_length

@classmethod
def register(cls, var_type: Type['TIFlashHeader'], override: int = None):
def register(cls, var_type: type['TIFlashHeader'], override: int = None):
"""
Registers a subtype with this class for coercion
Expand Down
5 changes: 2 additions & 3 deletions tivars/types/complex.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
"""


from typing import Type
from warnings import warn

from tivars.data import *
Expand Down Expand Up @@ -204,15 +203,15 @@ def imag_sign_bit(self) -> int:
"""

@property
def real_type(self) -> Type['RealEntry']:
def real_type(self) -> type['RealEntry']:
"""
:return: The subclass of `RealEntry` corresponding to this entry's `real_subtype_id`.
"""

return self.get_type(self.real_subtype_id).real_analogue

@property
def imag_type(self) -> Type['RealEntry']:
def imag_type(self) -> type['RealEntry']:
"""
:return: The subclass of `RealEntry` corresponding to this entry's `imag_subtype_id`.
"""
Expand Down
2 changes: 1 addition & 1 deletion tivars/types/gdb.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
import json
import os

from collections.abc import Iterator
from io import BytesIO
from typing import Iterator
from warnings import catch_warnings, filterwarnings, warn

from tivars.flags import *
Expand Down
2 changes: 1 addition & 1 deletion tivars/types/group.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
"""


from collections.abc import Sequence
from io import BytesIO
from typing import Sequence
from warnings import warn

from tivars.data import *
Expand Down
2 changes: 1 addition & 1 deletion tivars/types/list.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@

import re

from collections.abc import Iterator, Sequence
from io import BytesIO
from typing import Iterator, Sequence
from warnings import warn

from tivars.data import *
Expand Down
2 changes: 1 addition & 1 deletion tivars/types/matrix.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
"""


from collections.abc import Iterator, Sequence
from io import BytesIO
from typing import Iterator, Sequence
from warnings import warn

from tivars.data import *
Expand Down
4 changes: 3 additions & 1 deletion tivars/types/picture.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@


import re
from typing import Iterator, Sequence


from collections.abc import Iterator, Sequence
from warnings import warn

from tivars.data import *
Expand Down
3 changes: 1 addition & 2 deletions tivars/types/real.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

from decimal import Decimal, localcontext
from fractions import Fraction
from typing import Type
from warnings import warn

from tivars.data import *
Expand Down Expand Up @@ -114,7 +113,7 @@ def sign_bit(self) -> int:
"""

@property
def subtype(self) -> Type['RealEntry']:
def subtype(self) -> type['RealEntry']:
"""
:return: The subtype of this real number
"""
Expand Down
7 changes: 4 additions & 3 deletions tivars/var.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@
"""


from collections.abc import Iterator
from io import BytesIO
from sys import version_info
from typing import BinaryIO, Iterator, Type
from typing import BinaryIO
from warnings import warn

from .data import *
Expand Down Expand Up @@ -566,7 +567,7 @@ def meta(self) -> bytes:
return self.raw.calc_data_length + self.raw.type_id + self.raw.name + self.raw.version + self.raw.archived

@classmethod
def get_type(cls, type_id: int) -> Type['TIEntry'] | None:
def get_type(cls, type_id: int) -> type['TIEntry'] | None:
"""
Gets the subclass corresponding to a type ID if one is registered
Expand All @@ -592,7 +593,7 @@ def next_entry_length(stream: BinaryIO) -> int:
return 2 + meta_length + 2 + data_length

@classmethod
def register(cls, var_type: Type['TIEntry'], override: int = None):
def register(cls, var_type: type['TIEntry'], override: int = None):
"""
Registers a subtype with this class for coercion
Expand Down

0 comments on commit e33f51b

Please sign in to comment.