diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 169d23636..7675171e7 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -52,7 +52,7 @@ repos: hooks: - id: flake8 additional_dependencies: - - flake8-bugbear==22.1.11 + - flake8-bugbear==22.3.20 - repo: https://github.com/pre-commit/mirrors-prettier rev: v2.5.1 hooks: diff --git a/src/octoprint/plugin/types.py b/src/octoprint/plugin/types.py index b43982670..b5e7979c1 100644 --- a/src/octoprint/plugin/types.py +++ b/src/octoprint/plugin/types.py @@ -1428,7 +1428,7 @@ class BlueprintPlugin(OctoPrintPlugin, RestartNeedingPlugin): # we now iterate over all members of ourselves and look if we find an attribute # that has data originating from one of our decorators - we ignore anything # starting with a _ to only handle public stuff - for member in [member for member in dir(self) if not member.startswith("_")]: + for member in [x for x in dir(self) if not x.startswith("_")]: f = getattr(self, member) if hasattr(f, "_blueprint_rules") and member in f._blueprint_rules: diff --git a/src/octoprint/server/util/watchdog.py b/src/octoprint/server/util/watchdog.py index aa36d8fe6..4424c19d5 100644 --- a/src/octoprint/server/util/watchdog.py +++ b/src/octoprint/server/util/watchdog.py @@ -41,8 +41,7 @@ class GcodeWatchdogHandler(watchdog.events.PatternMatchingEventHandler): """Recursively yield DirEntry objects for given directory.""" for entry in os.scandir(path): if entry.is_dir(follow_symlinks=False): - for entry in _recursive_scandir(entry.path): - yield entry + yield from _recursive_scandir(entry.path) else: yield entry diff --git a/src/octoprint/server/views.py b/src/octoprint/server/views.py index 235e15f01..26e31ae17 100644 --- a/src/octoprint/server/views.py +++ b/src/octoprint/server/views.py @@ -150,9 +150,9 @@ def _valid_status_for_cache(status_code): return 200 <= status_code < 400 -def _add_additional_assets(hook): +def _add_additional_assets(hook_name): result = [] - for name, hook in pluginManager.get_hooks(hook).items(): + for name, hook in pluginManager.get_hooks(hook_name).items(): try: assets = hook() if isinstance(assets, (tuple, list)): diff --git a/src/octoprint/util/comm.py b/src/octoprint/util/comm.py index 9677002ae..92b525600 100644 --- a/src/octoprint/util/comm.py +++ b/src/octoprint/util/comm.py @@ -2593,7 +2593,7 @@ class MachineCom: ) for key in [ - key for key in parsed if key.startswith("e") and len(key) > 1 + x for x in parsed if x.startswith("e") and len(x) > 1 ]: setattr(self.last_position, key, parsed.get(key))