Fix additional flake8 nits
This commit is contained in:
1 parent
d7d3272905
commit
a7ca374955
10 files changed
+13
-13
No files matched your search
@@ -377,7 +377,7 @@ class CommandTrigger(GenericEventListener):
|
||||
else:
|
||||
processedCommand = self._processCommand(command, payload)
|
||||
self.executeCommand(processedCommand, commandType, debug=debug)
|
||||
except KeyError as e:
|
||||
except KeyError:
|
||||
self._logger.warning("There was an error processing one or more placeholders in the following command: %s" % command)
|
||||
|
||||
def executeCommand(self, command, commandType, debug=False):
|
||||
|
||||
@@ -381,7 +381,7 @@ class AnnouncementPlugin(octoprint.plugin.AssetPlugin,
|
||||
r = requests.get(url, timeout=30)
|
||||
r.raise_for_status()
|
||||
self._logger.info("Loaded channel {} from {} in {:.2}s".format(key, config["url"], time.time() - start))
|
||||
except Exception as e:
|
||||
except Exception:
|
||||
self._logger.exception(
|
||||
"Could not fetch channel {} from {}".format(key, config["url"]))
|
||||
return None
|
||||
|
||||
@@ -707,7 +707,7 @@ class BackupPlugin(octoprint.plugin.SettingsPlugin,
|
||||
|
||||
if callable(on_backup_done):
|
||||
on_backup_done(name, final_path, exclude)
|
||||
except Exception as exc:
|
||||
except Exception as exc: ## noqa: F841
|
||||
# TODO py3: use the exception, not sys.exc_info()
|
||||
if callable(on_backup_error):
|
||||
exc_info = sys.exc_info()
|
||||
|
||||
@@ -340,7 +340,7 @@ class Printer(PrinterInterface, comm.MachineComPrintCallback):
|
||||
if not axis in PrinterInterface.valid_axes:
|
||||
raise ValueError("Invalid axis {}, valid axes are {}".format(axis, ", ".join(PrinterInterface.valid_axes)))
|
||||
|
||||
command = "G1 {}".format(" ".join(["{}{}".format(axis.upper(), amount) for axis, amount in axes.items()]))
|
||||
command = "G1 {}".format(" ".join(["{}{}".format(axis.upper(), amt) for axis, amt in axes.items()]))
|
||||
|
||||
if speed is None:
|
||||
printer_profile = self._printerProfileManager.get_current_or_default()
|
||||
@@ -936,7 +936,7 @@ class Printer(PrinterInterface, comm.MachineComPrintCallback):
|
||||
|
||||
try:
|
||||
fileData = self._fileManager.get_metadata(FileDestinations.SDCARD if sd else FileDestinations.LOCAL, path_on_disk)
|
||||
except Exception as exc:
|
||||
except Exception:
|
||||
self._logger.exception("Error generating fileData")
|
||||
fileData = None
|
||||
if fileData is not None:
|
||||
|
||||
@@ -391,7 +391,7 @@ class Server(object):
|
||||
try:
|
||||
clazz = octoprint.util.get_class(group_manager_name)
|
||||
groupManager = clazz()
|
||||
except AttributeError as e:
|
||||
except AttributeError:
|
||||
self._logger.exception("Could not instantiate group manager {}, "
|
||||
"falling back to FilebasedGroupManager!".format(group_manager_name))
|
||||
groupManager = octoprint.access.groups.FilebasedGroupManager()
|
||||
|
||||
@@ -670,7 +670,7 @@ class LessSimpleCache(BaseCache):
|
||||
def calculate_timeout(self, timeout=None):
|
||||
if timeout is None:
|
||||
timeout = self.default_timeout
|
||||
if timeout is -1:
|
||||
if timeout == -1:
|
||||
return None
|
||||
return time.time() + timeout
|
||||
|
||||
|
||||
@@ -914,7 +914,7 @@ class TimelapseRenderJob(object):
|
||||
for line in lines:
|
||||
# We should be getting the time more often, so try it first
|
||||
current_time = _ffmpeg_current_regex.search(line)
|
||||
if current_time is not None and self._parsed_duration is not 0:
|
||||
if current_time is not None and self._parsed_duration != 0:
|
||||
current_s = self._convert_time(*current_time.groups())
|
||||
progress = current_s / float(self._parsed_duration) * 100
|
||||
|
||||
@@ -922,7 +922,7 @@ class TimelapseRenderJob(object):
|
||||
for callback in _update_callbacks:
|
||||
try:
|
||||
callback.sendRenderProgress(progress)
|
||||
except Exception as ex:
|
||||
except Exception:
|
||||
self._logger.exception("Exception while pushing render progress")
|
||||
|
||||
else:
|
||||
|
||||
@@ -21,7 +21,7 @@ class Stk500v2(ispBase.IspBase):
|
||||
self.close()
|
||||
try:
|
||||
self.serial = Serial(str(port), speed, timeout=1, writeTimeout=10000)
|
||||
except SerialException as e:
|
||||
except SerialException:
|
||||
raise ispBase.IspError("Failed to open serial port")
|
||||
except Exception:
|
||||
raise ispBase.IspError("Unexpected error while connecting to serial port:" + port + ":" + str(sys.exc_info()[0]))
|
||||
|
||||
@@ -1565,7 +1565,7 @@ class MachineCom(object):
|
||||
|
||||
now = time.time()
|
||||
|
||||
if line.strip() is not "":
|
||||
if line.strip() != "":
|
||||
self._consecutive_timeouts = 0
|
||||
self._timeout = self._get_new_communication_timeout()
|
||||
|
||||
|
||||
+2
-2
@@ -182,7 +182,7 @@ class BaseSession(object):
|
||||
`stats`
|
||||
If set to True, will update statistics after operation completes
|
||||
"""
|
||||
raise NotImplemented()
|
||||
raise NotImplementedError()
|
||||
|
||||
def send_jsonified(self, msg, stats=True):
|
||||
"""Send or queue outgoing message which was json-encoded before. Used by the `broadcast`
|
||||
@@ -193,7 +193,7 @@ class BaseSession(object):
|
||||
`stats`
|
||||
If set to True, will update statistics after operation completes
|
||||
"""
|
||||
raise NotImplemented()
|
||||
raise NotImplementedError()
|
||||
|
||||
def broadcast(self, clients, msg):
|
||||
"""Optimized `broadcast` implementation. Depending on type of the session, will json-encode
|
||||
|
||||
Reference in new issue
Block a user