Skip to content

Commit b254953

Browse files
committed
DOC: Update python function styling in docs
1 parent 07cea63 commit b254953

File tree

6 files changed

+20
-15
lines changed

6 files changed

+20
-15
lines changed

databento/common/dbnstore.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -328,6 +328,8 @@ class DBNStore:
328328
Write the data to a file in JSON format.
329329
to_ndarray : np.ndarray
330330
The data as a numpy `ndarray`.
331+
to_parquet
332+
Write the data to a parquet file.
331333
332334
Raises
333335
------
@@ -662,7 +664,7 @@ def from_bytes(cls, data: BytesIO | bytes | IO[bytes]) -> DBNStore:
662664
663665
Parameters
664666
----------
665-
data : BytesIO or bytes
667+
data : BytesIO or bytes or IO[bytes]
666668
The bytes to read from.
667669
668670
Returns
@@ -698,7 +700,7 @@ def insert_symbology_json(
698700
self._instrument_map.clear()
699701
self._instrument_map.insert_json(json_data)
700702

701-
def replay(self, callback: Callable[[Any], None]) -> None:
703+
def replay(self, callback: Callable[[DBNRecord], None]) -> None:
702704
"""
703705
Replay data by passing records sequentially to the given callback.
704706
@@ -983,6 +985,8 @@ def to_parquet(
983985
984986
Parameters
985987
----------
988+
path: PathLike[str] or str
989+
The file path to write the data to.
986990
price_type : str, default "float"
987991
The price type to use for price fields.
988992
If "fixed", prices will have a type of `int` in fixed decimal format; each unit representing 1e-9 or 0.000000001.

databento/common/parsing.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -351,7 +351,7 @@ def datetime_to_unix_nanoseconds(
351351

352352

353353
def optional_datetime_to_unix_nanoseconds(
354-
value: pd.Timestamp | str | int | None,
354+
value: pd.Timestamp | date | str | int | None,
355355
) -> int | None:
356356
"""
357357
Return a valid UNIX nanosecond timestamp from the given value (if not

databento/historical/api/batch.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ def submit_job(
184184

185185
def list_jobs(
186186
self,
187-
states: list[str] | str = "received,queued,processing,done",
187+
states: Iterable[str] | str = "received,queued,processing,done",
188188
since: pd.Timestamp | datetime | date | str | int | None = None,
189189
) -> list[dict[str, Any]]:
190190
"""
@@ -196,8 +196,8 @@ def list_jobs(
196196
197197
Parameters
198198
----------
199-
states : list[str] or str, optional {'received', 'queued', 'processing', 'done', 'expired'} # noqa
200-
The filter for jobs states as a list of comma separated values.
199+
states : Iterable[str] or str, optional {'received', 'queued', 'processing', 'done', 'expired'} # noqa
200+
The filter for jobs states as an iterable of comma separated values.
201201
since : pd.Timestamp, datetime, date, str, or int, optional
202202
The filter for timestamp submitted (will not include jobs prior to this).
203203

databento/historical/api/metadata.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ def __init__(self, key: str, gateway: str) -> None:
3232
super().__init__(key=key, gateway=gateway)
3333
self._base_url = gateway + f"/v{API_VERSION}/metadata"
3434

35-
def list_publishers(self) -> list[dict[str, Any]]:
35+
def list_publishers(self) -> list[dict[str, int | str]]:
3636
"""
3737
Request all publishers from Databento.
3838
@@ -42,7 +42,7 @@ def list_publishers(self) -> list[dict[str, Any]]:
4242
4343
Returns
4444
-------
45-
list[dict[str, Any]]
45+
list[dict[str, int | str]]
4646
4747
"""
4848
response: Response = self._get(
@@ -121,7 +121,7 @@ def list_fields(
121121
self,
122122
schema: Schema | str,
123123
encoding: Encoding | str,
124-
) -> list[dict[str, Any]]:
124+
) -> list[dict[str, str]]:
125125
"""
126126
List all fields for a particular schema and encoding from Databento.
127127
@@ -136,7 +136,7 @@ def list_fields(
136136
137137
Returns
138138
-------
139-
list[dict[str, Any]]
139+
list[dict[str, str]]
140140
A list of field details.
141141
142142
"""
@@ -189,7 +189,7 @@ def get_dataset_condition(
189189
dataset: Dataset | str,
190190
start_date: date | str | None = None,
191191
end_date: date | str | None = None,
192-
) -> list[dict[str, str]]:
192+
) -> list[dict[str, str | None]]:
193193
"""
194194
Get the per date dataset conditions from Databento.
195195
@@ -210,7 +210,7 @@ def get_dataset_condition(
210210
211211
Returns
212212
-------
213-
list[dict[str, str]]
213+
list[dict[str, str | None]]
214214
215215
"""
216216
params: list[tuple[str, str | None]] = [

databento/historical/api/symbology.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ def resolve(
4444
----------
4545
dataset : Dataset or str
4646
The dataset code (string identifier) for the request.
47-
symbols : Iterable[str | int] or str or int, optional
47+
symbols : Iterable[str | int] or str or int
4848
The symbols to resolve. Takes up to 2,000 symbols per request.
4949
stype_in : SType or str, default 'raw_symbol'
5050
The input symbology type to resolve from.

tests/test_historical_bento.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -435,13 +435,14 @@ def test_replay_with_stub_data_record_passes_to_callback(
435435
stub_data = test_data(Dataset.GLBX_MDP3, Schema.MBO)
436436
data = DBNStore.from_bytes(data=stub_data)
437437

438-
handler: list[MBOMsg] = []
438+
handler: list[DBNRecord] = []
439439

440440
# Act
441441
data.replay(callback=handler.append)
442-
record: MBOMsg = handler[0]
442+
record: DBNRecord = handler[0]
443443

444444
# Assert
445+
assert isinstance(record, MBOMsg)
445446
assert record.hd.length == 14
446447
assert record.hd.rtype == 160
447448
assert record.hd.rtype == 160

0 commit comments

Comments
 (0)