type hints and docs

This commit is contained in:
Gourav Kumar 2022-07-24 08:45:45 +05:30
parent cae704b658
commit ef68ae0293

View File

@ -101,7 +101,7 @@ class _IndexSlicer:
def __init__(self, parent_obj: object): def __init__(self, parent_obj: object):
self.parent = parent_obj self.parent = parent_obj
def __getitem__(self, n): def __getitem__(self, n) -> Mapping:
if isinstance(n, int): if isinstance(n, int):
keys: list = [self.parent.dates[n]] keys: list = [self.parent.dates[n]]
else: else:
@ -378,7 +378,7 @@ class TimeSeriesCore:
validate_frequency: boolean, default True validate_frequency: boolean, default True
Whether the provided frequency should be validated against the data. Whether the provided frequency should be validated against the data.
When set to True, if the expected number of data points are not withint the expected limits, When set to True, if the expected number of data points are not within the expected limits,
it will raise an Exception and object creation will fail. it will raise an Exception and object creation will fail.
Validation is performed only if data contains at least 12 data points, as a fewer number of Validation is performed only if data contains at least 12 data points, as a fewer number of
data points are not sufficient to determine the frequency correctly. data points are not sufficient to determine the frequency correctly.
@ -401,7 +401,7 @@ class TimeSeriesCore:
if validate_frequency and len(ts_data) >= 12: if validate_frequency and len(ts_data) >= 12:
if validation["frequency_match"] is not None and not validation["frequency_match"]: if validation["frequency_match"] is not None and not validation["frequency_match"]:
raise ValueError( raise ValueError(
f"Data appears to be of frquency {validation['expected_frequency']!r}, " f"Data appears to be of frequency {validation['expected_frequency']!r}, "
f"but {frequency!r} was provided. Pass the correct frequency." f"but {frequency!r} was provided. Pass the correct frequency."
"\nPass validate_frequency=False to disable this validation." "\nPass validate_frequency=False to disable this validation."
) )
@ -685,7 +685,7 @@ class TimeSeriesCore:
return key in self.data return key in self.data
def _arithmatic_validator(self, other): def _arithmatic_validator(self, other):
"""Validates input data before performing math operatios""" """Validates input data before performing math operations"""
if not isinstance(other, (Number, Series, TimeSeriesCore)): if not isinstance(other, (Number, Series, TimeSeriesCore)):
raise TypeError( raise TypeError(