mirror of
https://github.com/aykhans/HuaweiHealthDataVisualization.git
synced 2025-04-18 23:09:43 +00:00
added typing.Union
This commit is contained in:
parent
749c8c7bad
commit
cd19c54876
@ -2,21 +2,22 @@ import pandas as pd
|
||||
from datetime import (datetime,
|
||||
timedelta)
|
||||
from typing import (List,
|
||||
Tuple)
|
||||
Tuple,
|
||||
Union)
|
||||
|
||||
|
||||
class DataOperations:
|
||||
heart_rate = None
|
||||
|
||||
def is_data_none_wrapper(func):
|
||||
def __is_data_none(self, *args, **kwargs) -> None | NameError:
|
||||
def __is_data_none(self, *args, **kwargs) -> Union[None, NameError]:
|
||||
if self.data is None:
|
||||
raise NameError(f'data not found. You must call the get_data function before calling the {func.__name__} function')
|
||||
return func(self, *args, **kwargs)
|
||||
return __is_data_none
|
||||
|
||||
def is_heart_rate_none_wrapper(func):
|
||||
def __is_heart_rate_none(self, *args, **kwargs) -> None | NameError:
|
||||
def __is_heart_rate_none(self, *args, **kwargs) -> Union[None, NameError]:
|
||||
if self.heart_rate is None:
|
||||
raise NameError(f'heart_rate data not found. You must call the get_heart_rate function before calling the {func.__name__} function')
|
||||
return func(self, *args, **kwargs)
|
||||
|
Loading…
x
Reference in New Issue
Block a user