Skip to content

Commit 1bc25a8

Browse files
committed
improves typings
1 parent 59e3879 commit 1bc25a8

File tree

3 files changed

+8
-5
lines changed

3 files changed

+8
-5
lines changed

stock_pandas/dataframe.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,10 @@ def _get_or_calc_series(
340340
return name, array
341341

342342
def _fulfill_series(self, column_name: str) -> ndarray:
343-
column_info = self._stock_columns_info_map.get(column_name)
343+
# Since `column_name` always exists logically,
344+
# we could safely get by dict[key]
345+
column_info = self._stock_columns_info_map[column_name]
346+
344347
size = len(self)
345348

346349
array = self.get_column(column_name).to_numpy()

stock_pandas/meta/cumulator.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,8 @@ def cum_append(
9292
name = other[0].name
9393
other = DataFrame(other)
9494

95-
if (df.columns.get_indexer(other.columns) >= 0).all():
96-
other = other.reindex(columns=df.columns)
95+
if (df.columns.get_indexer(other.columns) >= 0).all(): # type: ignore
96+
other = other.reindex(columns=df.columns) # type: ignore
9797

9898
length = len(df[name:]) if len(df) else 0
9999
if length:
@@ -129,7 +129,7 @@ def update(
129129
self,
130130
df: 'MetaDataFrame',
131131
source,
132-
source_cumulator: '_Cumulator' = None,
132+
source_cumulator: Optional['_Cumulator'] = None,
133133
date_col: Optional[str] = None,
134134
to_datetime_kwargs: dict = {},
135135
time_frame: TimeFrameArg = None,

test/test_truncated.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ def test_invalid_slicing(stock: StockDataFrame):
9797
# However, it might never happen,
9898
# but there is a assertion in super()._slice
9999
# we have to test about this case
100-
stock._slice({})
100+
stock._slice({}) # type: ignore
101101

102102
assert stock._stock_indexer_slice is None
103103

0 commit comments

Comments
 (0)