Skip to content

Commit

Permalink
🚨 fix-lint: ruff
Browse files Browse the repository at this point in the history
  • Loading branch information
ljnsn committed Oct 12, 2024
1 parent b7c3a34 commit 62dda83
Show file tree
Hide file tree
Showing 16 changed files with 52 additions and 52 deletions.
2 changes: 1 addition & 1 deletion src/coinapi/exchange_rates.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions src/coinapi/indexes.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion src/coinapi/metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions src/coinapi/ohlcv.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion src/coinapi/quotes.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion src/coinapi/rest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
6 changes: 3 additions & 3 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
8 changes: 4 additions & 4 deletions tests/test_exchange_rates.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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,
Expand All @@ -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,
Expand All @@ -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,
Expand Down
8 changes: 4 additions & 4 deletions tests/test_indexes.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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")
Expand Down Expand Up @@ -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")
Expand All @@ -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,
Expand Down
18 changes: 9 additions & 9 deletions tests/test_metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand All @@ -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")
Expand All @@ -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
Expand All @@ -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")
Expand All @@ -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")
Expand All @@ -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
Expand All @@ -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")
Expand All @@ -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")
Expand All @@ -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,
Expand Down
12 changes: 6 additions & 6 deletions tests/test_metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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")
Expand All @@ -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,
Expand All @@ -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,
Expand All @@ -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,
Expand All @@ -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,
Expand Down
8 changes: 4 additions & 4 deletions tests/test_ohlcv.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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,
Expand All @@ -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,
Expand All @@ -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,
Expand Down
8 changes: 4 additions & 4 deletions tests/test_order_book.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
Expand All @@ -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,
Expand All @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions tests/test_order_booky_l3.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from coinapi import CoinAPI


@pytest.mark.vcr()
@pytest.mark.vcr
def test_get_v1_orderbooks3_current(
coinapi: CoinAPI,
snapshot: SnapshotAssertion,
Expand All @@ -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,
Expand Down
Loading

0 comments on commit 62dda83

Please sign in to comment.