Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion qlib/utils/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,5 +113,5 @@ def guess_horizon(label: List):
Try to guess the horizon by parsing label
"""
expr = DatasetProvider.parse_fields(label)[0]
lft_etd, rght_etd = expr.get_extended_window_size()
_lft_etd, rght_etd = expr.get_extended_window_size()
return rght_etd
14 changes: 7 additions & 7 deletions qlib/utils/index_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def concat(data_list: Union[SingleData], axis=0) -> MultiData:
the MultiData with ndim == 2
"""
if axis == 0:
raise NotImplementedError(f"please implement this func when axis == 0")
raise NotImplementedError("please implement this func when axis == 0")
elif axis == 1:
# get all index and row
all_index = set()
Expand All @@ -51,7 +51,7 @@ def concat(data_list: Union[SingleData], axis=0) -> MultiData:
tmp_data[now_data_map, data_id] = index_data.data
return MultiData(tmp_data, all_index)
else:
raise ValueError(f"axis must be 0 or 1")
raise ValueError("axis must be 0 or 1")


def sum_by_index(data_list: Union[SingleData], new_index: list, fill_value=0) -> SingleData:
Expand Down Expand Up @@ -432,7 +432,7 @@ def _align_indices(self, other: "IndexData") -> "IndexData":
IndexData:
the data in `other` with index aligned to `self`
"""
raise NotImplementedError(f"please implement _align_indices func")
raise NotImplementedError("please implement _align_indices func")

def sort_index(self, axis=0, inplace=True):
assert inplace, "Only support sorting inplace now"
Expand Down Expand Up @@ -483,7 +483,7 @@ def sum(self, axis=None, dtype=None, out=None):
tmp_data = np.nansum(self.data, axis=1)
return SingleData(tmp_data, self.index)
else:
raise ValueError(f"axis must be None, 0 or 1")
raise ValueError("axis must be None, 0 or 1")

def mean(self, axis=None, dtype=None, out=None):
assert out is None and dtype is None, "`out` is just for compatible with numpy's aggregating function"
Expand All @@ -497,7 +497,7 @@ def mean(self, axis=None, dtype=None, out=None):
tmp_data = np.nanmean(self.data, axis=1)
return SingleData(tmp_data, self.index)
else:
raise ValueError(f"axis must be None, 0 or 1")
raise ValueError("axis must be None, 0 or 1")

def isna(self):
return self.__class__(np.isnan(self.data), *self.indices)
Expand Down Expand Up @@ -563,7 +563,7 @@ def _align_indices(self, other):
return other.reindex(self.index)
else:
raise ValueError(
f"The indexes of self and other do not meet the requirements of the four arithmetic operations"
"The indexes of self and other do not meet the requirements of the four arithmetic operations"
)

def reindex(self, index: Index, fill_value=np.nan) -> SingleData:
Expand Down Expand Up @@ -647,7 +647,7 @@ def _align_indices(self, other):
return other
else:
raise ValueError(
f"The indexes of self and other do not meet the requirements of the four arithmetic operations"
"The indexes of self and other do not meet the requirements of the four arithmetic operations"
)

def __repr__(self) -> str:
Expand Down
2 changes: 1 addition & 1 deletion qlib/utils/mod.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ def get_callable_kwargs(config: InstConf, default_module: Union[str, ModuleType]
_callable = getattr(module, cls)
kwargs = {}
else:
raise NotImplementedError(f"This type of input is not supported")
raise NotImplementedError("This type of input is not supported")
return _callable, kwargs


Expand Down
14 changes: 7 additions & 7 deletions qlib/utils/objm.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def save_obj(self, obj: object, name: str):
name : str
name of the object
"""
raise NotImplementedError(f"Please implement `save_obj`")
raise NotImplementedError("Please implement `save_obj`")

def save_objs(self, obj_name_l):
"""
Expand All @@ -31,7 +31,7 @@ def save_objs(self, obj_name_l):
----------
obj_name_l : list of <obj, name>
"""
raise NotImplementedError(f"Please implement the `save_objs` method")
raise NotImplementedError("Please implement the `save_objs` method")

def load_obj(self, name: str) -> object:
"""
Expand All @@ -47,7 +47,7 @@ def load_obj(self, name: str) -> object:
object:
loaded object
"""
raise NotImplementedError(f"Please implement the `load_obj` method")
raise NotImplementedError("Please implement the `load_obj` method")

def exists(self, name: str) -> bool:
"""
Expand All @@ -63,7 +63,7 @@ def exists(self, name: str) -> bool:
bool:
If the object exists
"""
raise NotImplementedError(f"Please implement the `exists` method")
raise NotImplementedError("Please implement the `exists` method")

def list(self) -> list:
"""
Expand All @@ -74,7 +74,7 @@ def list(self) -> list:
list:
the list of returned objects
"""
raise NotImplementedError(f"Please implement the `list` method")
raise NotImplementedError("Please implement the `list` method")

def remove(self, fname=None):
"""remove.
Expand All @@ -85,7 +85,7 @@ def remove(self, fname=None):
if file name is provided. specific file is removed
otherwise, The all the objects will be removed.
"""
raise NotImplementedError(f"Please implement the `remove` method")
raise NotImplementedError("Please implement the `remove` method")


class FileManager(ObjManager):
Expand All @@ -104,7 +104,7 @@ def create_path(self) -> str:
return tempfile.mkdtemp(prefix=str(C["file_manager_path"]) + os.sep)
except AttributeError as attribute_e:
raise NotImplementedError(
f"If path is not given, the `create_path` function should be implemented"
"If path is not given, the `create_path` function should be implemented"
) from attribute_e

def save_obj(self, obj, name):
Expand Down
2 changes: 1 addition & 1 deletion qlib/utils/time.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ def __init__(self, freq: Union[str, "Freq"]) -> None:
elif isinstance(freq, Freq):
self.count, self.base = freq.count, freq.base
else:
raise NotImplementedError(f"This type of input is not supported")
raise NotImplementedError("This type of input is not supported")

def __eq__(self, freq):
freq = Freq(freq)
Expand Down