Skip to content

Commit 8bafa39

Browse files
committed
REF: Upgrade black and ruff
1 parent 120a977 commit 8bafa39

29 files changed

+104
-118
lines changed

databento/common/constants.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,7 @@
2121

2222

2323
DEFINITION_TYPE_MAX_MAP: Final = {
24-
x[0]: np.iinfo(x[1]).max
25-
for x in InstrumentDefMsg._dtypes
26-
if not isinstance(x[1], str)
24+
x[0]: np.iinfo(x[1]).max for x in InstrumentDefMsg._dtypes if not isinstance(x[1], str)
2725
}
2826

2927
INT64_NULL: Final = 9223372036854775807

databento/common/cram.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
"""
22
Functions for handling challenge-response authentication.
33
"""
4+
45
import argparse
56
import hashlib
67
import os

databento/common/dbnstore.py

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,16 @@
1010
from io import BytesIO
1111
from os import PathLike
1212
from pathlib import Path
13-
from typing import (
14-
IO,
15-
TYPE_CHECKING,
16-
Any,
17-
BinaryIO,
18-
Callable,
19-
Final,
20-
Literal,
21-
Protocol,
22-
TextIO,
23-
overload,
24-
)
13+
from typing import IO
14+
from typing import TYPE_CHECKING
15+
from typing import Any
16+
from typing import BinaryIO
17+
from typing import Callable
18+
from typing import Final
19+
from typing import Literal
20+
from typing import Protocol
21+
from typing import TextIO
22+
from typing import overload
2523

2624
import databento_dbn
2725
import numpy as np

databento/common/enums.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
from enum import Flag
55
from enum import IntFlag
66
from enum import unique
7-
from typing import Callable, TypeVar
7+
from typing import Callable
8+
from typing import TypeVar
89

910

1011
M = TypeVar("M", bound=Enum)

databento/common/error.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,7 @@ def __init__(
3030
http_body = http_body.decode("utf-8")
3131
except UnicodeDecodeError:
3232
http_body = (
33-
"<Could not decode body as utf-8. "
34-
"Please report to [email protected]>"
33+
"<Could not decode body as utf-8. Please report to [email protected]>"
3534
)
3635

3736
self.http_status = http_status

databento/common/publishers.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
# ruff: noqa: C901
1111

1212

13-
1413
@unique
1514
@coercible
1615
class Venue(StringyMixin, str, Enum):
@@ -419,6 +418,7 @@ def description(self) -> str:
419418
return "Long-Term Stock Exchange, Inc."
420419
raise ValueError("Unexpected Venue value")
421420

421+
422422
@unique
423423
@coercible
424424
class Dataset(StringyMixin, str, Enum):
@@ -719,6 +719,7 @@ def description(self) -> str:
719719
return "Databento Equities Max"
720720
raise ValueError("Unexpected Dataset value")
721721

722+
722723
@unique
723724
@coercible
724725
class Publisher(StringyMixin, str, Enum):
@@ -1301,6 +1302,7 @@ def to_int(self) -> int:
13011302
if self == Publisher.DBEQ_MAX_LTSE:
13021303
return 80
13031304
raise ValueError("Invalid Publisher")
1305+
13041306
@property
13051307
def venue(self) -> Venue:
13061308
"""
@@ -1467,6 +1469,7 @@ def venue(self) -> Venue:
14671469
if self == Publisher.DBEQ_MAX_LTSE:
14681470
return Venue.LTSE
14691471
raise ValueError("Unexpected Publisher value")
1472+
14701473
@property
14711474
def dataset(self) -> Dataset:
14721475
"""

databento/common/symbology.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,10 @@
1010
from io import TextIOWrapper
1111
from os import PathLike
1212
from pathlib import Path
13-
from typing import Any, ClassVar, NamedTuple, TextIO
13+
from typing import Any
14+
from typing import ClassVar
15+
from typing import NamedTuple
16+
from typing import TextIO
1417

1518
import pandas as pd
1619
from databento_dbn import UNDEF_TIMESTAMP
@@ -243,9 +246,7 @@ def insert_metadata(self, metadata: Metadata) -> None:
243246
return
244247

245248
stype_in = SType(metadata.stype_in) if metadata.stype_in is not None else None
246-
stype_out = (
247-
SType(metadata.stype_out) if metadata.stype_out is not None else None
248-
)
249+
stype_out = SType(metadata.stype_out) if metadata.stype_out is not None else None
249250

250251
for symbol_in, entries in metadata.mappings.items():
251252
for entry in entries:

databento/common/types.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
from typing import Callable, Generic, TypeVar, Union
1+
from typing import Callable
2+
from typing import Generic
3+
from typing import TypeVar
4+
from typing import Union
25

36
import databento_dbn
47

@@ -23,6 +26,8 @@
2326
ExceptionCallback = Callable[[Exception], None]
2427

2528
_T = TypeVar("_T")
29+
30+
2631
class Default(Generic[_T]):
2732
"""
2833
A container for a default value. This is to be used when a callable wants

databento/common/validation.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,7 @@ def validate_path(value: PathLike[str] | str, param: str) -> Path:
3838
return Path(value)
3939
except TypeError:
4040
raise TypeError(
41-
f"The `{param}` was not a valid path type. "
42-
"Use any of [str, bytes, os.PathLike].",
41+
f"The `{param}` was not a valid path type. " "Use any of [str, bytes, os.PathLike].",
4342
) from None
4443

4544

@@ -253,8 +252,7 @@ def validate_smart_symbol(symbol: str) -> str:
253252
if len(tokens) > 3 or not all(tokens):
254253
raise ValueError(
255254
f"value `{symbol}` is not a valid smart symbol format; ",
256-
"valid formats are [ROOT], [ROOT].[ASSET_CLASS], and "
257-
"[ROOT].[ROLL_RULE].[RANK].",
255+
"valid formats are [ROOT], [ROOT].[ASSET_CLASS], and " "[ROOT].[ROLL_RULE].[RANK].",
258256
)
259257

260258
if len(tokens) == 3:

databento/historical/api/batch.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -145,19 +145,19 @@ def submit_job(
145145
"stype_in": str(stype_in_valid),
146146
"stype_out": str(validate_enum(stype_out, SType, "stype_out")),
147147
"encoding": str(validate_enum(encoding, Encoding, "encoding")),
148-
"compression": str(validate_enum(compression, Compression, "compression"))
149-
if compression
150-
else None,
148+
"compression": (
149+
str(validate_enum(compression, Compression, "compression")) if compression else None
150+
),
151151
"pretty_px": pretty_px,
152152
"pretty_ts": pretty_ts,
153153
"map_symbols": map_symbols,
154154
"split_symbols": split_symbols,
155155
"split_duration": str(
156156
validate_enum(split_duration, SplitDuration, "split_duration"),
157157
),
158-
"packaging": str(validate_enum(packaging, Packaging, "packaging"))
159-
if packaging
160-
else None,
158+
"packaging": (
159+
str(validate_enum(packaging, Packaging, "packaging")) if packaging else None
160+
),
161161
"delivery": str(validate_enum(delivery, Delivery, "delivery")),
162162
}
163163

0 commit comments

Comments
 (0)