chore: fix flake8-builtins overrides

This commit is contained in:
Matthias 2024-07-05 08:51:11 +02:00
parent deeabbca12
commit 4a4e6bc952
3 changed files with 12 additions and 11 deletions

View File

@ -52,7 +52,7 @@ class BaseEnvironment(gym.Env):
reward_kwargs: dict = {}, reward_kwargs: dict = {},
window_size=10, window_size=10,
starting_point=True, starting_point=True,
id: str = "baseenv-1", id: str = "baseenv-1", # noqa: A002
seed: int = 1, seed: int = 1,
config: dict = {}, config: dict = {},
live: bool = False, live: bool = False,

View File

@ -238,9 +238,9 @@ class FreqaiDataDrawer:
metadata, fp, default=self.np_encoder, number_mode=rapidjson.NM_NATIVE metadata, fp, default=self.np_encoder, number_mode=rapidjson.NM_NATIVE
) )
def np_encoder(self, object): def np_encoder(self, obj):
if isinstance(object, np.generic): if isinstance(obj, np.generic):
return object.item() return obj.item()
def get_pair_dict_info(self, pair: str) -> Tuple[str, int]: def get_pair_dict_info(self, pair: str) -> Tuple[str, int]:
""" """
@ -448,8 +448,8 @@ class FreqaiDataDrawer:
delete_dict: Dict[str, Any] = {} delete_dict: Dict[str, Any] = {}
for dir in model_folders: for directory in model_folders:
result = pattern.match(str(dir.name)) result = pattern.match(str(directory.name))
if result is None: if result is None:
continue continue
coin = result.group(1) coin = result.group(1)
@ -458,10 +458,10 @@ class FreqaiDataDrawer:
if coin not in delete_dict: if coin not in delete_dict:
delete_dict[coin] = {} delete_dict[coin] = {}
delete_dict[coin]["num_folders"] = 1 delete_dict[coin]["num_folders"] = 1
delete_dict[coin]["timestamps"] = {int(timestamp): dir} delete_dict[coin]["timestamps"] = {int(timestamp): directory}
else: else:
delete_dict[coin]["num_folders"] += 1 delete_dict[coin]["num_folders"] += 1
delete_dict[coin]["timestamps"][int(timestamp)] = dir delete_dict[coin]["timestamps"][int(timestamp)] = directory
for coin in delete_dict: for coin in delete_dict:
if delete_dict[coin]["num_folders"] > num_keep: if delete_dict[coin]["num_folders"] > num_keep:
@ -612,9 +612,9 @@ class FreqaiDataDrawer:
elif self.model_type == "pytorch": elif self.model_type == "pytorch":
import torch import torch
zip = torch.load(dk.data_path / f"{dk.model_filename}_model.zip") zipfile = torch.load(dk.data_path / f"{dk.model_filename}_model.zip")
model = zip["pytrainer"] model = zipfile["pytrainer"]
model = model.load_from_checkpoint(zip) model = model.load_from_checkpoint(zipfile)
if not model: if not model:
raise OperationalException( raise OperationalException(

View File

@ -134,6 +134,7 @@ extend-select = [
"W", # pycodestyle "W", # pycodestyle
"UP", # pyupgrade "UP", # pyupgrade
"I", # isort "I", # isort
"A", # flake8-builtins
"TID", # flake8-tidy-imports "TID", # flake8-tidy-imports
# "EXE", # flake8-executable # "EXE", # flake8-executable
# "C4", # flake8-comprehensions # "C4", # flake8-comprehensions