ruff: Activate UP ruleset

This commit is contained in:
Matthias 2023-03-19 17:57:56 +01:00
parent 222ecdecd2
commit c92f28bf6f
5 changed files with 9 additions and 16 deletions

View File

@ -27,10 +27,7 @@ def _extend_validator(validator_class):
if 'default' in subschema: if 'default' in subschema:
instance.setdefault(prop, subschema['default']) instance.setdefault(prop, subschema['default'])
for error in validate_properties( yield from validate_properties(validator, properties, instance, schema)
validator, properties, instance, schema,
):
yield error
return validators.extend( return validators.extend(
validator_class, {'properties': set_defaults} validator_class, {'properties': set_defaults}

View File

@ -13,7 +13,7 @@ class TensorboardCallback(BaseCallback):
episodic summary reports. episodic summary reports.
""" """
def __init__(self, verbose=1, actions: Type[Enum] = BaseActions): def __init__(self, verbose=1, actions: Type[Enum] = BaseActions):
super(TensorboardCallback, self).__init__(verbose) super().__init__(verbose)
self.model: Any = None self.model: Any = None
self.logger = None # type: Any self.logger = None # type: Any
self.training_env: BaseEnvironment = None # type: ignore self.training_env: BaseEnvironment = None # type: ignore

View File

@ -464,7 +464,7 @@ class HyperoptTools():
try: try:
Path(csv_file).open('w+').close() Path(csv_file).open('w+').close()
except IOError: except OSError:
logger.error(f"Failed to create CSV file: {csv_file}") logger.error(f"Failed to create CSV file: {csv_file}")
return return

View File

@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-
#
# QTPyLib: Quantitative Trading Python Library # QTPyLib: Quantitative Trading Python Library
# https://github.com/ranaroussi/qtpylib # https://github.com/ranaroussi/qtpylib
# #
@ -18,7 +16,6 @@
# limitations under the License. # limitations under the License.
# #
import sys
import warnings import warnings
from datetime import datetime, timedelta from datetime import datetime, timedelta
@ -27,11 +24,6 @@ import pandas as pd
from pandas.core.base import PandasObject from pandas.core.base import PandasObject
# =============================================
# check min, python version
if sys.version_info < (3, 4):
raise SystemError("QTPyLib requires Python version >= 3.4")
# ============================================= # =============================================
warnings.simplefilter(action="ignore", category=RuntimeWarning) warnings.simplefilter(action="ignore", category=RuntimeWarning)

View File

@ -68,15 +68,19 @@ target-version = "py38"
extend-select = [ extend-select = [
"C90", # mccabe "C90", # mccabe
# "N", # pep8-naming # "N", # pep8-naming
# "UP", # pyupgrade "UP", # pyupgrade
"TID", # flake8-tidy-imports "TID", # flake8-tidy-imports
# "EXE", # flake8-executable # "EXE", # flake8-executable
"YTT", # flake8-2020 "YTT", # flake8-2020
# "S", # flake8-bandit
# "DTZ", # flake8-datetimez # "DTZ", # flake8-datetimez
# "RSE", # flake8-raise # "RSE", # flake8-raise
# "TCH", # flake8-type-checking # "TCH", # flake8-type-checking
"PTH", # flake8-use-pathlib "PTH", # flake8-use-pathlib
] ]
[tool.ruff.mccabe] [tool.ruff.mccabe]
max-complexity = 12 max-complexity = 12
[tool.ruff.per-file-ignores]
"tests/*" = ["S"]