Skip to content

Commit 1dfc9d1

Browse files
committed
FIX: Fix more ruff errors
1 parent 05f5ebf commit 1dfc9d1

File tree

5 files changed

+15
-11
lines changed

5 files changed

+15
-11
lines changed

databento/common/data.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,8 @@ def get_deriv_ba_types(level: int) -> list[tuple[str, type | str]]:
8686
]
8787

8888

89-
OHLCV_MSG: list[tuple[str, type | str]] = RECORD_HEADER + [
89+
OHLCV_MSG: list[tuple[str, type | str]] = [
90+
*RECORD_HEADER,
9091
("open", np.int64),
9192
("high", np.int64),
9293
("low", np.int64),
@@ -162,7 +163,8 @@ def get_deriv_ba_types(level: int) -> list[tuple[str, type | str]]:
162163
("dummy", "S3"), # 3 byte chararray (Adjustment filler for 8-bytes alignment)
163164
]
164165

165-
IMBALANCE_MSG: list[tuple[str, type | str]] = RECORD_HEADER + [
166+
IMBALANCE_MSG: list[tuple[str, type | str]] = [
167+
*RECORD_HEADER,
166168
("ts_recv", np.uint64),
167169
("ref_price", np.int64),
168170
("auction_time", np.uint64),
@@ -186,7 +188,8 @@ def get_deriv_ba_types(level: int) -> list[tuple[str, type | str]]:
186188
("dummy", "S1"),
187189
]
188190

189-
STATISTICS_MSG: list[tuple[str, type | str]] = RECORD_HEADER + [
191+
STATISTICS_MSG: list[tuple[str, type | str]] = [
192+
*RECORD_HEADER,
190193
("ts_recv", np.uint64),
191194
("ts_ref", np.uint64),
192195
("price", np.int64),
@@ -404,7 +407,8 @@ def get_deriv_ba_fields(level: int) -> list[str]:
404407
"ind_match_price",
405408
"upper_collar",
406409
"lower_collar",
407-
"paired_qty","total_imbalance_qty",
410+
"paired_qty",
411+
"total_imbalance_qty",
408412
"market_imbalance_qty",
409413
"unpaired_qty",
410414
"auction_type",

databento/live/session.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -527,7 +527,7 @@ async def _connect_task(
527527
f"{AUTH_TIMEOUT_SECONDS} second(s).",
528528
) from None
529529
except ValueError as exc:
530-
raise BentoError(f"User authentication failed: {str(exc)}") from None
530+
raise BentoError(f"User authentication failed: {exc!s}") from None
531531

532532
logger.info(
533533
"authentication with remote gateway completed",

tests/test_historical_bento.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ def test_to_ndarray_with_stub_data_returns_expected_array(
215215
assert isinstance(array, np.ndarray)
216216
assert (
217217
str(array)
218-
== "[(14, 160, 1, 5482, 1609160400000429831, 647784973705, 3722750000000, 1, 128, 0, b'C', b'A', 1609160400000704060, 22993, 1170352)\n (14, 160, 1, 5482, 1609160400000431665, 647784973631, 3723000000000, 1, 128, 0, b'C', b'A', 1609160400000711344, 19621, 1170353)\n (14, 160, 1, 5482, 1609160400000433051, 647784973427, 3723250000000, 1, 128, 0, b'C', b'A', 1609160400000728600, 16979, 1170354)\n (14, 160, 1, 5482, 1609160400000434353, 647784973094, 3723500000000, 1, 128, 0, b'C', b'A', 1609160400000740248, 17883, 1170355)]" # noqa
218+
== "[(14, 160, 1, 5482, 1609160400000429831, 647784973705, 3722750000000, 1, 128, 0, b'C', b'A', 1609160400000704060, 22993, 1170352)\n (14, 160, 1, 5482, 1609160400000431665, 647784973631, 3723000000000, 1, 128, 0, b'C', b'A', 1609160400000711344, 19621, 1170353)\n (14, 160, 1, 5482, 1609160400000433051, 647784973427, 3723250000000, 1, 128, 0, b'C', b'A', 1609160400000728600, 16979, 1170354)\n (14, 160, 1, 5482, 1609160400000434353, 647784973094, 3723500000000, 1, 128, 0, b'C', b'A', 1609160400000740248, 17883, 1170355)]"
219219
)
220220

221221

tests/test_historical_error.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ def test_client_error_str_and_repr() -> None:
8080
assert str(error) == "400 Bad Request"
8181
assert (
8282
repr(error)
83-
== "BentoClientError(request_id=None, http_status=400, message=Bad Request)" # noqa
83+
== "BentoClientError(request_id=None, http_status=400, message=Bad Request)"
8484
)
8585

8686

@@ -96,5 +96,5 @@ def test_server_error_str_and_repr() -> None:
9696
assert str(error) == "500 Internal Server Error"
9797
assert (
9898
repr(error)
99-
== "BentoServerError(request_id=None, http_status=500, message=Internal Server Error)" # noqa
99+
== "BentoServerError(request_id=None, http_status=500, message=Internal Server Error)"
100100
)

tests/test_historical_metadata.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ def test_get_dataset_condition_sends_expected_request(
176176
call = mocked_get.call_args.kwargs
177177
assert (
178178
call["url"]
179-
== f"{historical_client.gateway}/v{db.API_VERSION}/metadata.get_dataset_condition" # noqa
179+
== f"{historical_client.gateway}/v{db.API_VERSION}/metadata.get_dataset_condition"
180180
)
181181
assert ("dataset", "GLBX.MDP3") in call["params"]
182182
assert ("start_date", "2018-01-01") in call["params"]
@@ -202,7 +202,7 @@ def test_get_dataset_range_sends_expected_request(
202202
call = mocked_get.call_args.kwargs
203203
assert (
204204
call["url"]
205-
== f"{historical_client.gateway}/v{db.API_VERSION}/metadata.get_dataset_range" # noqa
205+
== f"{historical_client.gateway}/v{db.API_VERSION}/metadata.get_dataset_range"
206206
)
207207
assert sorted(call["headers"].keys()) == ["accept", "user-agent"]
208208
assert call["headers"]["accept"] == "application/json"
@@ -274,7 +274,7 @@ def test_get_billable_size_sends_expected_request(
274274
call = mocked_get.call_args.kwargs
275275
assert (
276276
call["url"]
277-
== f"{historical_client.gateway}/v{db.API_VERSION}/metadata.get_billable_size" # noqa
277+
== f"{historical_client.gateway}/v{db.API_VERSION}/metadata.get_billable_size"
278278
)
279279
assert sorted(call["headers"].keys()) == ["accept", "user-agent"]
280280
assert call["headers"]["accept"] == "application/json"

0 commit comments

Comments
 (0)