From db37945ef0372bbaec332840d3c9dcacea7596cd Mon Sep 17 00:00:00 2001 From: Nick Macholl Date: Mon, 22 Jan 2024 13:27:59 -0800 Subject: [PATCH] FIX: Type stubs for databento_dbn --- CHANGELOG.md | 5 +++++ python/databento_dbn.pyi | 31 ++++++++++++++++++++++++++++--- 2 files changed, 33 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d0b5f49..bafa87e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ # Changelog +## 0.15.1 - TBD + +### Bug fixes +- Fixed an import error in the Python type stub file + ## 0.15.0 - 2024-01-16 ### Enhancements - Improved `Debug` implementation for all record types diff --git a/python/databento_dbn.pyi b/python/databento_dbn.pyi index 0dff9bf..2438f70 100644 --- a/python/databento_dbn.pyi +++ b/python/databento_dbn.pyi @@ -5,9 +5,7 @@ import datetime as dt from collections.abc import Iterable from collections.abc import Sequence from enum import Enum -from typing import BinaryIO, ClassVar, SupportsBytes, TextIO, TypedDict, Union - -from . import SymbolMapping +from typing import BinaryIO, ClassVar, Protocol, SupportsBytes, TextIO, TypedDict, Union FIXED_PRICE_SCALE: int @@ -35,6 +33,33 @@ _DBNRecord = Union[ StatMsg, ] +class MappingInterval(Protocol): + """ + Represents a symbol mapping over a start and end date range interval. + + Parameters + ---------- + start_date : dt.date + The start of the mapping period. + end_date : dt.date + The end of the mapping period. + symbol : str + The symbol value. + + """ + + start_date: dt.date + end_date: dt.date + symbol: str + +class SymbolMapping(Protocol): + """ + Represents the mappings for one native symbol. + """ + + raw_symbol: str + intervals: Sequence[MappingInterval] + class Compression(Enum): """ Data compression format.