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 = {},
window_size=10,
starting_point=True,
id: str = "baseenv-1",
id: str = "baseenv-1", # noqa: A002
seed: int = 1,
config: dict = {},
live: bool = False,

View File

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

View File

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