1
0

avoid enforce_typing because it's slow
All checks were successful
Python Ruff Code Quality / ruff (push) Successful in 22s
Run Python tests (through Pytest) / Test (push) Successful in 24s
Verify Python project can be installed, loaded and have version checked / Test (push) Successful in 22s

This commit is contained in:
Jon Michael Aanes 2025-01-03 03:43:03 +01:00
parent ff2f1069ab
commit 20a9ae5ee7
Signed by: Jmaa
SSH Key Fingerprint: SHA256:Ab0GfHGCblESJx7JRE4fj4bFy/KRpeLhi41y4pF3sNA

View File

@ -23,8 +23,6 @@ import re
from collections.abc import Mapping from collections.abc import Mapping
from decimal import Decimal from decimal import Decimal
import enforce_typing
from ._version import __version__ from ._version import __version__
__all__ = [ __all__ = [
@ -67,7 +65,6 @@ RE_TICKER_FORMAT_FLEXIBLE = r'^[^:\s](?:[^:]*[^:\s])?$'
RE_CRYPTO_TICKER_FORMAT = r'^\S+$' RE_CRYPTO_TICKER_FORMAT = r'^\S+$'
@enforce_typing.enforce_types
@dataclasses.dataclass(frozen=True) @dataclasses.dataclass(frozen=True)
class StockExchange: class StockExchange:
"""Unified Stock Exchange identifiers. """Unified Stock Exchange identifiers.
@ -97,7 +94,6 @@ NYSE = StockExchange(
) )
@enforce_typing.enforce_types
@dataclasses.dataclass(frozen=True) @dataclasses.dataclass(frozen=True)
class Asset: class Asset:
"""An identifier representing some abstract financial asset. """An identifier representing some abstract financial asset.
@ -216,7 +212,6 @@ class Asset:
return self.to_string_id() return self.to_string_id()
@enforce_typing.enforce_types
@dataclasses.dataclass(frozen=True) @dataclasses.dataclass(frozen=True)
class UnknownAsset(Asset): class UnknownAsset(Asset):
"""An asset that does not exist.""" """An asset that does not exist."""
@ -226,13 +221,11 @@ class UnknownAsset(Asset):
return '???' return '???'
@enforce_typing.enforce_types
@dataclasses.dataclass(frozen=True) @dataclasses.dataclass(frozen=True)
class Currency(Asset): class Currency(Asset):
"""Either a Fiat or a Crypto Currency.""" """Either a Fiat or a Crypto Currency."""
@enforce_typing.enforce_types
@dataclasses.dataclass(frozen=True, eq=True, order=True) @dataclasses.dataclass(frozen=True, eq=True, order=True)
class FiatCurrency(Currency): class FiatCurrency(Currency):
"""Fiat Currency.""" """Fiat Currency."""
@ -266,7 +259,6 @@ FiatCurrency.GBP = FiatCurrency('GBP')
FiatCurrency.JPY = FiatCurrency('JPY') FiatCurrency.JPY = FiatCurrency('JPY')
@enforce_typing.enforce_types
@dataclasses.dataclass(frozen=True, eq=True) @dataclasses.dataclass(frozen=True, eq=True)
class CryptoCurrency(Currency): class CryptoCurrency(Currency):
"""Crypto Currency.""" """Crypto Currency."""
@ -278,7 +270,6 @@ class CryptoCurrency(Currency):
return self.ccxt_symbol return self.ccxt_symbol
@enforce_typing.enforce_types
@dataclasses.dataclass(frozen=True, eq=True) @dataclasses.dataclass(frozen=True, eq=True)
class Stock(Asset): class Stock(Asset):
ticker: str ticker: str
@ -298,7 +289,6 @@ class Stock(Asset):
return self.ticker return self.ticker
@enforce_typing.enforce_types
@dataclasses.dataclass(frozen=True, eq=True) @dataclasses.dataclass(frozen=True, eq=True)
class Index(Asset): class Index(Asset):
ticker: str ticker: str
@ -312,7 +302,6 @@ class Index(Asset):
return self.ticker return self.ticker
@enforce_typing.enforce_types
@dataclasses.dataclass(frozen=True, eq=True) @dataclasses.dataclass(frozen=True, eq=True)
class Commodity(Asset): class Commodity(Asset):
alpha_vantage_id: str alpha_vantage_id: str
@ -490,7 +479,6 @@ if True:
del add_by_id del add_by_id
@enforce_typing.enforce_types
@dataclasses.dataclass(frozen=True, slots=True) @dataclasses.dataclass(frozen=True, slots=True)
class AssetInformation: class AssetInformation:
"""Extensive information about a given asset.""" """Extensive information about a given asset."""
@ -512,7 +500,6 @@ def assert_same_asset(do: str, a_asset: 'AssetAmount', b_asset: 'AssetAmount'):
raise ValueError(msg) raise ValueError(msg)
@enforce_typing.enforce_types
@dataclasses.dataclass(frozen=True, eq=True, slots=True) @dataclasses.dataclass(frozen=True, eq=True, slots=True)
class AssetAmount: class AssetAmount:
"""Decimal with associated asset unit. """Decimal with associated asset unit.