From 62dda83bed73c9973a464da48b58d94fe2a848f7 Mon Sep 17 00:00:00 2001 From: ljnsn Date: Sat, 12 Oct 2024 02:45:45 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=9A=A8=20fix-lint:=20ruff?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/coinapi/exchange_rates.py | 2 +- src/coinapi/indexes.py | 4 ++-- src/coinapi/metrics.py | 2 +- src/coinapi/ohlcv.py | 4 ++-- src/coinapi/quotes.py | 2 +- src/coinapi/rest.py | 2 +- tests/conftest.py | 6 +++--- tests/test_exchange_rates.py | 8 ++++---- tests/test_indexes.py | 8 ++++---- tests/test_metadata.py | 18 +++++++++--------- tests/test_metrics.py | 12 ++++++------ tests/test_ohlcv.py | 8 ++++---- tests/test_order_book.py | 8 ++++---- tests/test_order_booky_l3.py | 4 ++-- tests/test_quotes.py | 10 +++++----- tests/test_trades.py | 6 +++--- 16 files changed, 52 insertions(+), 52 deletions(-) diff --git a/src/coinapi/exchange_rates.py b/src/coinapi/exchange_rates.py index 23637f2..d5aa393 100644 --- a/src/coinapi/exchange_rates.py +++ b/src/coinapi/exchange_rates.py @@ -50,7 +50,7 @@ def get_v1_specific_rate( accept_header_override=accept_header_override, ) - def get_v1_base_rates( # noqa: PLR0913 + def get_v1_base_rates( self, asset_id_base: str, filter_asset_id: str | None = None, diff --git a/src/coinapi/indexes.py b/src/coinapi/indexes.py index 976e903..085e1d9 100644 --- a/src/coinapi/indexes.py +++ b/src/coinapi/indexes.py @@ -64,7 +64,7 @@ def put_v1_indexes_index_id_json( accept_header_override, ) - def get_v1_indexes_index_id_history( # noqa: PLR0913 + def get_v1_indexes_index_id_history( self, index_id: str, time_start: datetime | None = None, @@ -85,7 +85,7 @@ def get_v1_indexes_index_id_history( # noqa: PLR0913 accept_header_override, ) - def get_v1_indexes_index_id_timeseries( # noqa: PLR0913 + def get_v1_indexes_index_id_timeseries( self, index_id: str, time_start: datetime | None = None, diff --git a/src/coinapi/metrics.py b/src/coinapi/metrics.py index 5bbde79..135794c 100644 --- a/src/coinapi/metrics.py +++ b/src/coinapi/metrics.py @@ -170,7 +170,7 @@ def get_v1_metrics_asset_listing( accept_header_override=accept_header_override, ) - def get_v1_metrics_asset_current( # noqa: PLR0913 + def get_v1_metrics_asset_current( self, metric_id: str | None = None, asset_id: str | None = None, diff --git a/src/coinapi/ohlcv.py b/src/coinapi/ohlcv.py index f05177b..eafa55b 100644 --- a/src/coinapi/ohlcv.py +++ b/src/coinapi/ohlcv.py @@ -74,7 +74,7 @@ def get_v1_ohlcv_symbol_id_history( accept_header_override=accept_header_override, ) - def get_v1_ohlcv_exchanges_exchange_id_history( # noqa: PLR0913 + def get_v1_ohlcv_exchanges_exchange_id_history( self, exchange_id: str, period_id: str, @@ -104,7 +104,7 @@ def get_v1_ohlcv_exchanges_exchange_id_history( # noqa: PLR0913 accept_header_override=accept_header_override, ) - def get_v1_ohlcv_symbol_id_latest( # noqa: PLR0913 + def get_v1_ohlcv_symbol_id_latest( self, symbol_id: str, period_id: str | None = None, diff --git a/src/coinapi/quotes.py b/src/coinapi/quotes.py index b188ac5..e86a77c 100644 --- a/src/coinapi/quotes.py +++ b/src/coinapi/quotes.py @@ -7,7 +7,7 @@ class Quotes(Base): r"""Controller for retrieving quotes data, also known as quotes or passive level 1 data.""" - def get_v1_quotes_symbol_id_history( # noqa: PLR0913 + def get_v1_quotes_symbol_id_history( self, symbol_id: str, time_start: str | None = None, diff --git a/src/coinapi/rest.py b/src/coinapi/rest.py index 1bed518..d7f8e87 100644 --- a/src/coinapi/rest.py +++ b/src/coinapi/rest.py @@ -307,7 +307,7 @@ class CoinAPI: sdk_configuration: CoinAPIConfig - def __init__( # noqa: PLR0913 + def __init__( self, api_key: str | Callable[[], str], server_idx: int | None = None, diff --git a/tests/conftest.py b/tests/conftest.py index 05ea822..4e221d2 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -33,14 +33,14 @@ def _session_start() -> None: vcr_log.setLevel(logging.WARNING) -@pytest.fixture() +@pytest.fixture def api_key() -> str: """Load the API key from the environment.""" load_dotenv() return os.environ.get("COINAPI_KEY", "testing") -@pytest.fixture() +@pytest.fixture def coinapi(api_key: str) -> CoinAPI: """Return a CoinAPI instance.""" return CoinAPI(api_key) @@ -75,7 +75,7 @@ def vcr_config(record_mode: str) -> dict[str, Any]: } -@pytest.fixture() +@pytest.fixture def snapshot_json(snapshot: SnapshotAssertion) -> SnapshotAssertion: """Return a snapshot instance for JSON.""" return snapshot.with_defaults(extension_class=JSONSnapshotExtension) diff --git a/tests/test_exchange_rates.py b/tests/test_exchange_rates.py index 173671c..d1cf007 100644 --- a/tests/test_exchange_rates.py +++ b/tests/test_exchange_rates.py @@ -7,7 +7,7 @@ from coinapi.models import operations -@pytest.mark.vcr() +@pytest.mark.vcr def test_get_v1_specific_rate(coinapi: CoinAPI, snapshot: SnapshotAssertion) -> None: """Test get_v1_specific_rate.""" response = coinapi.exchange_rates.get_v1_specific_rate( @@ -21,7 +21,7 @@ def test_get_v1_specific_rate(coinapi: CoinAPI, snapshot: SnapshotAssertion) -> assert response.content == snapshot -@pytest.mark.vcr() +@pytest.mark.vcr def test_get_v1_base_rates( coinapi: CoinAPI, snapshot: SnapshotAssertion, @@ -36,7 +36,7 @@ def test_get_v1_base_rates( assert response.content == snapshot -@pytest.mark.vcr() +@pytest.mark.vcr def test_get_v1_history_periods( coinapi: CoinAPI, snapshot: SnapshotAssertion, @@ -49,7 +49,7 @@ def test_get_v1_history_periods( assert response.content == snapshot -@pytest.mark.vcr() +@pytest.mark.vcr def test_get_v1_pair_history( coinapi: CoinAPI, snapshot: SnapshotAssertion, diff --git a/tests/test_indexes.py b/tests/test_indexes.py index 1fbf604..03099fa 100644 --- a/tests/test_indexes.py +++ b/tests/test_indexes.py @@ -7,7 +7,7 @@ from coinapi.models import components, operations -@pytest.mark.vcr() +@pytest.mark.vcr def test_get_v1_indexes(coinapi: CoinAPI, snapshot: SnapshotAssertion) -> None: """Test get_v1_indexes_listing.""" response = coinapi.indexes.get_v1_indexes() @@ -29,7 +29,7 @@ def test_post_v1_indexes(coinapi: CoinAPI) -> None: assert response.status_code == 201 -@pytest.mark.vcr() +@pytest.mark.vcr def test_get_v1_indexes_index_id(coinapi: CoinAPI, snapshot: SnapshotAssertion) -> None: """Test get_v1_indexes_index_id.""" response = coinapi.indexes.get_v1_indexes_index_id("TEST_IDX14_VWAP") @@ -64,7 +64,7 @@ def test_put_v1_indexes(coinapi: CoinAPI, snapshot: SnapshotAssertion) -> None: assert response.content == snapshot -@pytest.mark.vcr() +@pytest.mark.vcr def test_get_v1_indexes_history(coinapi: CoinAPI, snapshot: SnapshotAssertion) -> None: """Test retrieving historical index value and composition.""" response = coinapi.indexes.get_v1_indexes_index_id_history("TEST_IDX14_VWAP") @@ -75,7 +75,7 @@ def test_get_v1_indexes_history(coinapi: CoinAPI, snapshot: SnapshotAssertion) - @pytest.mark.skip(reason="Alpha release..") -@pytest.mark.vcr() +@pytest.mark.vcr def test_get_v1_indexes_index_id_timeseries( coinapi: CoinAPI, snapshot: SnapshotAssertion, diff --git a/tests/test_metadata.py b/tests/test_metadata.py index 259e772..9f6d805 100644 --- a/tests/test_metadata.py +++ b/tests/test_metadata.py @@ -6,7 +6,7 @@ from coinapi import CoinAPI -@pytest.mark.vcr() +@pytest.mark.vcr def test_get_v1_assets(coinapi: CoinAPI, snapshot: SnapshotAssertion) -> None: """Test get_v1_assets.""" res = coinapi.metadata.get_v1_assets(filter_asset_id="BTC,XMR") @@ -15,7 +15,7 @@ def test_get_v1_assets(coinapi: CoinAPI, snapshot: SnapshotAssertion) -> None: assert res.content == snapshot -@pytest.mark.vcr() +@pytest.mark.vcr def test_get_v1_asset_id(coinapi: CoinAPI, snapshot: SnapshotAssertion) -> None: """Test get_v1_exchanges.""" res = coinapi.metadata.get_v1_assets_asset_id("BTC") @@ -24,7 +24,7 @@ def test_get_v1_asset_id(coinapi: CoinAPI, snapshot: SnapshotAssertion) -> None: assert res.content == snapshot -@pytest.mark.network() +@pytest.mark.network def test_get_v1_assets_icons(coinapi: CoinAPI) -> None: """Test get_v1_asset_icons.""" # we don't want to store the whole response in the repo, so we don't use vcr here @@ -33,7 +33,7 @@ def test_get_v1_assets_icons(coinapi: CoinAPI) -> None: assert res.content is not None -@pytest.mark.vcr() +@pytest.mark.vcr def test_get_v1_exchanges(coinapi: CoinAPI, snapshot: SnapshotAssertion) -> None: """Test get_v1_exchanges.""" res = coinapi.metadata.get_v1_exchanges("KRAKEN,BINANCE") @@ -42,7 +42,7 @@ def test_get_v1_exchanges(coinapi: CoinAPI, snapshot: SnapshotAssertion) -> None assert res.content == snapshot -@pytest.mark.vcr() +@pytest.mark.vcr def test_get_v1_exchange_id(coinapi: CoinAPI, snapshot: SnapshotAssertion) -> None: """Test get_v1_exchange_id.""" res = coinapi.metadata.get_v1_exchanges_exchange_id("KRAKEN") @@ -51,7 +51,7 @@ def test_get_v1_exchange_id(coinapi: CoinAPI, snapshot: SnapshotAssertion) -> No assert res.content == snapshot -@pytest.mark.network() +@pytest.mark.network def test_get_v1_exchange_icons(coinapi: CoinAPI) -> None: """Test get_v1_exchange_icons.""" # we don't want to store the whole response in the repo, so we don't use vcr here @@ -68,7 +68,7 @@ def test_get_v1_metadata(coinapi: CoinAPI) -> None: assert res.content is not None -@pytest.mark.vcr() +@pytest.mark.vcr def test_get_v1_symbols(coinapi: CoinAPI, snapshot: SnapshotAssertion) -> None: """Test get_v1_symbols.""" res = coinapi.metadata.get_v1_symbols(filter_asset_id="XMR") @@ -77,7 +77,7 @@ def test_get_v1_symbols(coinapi: CoinAPI, snapshot: SnapshotAssertion) -> None: assert res.content == snapshot -@pytest.mark.vcr() +@pytest.mark.vcr def test_get_v1_symbols_map(coinapi: CoinAPI, snapshot: SnapshotAssertion) -> None: """Test get_v1_symbols_map.""" res = coinapi.metadata.get_v1_symbols_map_exchange_id("KRAKEN") @@ -86,7 +86,7 @@ def test_get_v1_symbols_map(coinapi: CoinAPI, snapshot: SnapshotAssertion) -> No assert res.content == snapshot -@pytest.mark.vcr() +@pytest.mark.vcr def test_get_v1_symbols_exchange_id( coinapi: CoinAPI, snapshot: SnapshotAssertion, diff --git a/tests/test_metrics.py b/tests/test_metrics.py index 17f3329..f102fbf 100644 --- a/tests/test_metrics.py +++ b/tests/test_metrics.py @@ -7,7 +7,7 @@ from coinapi.models import operations -@pytest.mark.vcr() +@pytest.mark.vcr def test_get_v1_metrics(coinapi: CoinAPI, snapshot: SnapshotAssertion) -> None: """Test get_v1_metrics.""" response = coinapi.metrics.get_v1_metrics_listing() @@ -17,7 +17,7 @@ def test_get_v1_metrics(coinapi: CoinAPI, snapshot: SnapshotAssertion) -> None: assert response.content == snapshot -@pytest.mark.vcr() +@pytest.mark.vcr def test_get_v1_metrics_exchange(coinapi: CoinAPI, snapshot: SnapshotAssertion) -> None: """Test get_v1_metrics_exchange_listing.""" response = coinapi.metrics.get_v1_metrics_exchange_listing(exchange_id="KRAKEN") @@ -28,7 +28,7 @@ def test_get_v1_metrics_exchange(coinapi: CoinAPI, snapshot: SnapshotAssertion) @pytest.mark.skip(reason="Returns 500") -@pytest.mark.vcr() +@pytest.mark.vcr def test_get_v1_metrics_exchange_current( coinapi: CoinAPI, snapshot: SnapshotAssertion, @@ -45,7 +45,7 @@ def test_get_v1_metrics_exchange_current( @pytest.mark.skip(reason="What's a valid metric for an exchange?") -@pytest.mark.vcr() +@pytest.mark.vcr def test_get_v1_metrics_exchange_history( coinapi: CoinAPI, snapshot: SnapshotAssertion, @@ -62,7 +62,7 @@ def test_get_v1_metrics_exchange_history( assert response.content == snapshot -@pytest.mark.vcr() +@pytest.mark.vcr def test_get_v1_metrics_symbol_listing( coinapi: CoinAPI, snapshot: SnapshotAssertion, @@ -75,7 +75,7 @@ def test_get_v1_metrics_symbol_listing( assert response.content == snapshot -@pytest.mark.vcr() +@pytest.mark.vcr def test_get_v1_metrics_asset_listing( coinapi: CoinAPI, snapshot: SnapshotAssertion, diff --git a/tests/test_ohlcv.py b/tests/test_ohlcv.py index 08b0361..a0a932e 100644 --- a/tests/test_ohlcv.py +++ b/tests/test_ohlcv.py @@ -7,7 +7,7 @@ from coinapi.models import operations -@pytest.mark.vcr() +@pytest.mark.vcr def test_get_v1_ohlcv_periods(coinapi: CoinAPI, snapshot: SnapshotAssertion) -> None: """Test for get_v1_ohlcv_periods.""" response = coinapi.ohlcv.get_v1_ohlcv_periods() @@ -17,7 +17,7 @@ def test_get_v1_ohlcv_periods(coinapi: CoinAPI, snapshot: SnapshotAssertion) -> assert response.content == snapshot -@pytest.mark.vcr() +@pytest.mark.vcr def test_get_v1_ohlcv_symbol_id_history( coinapi: CoinAPI, snapshot: SnapshotAssertion, @@ -36,7 +36,7 @@ def test_get_v1_ohlcv_symbol_id_history( assert response.content == snapshot -@pytest.mark.vcr() +@pytest.mark.vcr def test_get_v1_ohlcv_exchanges_exchange_id_history( coinapi: CoinAPI, snapshot: SnapshotAssertion, @@ -54,7 +54,7 @@ def test_get_v1_ohlcv_exchanges_exchange_id_history( assert response.content == snapshot -@pytest.mark.vcr() +@pytest.mark.vcr def test_get_v1_ohlcv_symbol_id_latest( coinapi: CoinAPI, snapshot: SnapshotAssertion, diff --git a/tests/test_order_book.py b/tests/test_order_book.py index 6eda15d..6d38bbe 100644 --- a/tests/test_order_book.py +++ b/tests/test_order_book.py @@ -8,7 +8,7 @@ @pytest.mark.skip(reason="Can't find a symbol that has order book data..") -@pytest.mark.vcr() +@pytest.mark.vcr def test_get_v1_orderbooks_symbol_id_depth_current( coinapi: CoinAPI, snapshot: SnapshotAssertion, @@ -24,7 +24,7 @@ def test_get_v1_orderbooks_symbol_id_depth_current( assert response.content == snapshot -@pytest.mark.vcr() +@pytest.mark.vcr def test_get_v1_orderbooks_symbol_id_history( coinapi: CoinAPI, snapshot: SnapshotAssertion, @@ -45,7 +45,7 @@ def test_get_v1_orderbooks_symbol_id_history( assert response.content == snapshot -@pytest.mark.vcr() +@pytest.mark.vcr def test_get_v1_orderbooks_symbol_id_current( coinapi: CoinAPI, snapshot: SnapshotAssertion, @@ -61,7 +61,7 @@ def test_get_v1_orderbooks_symbol_id_current( assert response.content == snapshot -@pytest.mark.vcr() +@pytest.mark.vcr def test_get_v1_orderbooks_symbol_id_latest( coinapi: CoinAPI, snapshot: SnapshotAssertion, diff --git a/tests/test_order_booky_l3.py b/tests/test_order_booky_l3.py index daf538d..4817342 100644 --- a/tests/test_order_booky_l3.py +++ b/tests/test_order_booky_l3.py @@ -6,7 +6,7 @@ from coinapi import CoinAPI -@pytest.mark.vcr() +@pytest.mark.vcr def test_get_v1_orderbooks3_current( coinapi: CoinAPI, snapshot: SnapshotAssertion, @@ -22,7 +22,7 @@ def test_get_v1_orderbooks3_current( assert response.content == snapshot -@pytest.mark.vcr() +@pytest.mark.vcr def test_get_v1_orderbooks3_symbol_id_current( coinapi: CoinAPI, snapshot: SnapshotAssertion, diff --git a/tests/test_quotes.py b/tests/test_quotes.py index 0fd5d48..5191bfd 100644 --- a/tests/test_quotes.py +++ b/tests/test_quotes.py @@ -6,7 +6,7 @@ from coinapi import CoinAPI -@pytest.mark.vcr() +@pytest.mark.vcr def test_get_v1_quotes_symbol_id_history( coinapi: CoinAPI, snapshot: SnapshotAssertion, @@ -24,7 +24,7 @@ def test_get_v1_quotes_symbol_id_history( assert response.content == snapshot -@pytest.mark.vcr() +@pytest.mark.vcr def test_get_v1_quotes_current( coinapi: CoinAPI, snapshot: SnapshotAssertion, @@ -39,7 +39,7 @@ def test_get_v1_quotes_current( assert response.content == snapshot -@pytest.mark.vcr() +@pytest.mark.vcr def test_get_v1_quotes_symbol_id_current( coinapi: CoinAPI, snapshot: SnapshotAssertion, @@ -54,7 +54,7 @@ def test_get_v1_quotes_symbol_id_current( assert response.content == snapshot -@pytest.mark.vcr() +@pytest.mark.vcr def test_get_v1_quotes_latest( coinapi: CoinAPI, snapshot: SnapshotAssertion, @@ -70,7 +70,7 @@ def test_get_v1_quotes_latest( assert response.content == snapshot -@pytest.mark.vcr() +@pytest.mark.vcr def test_get_v1_quotes_symbol_id_latest( coinapi: CoinAPI, snapshot: SnapshotAssertion, diff --git a/tests/test_trades.py b/tests/test_trades.py index 5975a23..1695fbb 100644 --- a/tests/test_trades.py +++ b/tests/test_trades.py @@ -7,7 +7,7 @@ from coinapi.models import operations -@pytest.mark.vcr() +@pytest.mark.vcr def test_get_v1_trades_symbol_id_history( coinapi: CoinAPI, snapshot: SnapshotAssertion, @@ -28,7 +28,7 @@ def test_get_v1_trades_symbol_id_history( assert response.content == snapshot -@pytest.mark.vcr() +@pytest.mark.vcr def test_get_v1_trades_symbol_id_latest( coinapi: CoinAPI, snapshot: SnapshotAssertion, @@ -44,7 +44,7 @@ def test_get_v1_trades_symbol_id_latest( assert response.content == snapshot -@pytest.mark.vcr() +@pytest.mark.vcr def test_get_v1_trades_latest( coinapi: CoinAPI, snapshot: SnapshotAssertion,