DeprecationWarning: The 'warn' method is deprecated, use 'warning' instead

DeprecationWarning: The 'warn' method is deprecated, use 'warning' instead
This commit is contained in:
MirceaDan committed 2018-12-01 15:07:04 -08:00
1 parent f72f948744
commit f5c8b04958
26 files changed
+109 -106

No files matched your search

+3
View File
@@ -31,9 +31,12 @@ OctoPrint.egg-info
*.codekit
venv
venv2
venv3
venv26
venv27
venv33
venv34
venv35
venv36
venv37
+1 -1
View File
@@ -88,7 +88,7 @@ class OctoPrintPluginCommands(click.MultiCommand):
commands = hook(self, pass_octoprint_ctx)
for command in commands:
if not isinstance(command, click.Command):
self._logger.warn("Plugin {} provided invalid CLI command, ignoring it: {!r}".format(name, command))
self._logger.warning("Plugin {} provided invalid CLI command, ignoring it: {!r}".format(name, command))
continue
result[name + self.sep + command.name] = command
except:
+3 -3
View File
@@ -360,7 +360,7 @@ class CommandTrigger(GenericEventListener):
processedCommand = self._processCommand(command, payload)
self.executeCommand(processedCommand, commandType, debug=debug)
except KeyError as e:
self._logger.warn("There was an error processing one or more placeholders in the following command: %s" % command)
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):
if commandType == "system":
@@ -388,9 +388,9 @@ class CommandTrigger(GenericEventListener):
commandExecutioner(command)
except subprocess.CalledProcessError as e:
if debug:
self._logger.warn("Command failed with return code {}: {}".format(e.returncode, str(e)))
self._logger.warning("Command failed with return code {}: {}".format(e.returncode, str(e)))
else:
self._logger.warn("Command failed with return code {}, enable debug logging on target 'octoprint.events' for details".format(e.returncode))
self._logger.warning("Command failed with return code {}, enable debug logging on target 'octoprint.events' for details".format(e.returncode))
except:
self._logger.exception("Command failed")
+1 -1
View File
@@ -1115,7 +1115,7 @@ class LocalFileStorage(StorageInterface):
try:
print_time = float(print_time)
except:
self._logger.warn("Invalid print time value found in print history for {} in {}/.metadata.json: {!r}".format(name, path, print_time))
self._logger.warning("Invalid print time value found in print history for {} in {}/.metadata.json: {!r}".format(name, path, print_time))
continue
if not printer_profile in former_print_times:
+11 -11
View File
@@ -682,7 +682,7 @@ class PluginManager(object):
actual_readonly = not os.access(folder, os.W_OK)
if not os.path.exists(folder):
self.logger.warn("Plugin folder {folder} could not be found, skipping it".format(folder=folder))
self.logger.warning("Plugin folder {folder} could not be found, skipping it".format(folder=folder))
continue
for entry in scandir(folder):
@@ -818,7 +818,7 @@ class PluginManager(object):
else:
return None
except:
self.logger.warn("Could not locate plugin {key}".format(key=key))
self.logger.warning("Could not locate plugin {key}".format(key=key))
return None
# Create a simple dummy entry first ...
@@ -831,7 +831,7 @@ class PluginManager(object):
plugin.forced_disabled = True
if self._is_plugin_blacklisted(key) or (plugin.version is not None and self._is_plugin_version_blacklisted(key, plugin.version)):
self.logger.warn("Plugin {} is blacklisted.".format(plugin))
self.logger.warning("Plugin {} is blacklisted.".format(plugin))
plugin.blacklisted = True
if not plugin.validate("before_import", additional_validators=self.plugin_validators):
@@ -925,7 +925,7 @@ class PluginManager(object):
try:
if plugin.loaded and not plugin.forced_disabled:
if plugin.blacklisted:
self.logger.warn("Plugin {} is blacklisted. Not enabling it.".format(plugin))
self.logger.warning("Plugin {} is blacklisted. Not enabling it.".format(plugin))
continue
self.enable_plugin(name, plugin=plugin, initialize_implementation=initialize_implementations, startup=startup)
except PluginNeedsRestart:
@@ -967,7 +967,7 @@ class PluginManager(object):
def load_plugin(self, name, plugin=None, startup=False, initialize_implementation=True):
if not name in self.plugins:
self.logger.warn("Trying to load an unknown plugin {name}".format(**locals()))
self.logger.warning("Trying to load an unknown plugin {name}".format(**locals()))
return
if plugin is None:
@@ -990,7 +990,7 @@ class PluginManager(object):
def unload_plugin(self, name):
if not name in self.plugins:
self.logger.warn("Trying to unload unknown plugin {name}".format(**locals()))
self.logger.warning("Trying to unload unknown plugin {name}".format(**locals()))
return
plugin = self.plugins[name]
@@ -1024,7 +1024,7 @@ class PluginManager(object):
def enable_plugin(self, name, plugin=None, initialize_implementation=True, startup=False):
if not name in self.disabled_plugins:
self.logger.warn("Tried to enable plugin {name}, however it is not disabled".format(**locals()))
self.logger.warning("Tried to enable plugin {name}, however it is not disabled".format(**locals()))
return
if plugin is None:
@@ -1066,7 +1066,7 @@ class PluginManager(object):
def disable_plugin(self, name, plugin=None):
if not name in self.enabled_plugins:
self.logger.warn("Tried to disable plugin {name}, however it is not enabled".format(**locals()))
self.logger.warning("Tried to disable plugin {name}, however it is not enabled".format(**locals()))
return
if plugin is None:
@@ -1105,7 +1105,7 @@ class PluginManager(object):
try:
callback, order = self._get_callback_and_order(definition)
except ValueError as e:
self.logger.warn("There is something wrong with the hook definition {} for plugin {}: {}".format(definition, name, str(e)))
self.logger.warning("There is something wrong with the hook definition {} for plugin {}: {}".format(definition, name, str(e)))
continue
self._plugin_hooks[hook].append((order, name, callback))
@@ -1124,7 +1124,7 @@ class PluginManager(object):
try:
callback, order = self._get_callback_and_order(definition)
except ValueError as e:
self.logger.warn("There is something wrong with the hook definition {} for plugin {}: {}".format(definition, name, str(e)))
self.logger.warning("There is something wrong with the hook definition {} for plugin {}: {}".format(definition, name, str(e)))
continue
try:
@@ -1480,7 +1480,7 @@ class PluginManager(object):
try:
int(sorting_value)
except ValueError:
self.logger.warn("The order value returned by {} for sorting context {} is not a valid integer, ignoring it".format(impl[0], sorting_context))
self.logger.warning("The order value returned by {} for sorting context {} is not a valid integer, ignoring it".format(impl[0], sorting_context))
sorting_value = None
return sorting_value is None, sorting_value, impl[0]
@@ -124,7 +124,7 @@ class ActionCommandPromptPlugin(octoprint.plugin.AssetPlugin,
if action == b"prompt_begin":
if self._prompt is not None and self._prompt.active:
self._logger.warn("Prompt is already defined")
self._logger.warning("Prompt is already defined")
return
self._prompt = Prompt(parameter.strip())
@@ -132,7 +132,7 @@ class ActionCommandPromptPlugin(octoprint.plugin.AssetPlugin,
if self._prompt is None:
return
if self._prompt.active:
self._logger.warn("Prompt is already active")
self._logger.warning("Prompt is already active")
return
self._prompt.add_choice(parameter.strip())
@@ -140,7 +140,7 @@ class ActionCommandPromptPlugin(octoprint.plugin.AssetPlugin,
if self._prompt is None:
return
if self._prompt.active:
self._logger.warn("Prompt is already active")
self._logger.warning("Prompt is already active")
return
self._show_prompt()
+5 -5
View File
@@ -105,11 +105,11 @@ class CuraPlugin(octoprint.plugin.SlicerPlugin,
return flask.make_response(u"Something went wrong while converting imported profile: {message}".format(message=str(e)), 500)
else:
self._logger.warn(u"No profile file included for importing, aborting")
self._logger.warning(u"No profile file included for importing, aborting")
return flask.make_response(u"No file included", 400)
if profile_dict is None:
self._logger.warn(u"Could not convert profile, aborting")
self._logger.warning(u"Could not convert profile, aborting")
return flask.make_response(u"Could not convert Cura profile", 400)
name, _ = os.path.splitext(filename)
@@ -142,14 +142,14 @@ class CuraPlugin(octoprint.plugin.SlicerPlugin,
display_name=profile_display_name,
description=profile_description)
except octoprint.slicing.ProfileAlreadyExists:
self._logger.warn(u"Profile {profile_name} already exists, aborting".format(**locals()))
self._logger.warning(u"Profile {profile_name} already exists, aborting".format(**locals()))
return flask.make_response(u"A profile named {profile_name} already exists for slicer cura".format(**locals()), 409)
if profile_make_default:
try:
self._slicing_manager.set_default_profile("cura", profile_name)
except octoprint.slicing.UnknownProfile:
self._logger.warn(u"Profile {profile_name} could not be set as default, aborting".format(**locals()))
self._logger.warning(u"Profile {profile_name} could not be set as default, aborting".format(**locals()))
return flask.make_response(u"The profile {profile_name} for slicer cura could not be set as default".format(**locals()), 500)
result = dict(
@@ -428,7 +428,7 @@ class CuraPlugin(octoprint.plugin.SlicerPlugin,
if p.returncode == 0:
return True, dict(analysis=analysis)
else:
self._logger.warn(u"Could not slice via Cura, got return code %r" % p.returncode)
self._logger.warning(u"Could not slice via Cura, got return code %r" % p.returncode)
return False, "Got returncode %r" % p.returncode
except octoprint.slicing.SlicingCancelled as e:
+1 -1
View File
@@ -366,7 +366,7 @@ class Profile(object):
import os
if not os.path.exists(path) or not os.path.isfile(path):
logger.warn("Path {path} does not exist or is not a file, cannot import".format(**locals()))
logger.warning("Path {path} does not exist or is not a file, cannot import".format(**locals()))
return None
import ConfigParser
+1 -1
View File
@@ -653,7 +653,7 @@ class DiscoveryPlugin(octoprint.plugin.StartupPlugin,
if not request.error_code and request.command == "M-SEARCH" and request.path == "*" and (request.headers["ST"] == "upnp:rootdevice" or request.headers["ST"] == "ssdp:all") and request.headers["MAN"] == '"ssdp:discover"':
interface_address = octoprint.util.address_for_client(*address)
if not interface_address:
self._logger.warn("Can't determine address to user for client {}, not sending a M-SEARCH reply".format(address))
self._logger.warning("Can't determine address to user for client {}, not sending a M-SEARCH reply".format(address))
continue
message = location_message.format(uuid=self.get_uuid(), location="http://{host}:{port}/plugin/discovery/discovery.xml".format(host=interface_address, port=self.port))
sock.sendto(message, address)
+1 -1
View File
@@ -273,7 +273,7 @@ class PiSupportPlugin(octoprint.plugin.EnvironmentDetectionPlugin,
message += "\n!!! FREQUENCY CAPPING DUE TO OVERHEATING REPORTED !!! Improve cooling on the Pi's " \
"CPU and GPU."
self._logger.warn(message)
self._logger.warning(message)
self._plugin_manager.send_plugin_message(self._identifier, dict(type="throttle_state",
state=self._throttle_state.as_dict()))
@@ -216,7 +216,7 @@ class PluginManagerPlugin(octoprint.plugin.SimpleApiPlugin,
try:
os.remove(archive.name)
except Exception as e:
self._logger.warn("Could not remove temporary file {path} again: {message}".format(path=archive.name, message=str(e)))
self._logger.warning("Could not remove temporary file {path} again: {message}".format(path=archive.name, message=str(e)))
##~~ EventHandlerPlugin
@@ -448,7 +448,7 @@ class PluginManagerPlugin(octoprint.plugin.SimpleApiPlugin,
new_plugin = self._find_installed_plugin(installed, plugins=all_plugins_after)
if new_plugin is None:
self._logger.warn("The plugin was installed successfully, but couldn't be found afterwards to "
self._logger.warning("The plugin was installed successfully, but couldn't be found afterwards to "
"initialize properly during runtime. Please restart OctoPrint.")
result = dict(result=True,
source=source,
@@ -504,7 +504,7 @@ class PluginManagerPlugin(octoprint.plugin.SimpleApiPlugin,
return make_response("Bundled plugins cannot be uninstalled", 403)
if plugin.origin is None:
self._logger.warn(u"Trying to uninstall plugin {plugin} but origin is unknown".format(**locals()))
self._logger.warning(u"Trying to uninstall plugin {plugin} but origin is unknown".format(**locals()))
return make_response("Could not uninstall plugin, its origin is unknown")
if plugin.origin.type == "entry_point":
@@ -539,7 +539,7 @@ class PluginManagerPlugin(octoprint.plugin.SimpleApiPlugin,
os.remove(pyc_file)
else:
self._logger.warn(u"Trying to uninstall plugin {plugin} but origin is unknown ({plugin.origin.type})".format(**locals()))
self._logger.warning(u"Trying to uninstall plugin {plugin} but origin is unknown ({plugin.origin.type})".format(**locals()))
return make_response("Could not uninstall plugin, its origin is unknown")
needs_restart = self._plugin_manager.is_restart_needing_plugin(plugin)
@@ -881,7 +881,7 @@ class PluginManagerPlugin(octoprint.plugin.SimpleApiPlugin,
parsed_date = dateutil.parser.parse(notice["date"])
notice["timestamp"] = parsed_date.timetuple()
except Exception as e:
self._logger.warn("Error while parsing date {!r} for plugin notice "
self._logger.warning("Error while parsing date {!r} for plugin notice "
"of plugin {}, ignoring notice: {}".format(notice["date"], key, str(e)))
continue
@@ -132,9 +132,9 @@ class SoftwareUpdatePlugin(octoprint.plugin.BlueprintPlugin,
for key, default_config in hook_checks.items():
if key in effective_configs or key == "octoprint":
if key == name:
self._logger.warn("Software update hook {} provides check for itself but that was already registered by {} - overwriting that third party registration now!".format(name, check_providers.get(key, "unknown hook")))
self._logger.warning("Software update hook {} provides check for itself but that was already registered by {} - overwriting that third party registration now!".format(name, check_providers.get(key, "unknown hook")))
else:
self._logger.warn("Software update hook {} tried to overwrite config for check {} but that was already configured elsewhere".format(name, key))
self._logger.warning("Software update hook {} tried to overwrite config for check {} but that was already configured elsewhere".format(name, key))
continue
check_providers[key] = name
@@ -159,7 +159,7 @@ class SoftwareUpdatePlugin(octoprint.plugin.BlueprintPlugin,
if effective_config:
effective_configs[key] = effective_config
else:
self._logger.warn("Update for {} is empty or None, ignoring it".format(key))
self._logger.warning("Update for {} is empty or None, ignoring it".format(key))
# finally set all our internal representations to our processed results
for key, config in effective_configs.items():
@@ -648,7 +648,7 @@ class SoftwareUpdatePlugin(octoprint.plugin.BlueprintPlugin,
future = executor.submit(self._get_current_version, target, populated_check, force=force)
futures_to_result[future] = (target, populated_check)
except exceptions.UnknownCheckType:
self._logger.warn("Unknown update check type for target {}: {}".format(target,
self._logger.warning("Unknown update check type for target {}: {}".format(target,
check.get("type",
"<n/a>")))
continue
@@ -763,11 +763,11 @@ class SoftwareUpdatePlugin(octoprint.plugin.BlueprintPlugin,
update_possible = False
information["needs_online"] = True
except exceptions.UnknownCheckType:
self._logger.warn("Unknown check type %s for %s" % (check["type"], target))
self._logger.warning("Unknown check type %s for %s" % (check["type"], target))
update_possible = False
error = "unknown_check"
except exceptions.NetworkError:
self._logger.warn("Could not check %s for updates due to a network error" % target)
self._logger.warning("Could not check %s for updates due to a network error" % target)
update_possible = False
error = "network"
except:
@@ -911,7 +911,7 @@ class SoftwareUpdatePlugin(octoprint.plugin.BlueprintPlugin,
return False, None
if not update_possible:
self._logger.warn("Cannot perform update for %s, update type is not fully configured" % target)
self._logger.warning("Cannot perform update for %s, update type is not fully configured" % target)
return False, None
# determine the target version to update to
@@ -948,12 +948,12 @@ class SoftwareUpdatePlugin(octoprint.plugin.BlueprintPlugin,
trigger_event(True)
except exceptions.UnknownUpdateType:
self._logger.warn("Update of %s can not be performed, unknown update type" % target)
self._logger.warning("Update of %s can not be performed, unknown update type" % target)
self._send_client_message("update_failed", dict(target=target, version=target_version, name=populated_check["displayName"], reason="Unknown update type"))
return False, None
except exceptions.CannotUpdateOffline:
self._logger.warn("Update of %s can not be performed, it's not marked as 'offline' capable but we are apparently offline right now" % target)
self._logger.warning("Update of %s can not be performed, it's not marked as 'offline' capable but we are apparently offline right now" % target)
self._send_client_message("update_failed", dict(target=target, version=target_version, name=populated_check["displayName"], reason="No internet connection"))
except Exception as e:
@@ -1000,8 +1000,8 @@ class SoftwareUpdatePlugin(octoprint.plugin.BlueprintPlugin,
util.execute(restart_command, evaluate_returncode=False, do_async=True)
except exceptions.ScriptError as e:
self._logger.exception("Error while restarting via command {}".format(restart_command))
self._logger.warn("Restart stdout:\n{}".format(e.stdout))
self._logger.warn("Restart stderr:\n{}".format(e.stderr))
self._logger.warning("Restart stdout:\n{}".format(e.stdout))
self._logger.warning("Restart stderr:\n{}".format(e.stderr))
raise exceptions.RestartFailed()
def _populated_check(self, target, check):
+13 -13
View File
@@ -251,7 +251,7 @@ class PrinterProfileManager(object):
return
if not isinstance(default_overrides, dict):
self._logger.warn("Existing default profile from settings is not a valid profile, refusing to migrate: {!r}".format(default_overrides))
self._logger.warning("Existing default profile from settings is not a valid profile, refusing to migrate: {!r}".format(default_overrides))
return
default_overrides["id"] = "_default"
@@ -368,7 +368,7 @@ class PrinterProfileManager(object):
if profile is not None:
return profile
else:
self._logger.warn("Default profile {} is invalid, falling back to built-in defaults".format(default))
self._logger.warning("Default profile {} is invalid, falling back to built-in defaults".format(default))
return copy.deepcopy(self.__class__.default)
@@ -403,7 +403,7 @@ class PrinterProfileManager(object):
try:
profile = self._load_from_path(path)
except InvalidProfileError:
self._logger.warn("Profile {} is invalid, skipping".format(identifier))
self._logger.warning("Profile {} is invalid, skipping".format(identifier))
continue
if profile is None:
@@ -445,7 +445,7 @@ class PrinterProfileManager(object):
profile = self._ensure_valid_profile(profile)
if not profile:
self._logger.warn("Invalid profile: %s" % path)
self._logger.warning("Invalid profile: %s" % path)
raise InvalidProfileError()
return profile
@@ -514,7 +514,7 @@ class PrinterProfileManager(object):
def _ensure_valid_profile(self, profile):
# ensure all keys are present
if not dict_contains_keys(self.default, profile):
self._logger.warn("Profile invalid, missing keys. Expected: {expected!r}. Actual: {actual!r}".format(expected=self.default.keys(), actual=profile.keys()))
self._logger.warning("Profile invalid, missing keys. Expected: {expected!r}. Actual: {actual!r}".format(expected=self.default.keys(), actual=profile.keys()))
return False
# conversion helper
@@ -535,7 +535,7 @@ class PrinterProfileManager(object):
try:
convert_value(profile, path, int)
except Exception as e:
self._logger.warn("Profile has invalid value for path {path!r}: {msg}".format(path=".".join(path), msg=str(e)))
self._logger.warning("Profile has invalid value for path {path!r}: {msg}".format(path=".".join(path), msg=str(e)))
return False
# convert floats
@@ -543,7 +543,7 @@ class PrinterProfileManager(object):
try:
convert_value(profile, path, float)
except Exception as e:
self._logger.warn("Profile has invalid value for path {path!r}: {msg}".format(path=".".join(path), msg=str(e)))
self._logger.warning("Profile has invalid value for path {path!r}: {msg}".format(path=".".join(path), msg=str(e)))
return False
# convert booleans
@@ -551,17 +551,17 @@ class PrinterProfileManager(object):
try:
convert_value(profile, path, bool)
except Exception as e:
self._logger.warn("Profile has invalid value for path {path!r}: {msg}".format(path=".".join(path), msg=str(e)))
self._logger.warning("Profile has invalid value for path {path!r}: {msg}".format(path=".".join(path), msg=str(e)))
return False
# validate form factor
if not profile["volume"]["formFactor"] in BedFormFactor.values():
self._logger.warn("Profile has invalid value volume.formFactor: {formFactor}".format(formFactor=profile["volume"]["formFactor"]))
self._logger.warning("Profile has invalid value volume.formFactor: {formFactor}".format(formFactor=profile["volume"]["formFactor"]))
return False
# validate origin type
if not profile["volume"]["origin"] in BedOrigin.values():
self._logger.warn("Profile has invalid value in volume.origin: {origin}".format(origin=profile["volume"]["origin"]))
self._logger.warning("Profile has invalid value in volume.origin: {origin}".format(origin=profile["volume"]["origin"]))
return False
# ensure origin and form factor combination is legal
@@ -589,7 +589,7 @@ class PrinterProfileManager(object):
value = limiter(float(value), default_box[prop])
profile["volume"]["custom_box"][prop] = value
except:
self._logger.warn("Profile has invalid value in volume.custom_box.{}: {!r}".format(prop, value))
self._logger.warning("Profile has invalid value in volume.custom_box.{}: {!r}".format(prop, value))
return False
# make sure we actually do have a custom box and not just the same values as the
@@ -605,13 +605,13 @@ class PrinterProfileManager(object):
offsets = []
for offset in profile["extruder"]["offsets"]:
if not len(offset) == 2:
self._logger.warn("Profile has an invalid extruder.offsets entry: {entry!r}".format(entry=offset))
self._logger.warning("Profile has an invalid extruder.offsets entry: {entry!r}".format(entry=offset))
return False
x_offset, y_offset = offset
try:
offsets.append((float(x_offset), float(y_offset)))
except:
self._logger.warn("Profile has an extruder.offsets entry with non-float values: {entry!r}".format(entry=offset))
self._logger.warning("Profile has an extruder.offsets entry with non-float values: {entry!r}".format(entry=offset))
return False
profile["extruder"]["offsets"] = offsets
+1 -1
View File
@@ -152,7 +152,7 @@ class Printer(PrinterInterface, comm.MachineComPrintCallback):
def register_callback(self, callback, *args, **kwargs):
if not isinstance(callback, PrinterCallback):
self._logger.warn("Registering an object as printer callback which doesn't implement the PrinterCallback interface")
self._logger.warning("Registering an object as printer callback which doesn't implement the PrinterCallback interface")
self._callbacks.append(callback)
def unregister_callback(self, callback, *args, **kwargs):
+3 -3
View File
@@ -704,7 +704,7 @@ class Server(object):
# initialize and bind the server
trusted_downstream = self._settings.get(["server", "reverseProxy", "trustedDownstream"])
if not isinstance(trusted_downstream, list):
self._logger.warn("server.reverseProxy.trustedDownstream is not a list, skipping")
self._logger.warning("server.reverseProxy.trustedDownstream is not a list, skipping")
trusted_downstreams = []
self._server = util.tornado.CustomHTTPServer(self._tornado_app,
max_body_sizes=max_body_sizes,
@@ -806,7 +806,7 @@ class Server(object):
# wait for shutdown event to be processed, but maximally for 15s
event_timeout = 15.0
if eventManager.join(timeout=event_timeout):
self._logger.warn("Event loop was still busy processing after {}s, shutting down anyhow".format(event_timeout))
self._logger.warning("Event loop was still busy processing after {}s, shutting down anyhow".format(event_timeout))
if self._octoprint_daemon is not None:
self._logger.info("Cleaning up daemon pidfile")
@@ -1775,7 +1775,7 @@ class Server(object):
if len(still_postponed) == start_length:
# no change, looks like some stuff is unresolvable - let's bail
for plugin_info, definition in still_postponed:
self._logger.warn("Unable to resolve permission from {}: {!r}".format(plugin_info.key, definition))
self._logger.warning("Unable to resolve permission from {}: {!r}".format(plugin_info.key, definition))
break
postponed = still_postponed
+8 -8
View File
@@ -267,11 +267,11 @@ def _get_plugin_settings():
result = plugin.on_settings_load()
process_plugin_result(plugin._identifier, result)
except TypeError:
logger.warn("Could not load settings for plugin {name} ({version}) since it called super(...)".format(name=plugin._plugin_name,
logger.warning("Could not load settings for plugin {name} ({version}) since it called super(...)".format(name=plugin._plugin_name,
version=plugin._plugin_version))
logger.warn("in a way which has issues due to OctoPrint's dynamic reloading after plugin operations.")
logger.warn("Please contact the plugin's author and ask to update the plugin to use a direct call like")
logger.warn("octoprint.plugin.SettingsPlugin.on_settings_load(self) instead.")
logger.warning("in a way which has issues due to OctoPrint's dynamic reloading after plugin operations.")
logger.warning("Please contact the plugin's author and ask to update the plugin to use a direct call like")
logger.warning("octoprint.plugin.SettingsPlugin.on_settings_load(self) instead.")
except:
logger.exception("Could not load settings for plugin {name} ({version})".format(version=plugin._plugin_version,
name=plugin._plugin_name))
@@ -544,10 +544,10 @@ def _saveSettings(data):
try:
plugin.on_settings_save(data["plugins"][plugin_id])
except TypeError:
logger.warn("Could not save settings for plugin {name} ({version}) since it called super(...)".format(name=plugin._plugin_name, version=plugin._plugin_version))
logger.warn("in a way which has issues due to OctoPrint's dynamic reloading after plugin operations.")
logger.warn("Please contact the plugin's author and ask to update the plugin to use a direct call like")
logger.warn("octoprint.plugin.SettingsPlugin.on_settings_save(self, data) instead.")
logger.warning("Could not save settings for plugin {name} ({version}) since it called super(...)".format(name=plugin._plugin_name, version=plugin._plugin_version))
logger.warning("in a way which has issues due to OctoPrint's dynamic reloading after plugin operations.")
logger.warning("Please contact the plugin's author and ask to update the plugin to use a direct call like")
logger.warning("octoprint.plugin.SettingsPlugin.on_settings_save(self, data) instead.")
except:
logger.exception("Could not save settings for plugin {name} ({version})".format(version=plugin._plugin_version, name=plugin._plugin_name))
+3 -3
View File
@@ -89,7 +89,7 @@ def executeSystemCommand(source, command):
except Exception as e:
if not do_ignore:
error = "Command \"before\" for {}:{} failed: {}".format(source, command, str(e))
logger.warn(error)
logger.warning(error)
return make_response(error, 500)
try:
@@ -111,7 +111,7 @@ def executeSystemCommand(source, command):
returncode,
stdout_text,
stderr_text)
logger.warn(prefix_multilines(error, prefix="! "))
logger.warning(prefix_multilines(error, prefix="! "))
if not do_async:
raise CommandFailed(error)
@@ -129,7 +129,7 @@ def executeSystemCommand(source, command):
except Exception as e:
if not do_ignore:
error = "Command for {}:{} failed: {}".format(source, command, str(e))
logger.warn(error)
logger.warning(error)
return make_response(error, 500)
return NO_CONTENT
+3 -3
View File
@@ -153,7 +153,7 @@ def fix_webassets_cache():
import shutil
if not os.path.exists(self.directory):
error_logger.warn("Cache directory {} doesn't exist, not going "
error_logger.warning("Cache directory {} doesn't exist, not going "
"to attempt to write cache file".format(self.directory))
md5 = '%s' % cache.make_md5(self.V, key)
@@ -176,7 +176,7 @@ def fix_webassets_cache():
from webassets.cache import make_md5
if not os.path.exists(self.directory):
error_logger.warn("Cache directory {} doesn't exist, not going "
error_logger.warning("Cache directory {} doesn't exist, not going "
"to attempt to read cache file".format(self.directory))
return None
@@ -1418,7 +1418,7 @@ def collect_plugin_assets(enable_gcodeviewer=True, preferred_stylesheet="css"):
def asset_exists(category, asset):
exists = os.path.exists(os.path.join(basefolder, asset))
if not exists:
logger.warn("Plugin {} is referring to non existing {} asset {}".format(name, category, asset))
logger.warning("Plugin {} is referring to non existing {} asset {}".format(name, category, asset))
return exists
if "js" in all_assets:
+5 -5
View File
@@ -165,7 +165,7 @@ class PrinterStateConnection(octoprint.vendor.sockjs.tornado.SockJSConnection,
import json
message = json.loads(message)
except:
self._logger.warn("Invalid JSON received from client {}, ignoring: {!r}".format(self._remoteAddress, message))
self._logger.warning("Invalid JSON received from client {}, ignoring: {!r}".format(self._remoteAddress, message))
return
if "auth" in message:
@@ -174,7 +174,7 @@ class PrinterStateConnection(octoprint.vendor.sockjs.tornado.SockJSConnection,
if not len(parts) == 2:
raise ValueError()
except ValueError:
self._logger.warn("Got invalid auth message from client {}, ignoring: {!r}".format(self._remoteAddress, message["auth"]))
self._logger.warning("Got invalid auth message from client {}, ignoring: {!r}".format(self._remoteAddress, message["auth"]))
else:
user_id, user_session = parts
user = self._userManager.find_user(userid=user_id, session=user_session)
@@ -186,7 +186,7 @@ class PrinterStateConnection(octoprint.vendor.sockjs.tornado.SockJSConnection,
else:
self._user = self._userManager.anonymous_user_factory()
self._reregister()
self._logger.warn("Unknown user/session combo: {}:{}".format(user_id, user_session))
self._logger.warning("Unknown user/session combo: {}:{}".format(user_id, user_session))
elif "throttle" in message:
try:
@@ -194,7 +194,7 @@ class PrinterStateConnection(octoprint.vendor.sockjs.tornado.SockJSConnection,
if throttle < 1:
raise ValueError()
except ValueError:
self._logger.warn("Got invalid throttle factor from client {}, ignoring: {!r}".format(self._remoteAddress, message["throttle"]))
self._logger.warning("Got invalid throttle factor from client {}, ignoring: {!r}".format(self._remoteAddress, message["throttle"]))
else:
self._throttleFactor = throttle
self._logger.debug("Set throttle factor for client {} to {}".format(self._remoteAddress, self._throttleFactor))
@@ -373,4 +373,4 @@ class PrinterStateConnection(octoprint.vendor.sockjs.tornado.SockJSConnection,
if self._logger.isEnabledFor(logging.DEBUG):
self._logger.exception("Could not send message to client {}".format(self._remoteAddress))
else:
self._logger.warn("Could not send message to client {}: {}".format(self._remoteAddress, e))
self._logger.warning("Could not send message to client {}: {}".format(self._remoteAddress, e))
+5 -5
View File
@@ -288,7 +288,7 @@ class UploadStorageFallbackHandler(RequestlessExceptionLoggingMixin):
header_check = header.find(self._multipart_boundary)
if header_check != -1:
self._logger.warn("Header still contained multipart boundary, stripping it...")
self._logger.warning("Header still contained multipart boundary, stripping it...")
header = header[header_check:]
# convert to dict
@@ -299,7 +299,7 @@ class UploadStorageFallbackHandler(RequestlessExceptionLoggingMixin):
header = tornado.httputil.HTTPHeaders.parse(header.decode("iso-8859-1"))
except:
# looks like we couldn't decode something here neither as UTF-8 nor ISO-8859-1
self._logger.warn("Could not decode multipart headers in request, should be either UTF-8 or ISO-8859-1")
self._logger.warning("Could not decode multipart headers in request, should be either UTF-8 or ISO-8859-1")
self.send_error(400)
return
@@ -307,10 +307,10 @@ class UploadStorageFallbackHandler(RequestlessExceptionLoggingMixin):
disposition, disp_params = _parse_header(disp_header, strip_quotes=False)
if disposition != "form-data":
self._logger.warn("Got a multipart header without form-data content disposition, ignoring that one")
self._logger.warning("Got a multipart header without form-data content disposition, ignoring that one")
return
if not disp_params.get("name"):
self._logger.warn("Got a multipart header without name, ignoring that one")
self._logger.warning("Got a multipart header without name, ignoring that one")
return
filename = disp_params.get("filename*", None) # RFC 5987 header present?
@@ -319,7 +319,7 @@ class UploadStorageFallbackHandler(RequestlessExceptionLoggingMixin):
filename = _extended_header_value(filename)
except:
# parse error, this is not RFC 5987 compliant after all
self._logger.warn("extended filename* value {!r} is not RFC 5987 compliant".format(filename))
self._logger.warning("extended filename* value {!r} is not RFC 5987 compliant".format(filename))
self.send_error(400)
return
else:
+2 -2
View File
@@ -407,7 +407,7 @@ def index():
if response is not None:
break
else:
_logger.warn("UiPlugin {} returned an empty response".format(plugin._identifier))
_logger.warning("UiPlugin {} returned an empty response".format(plugin._identifier))
else:
response = default_view()
@@ -820,7 +820,7 @@ def _process_template_config(name, implementation, rule, config=None, counter=1)
if "suffix" in data:
data["_div"] = data["_div"] + data["suffix"]
if not _valid_div_re.match(data["_div"]):
_logger.warn("Template config {} contains invalid div identifier {}, skipping it".format(name, data["_div"]))
_logger.warning("Template config {} contains invalid div identifier {}, skipping it".format(name, data["_div"]))
return None
if not "template" in data:
+4 -4
View File
@@ -1465,7 +1465,7 @@ class Settings(object):
else:
return intValue
except ValueError:
self._logger.warn("Could not convert %r to a valid integer when getting option %r" % (value, path))
self._logger.warning("Could not convert %r to a valid integer when getting option %r" % (value, path))
return None
def getFloat(self, path, **kwargs):
@@ -1486,7 +1486,7 @@ class Settings(object):
else:
return floatValue
except ValueError:
self._logger.warn("Could not convert %r to a valid integer when getting option %r" % (value, path))
self._logger.warning("Could not convert %r to a valid integer when getting option %r" % (value, path))
return None
def getBoolean(self, path, **kwargs):
@@ -1667,7 +1667,7 @@ class Settings(object):
if maximum is not None and intValue > maximum:
intValue = maximum
except ValueError:
self._logger.warn("Could not convert %r to a valid integer when setting option %r" % (value, path))
self._logger.warning("Could not convert %r to a valid integer when setting option %r" % (value, path))
return
self.set(path, intValue, **kwargs)
@@ -1688,7 +1688,7 @@ class Settings(object):
if maximum is not None and floatValue > maximum:
floatValue = maximum
except ValueError:
self._logger.warn("Could not convert %r to a valid integer when setting option %r" % (value, path))
self._logger.warning("Could not convert %r to a valid integer when setting option %r" % (value, path))
return
self.set(path, floatValue, **kwargs)
+6 -6
View File
@@ -592,12 +592,12 @@ class Timelapse(object):
def capture_image(self):
if self._capture_dir is None:
self._logger.warn("Cannot capture image, capture directory is unset")
self._logger.warning("Cannot capture image, capture directory is unset")
return
with self._capture_mutex:
if self._image_number is None:
self._logger.warn("Cannot capture image, image number is unset")
self._logger.warning("Cannot capture image, image number is unset")
return
filename = os.path.join(self._capture_dir, _capture_format.format(prefix=self._file_prefix) % self._image_number)
@@ -696,7 +696,7 @@ class Timelapse(object):
def clean_capture_dir(self):
if not os.path.isdir(self._capture_dir):
self._logger.warn("Cannot clean capture directory, it is unset")
self._logger.warning("Cannot clean capture directory, it is unset")
return
delete_unrendered_timelapse(self._file_prefix)
@@ -850,7 +850,7 @@ class TimelapseRenderJob(object):
ffmpeg = settings().get(["webcam", "ffmpeg"])
bitrate = settings().get(["webcam", "bitrate"])
if ffmpeg is None or bitrate is None:
self._logger.warn("Cannot create movie, path to ffmpeg or desired bitrate is unset")
self._logger.warning("Cannot create movie, path to ffmpeg or desired bitrate is unset")
return
if self._videocodec == 'mpeg2video':
@@ -870,7 +870,7 @@ class TimelapseRenderJob(object):
if os.path.exists(input % i):
break
else:
self._logger.warn("Cannot create a movie, no frames captured")
self._logger.warning("Cannot create a movie, no frames captured")
self._notify_callback("fail", output, returncode=0, stdout="", stderr="", reason="no_frames")
return
@@ -907,7 +907,7 @@ class TimelapseRenderJob(object):
if returncode == 0:
self._notify_callback("success", output)
else:
self._logger.warn("Could not render movie, got return code %r: %s" % (returncode, stderr_text))
self._logger.warning("Could not render movie, got return code %r: %s" % (returncode, stderr_text))
self._notify_callback("fail", output, returncode=returncode, stdout=stdout_text, stderr=stderr_text, reason="returncode")
except:
self._logger.exception("Could not render movie due to unknown error")
+6 -6
View File
@@ -192,7 +192,7 @@ def baudrateList():
try:
candidates.insert(0, int(additional))
except:
_logger.warn("{} is not a valid additional baudrate, ignoring it".format(additional))
_logger.warning("{} is not a valid additional baudrate, ignoring it".format(additional))
# last used baudrate = first to try, move to start
prev = settings().getInt(["serial", "baudrate"])
@@ -1608,7 +1608,7 @@ class MachineCom(object):
if valid_file_type(filename, "machinecode"):
if filter_non_ascii(filename):
self._logger.warn("Got a file from printer's SD that has a non-ascii filename (%s), that shouldn't happen according to the protocol" % filename)
self._logger.warning("Got a file from printer's SD that has a non-ascii filename (%s), that shouldn't happen according to the protocol" % filename)
else:
if not filename.startswith("/"):
# file from the root of the sd -- we'll prepend a /
@@ -2005,7 +2005,7 @@ class MachineCom(object):
message = "Printer sent 'start' while already operational. External reset? " \
"Resetting line numbers to be on the safe side"
self._log(message)
self._logger.warn(message)
self._logger.warning(message)
self._on_external_reset()
@@ -2014,7 +2014,7 @@ class MachineCom(object):
message = "Printer sent 'start' while {}. External reset? " \
"Aborting job since printer lost state.".format(verb)
self._log(message)
self._logger.warn(message)
self._logger.warning(message)
self._on_external_reset()
self.cancelPrint(disable_log_position=True)
@@ -2700,7 +2700,7 @@ class MachineCom(object):
if self._resendDelta > len(self._lastLines) or len(self._lastLines) == 0 or self._resendDelta < 0:
error_text = "Printer requested line %d but no sufficient history is available, can't resend" % lineToResend
self._log(error_text)
self._logger.warn(error_text + ". Printer requested line {}, current line is {}, line history has {} entries.".format(lineToResend, self._currentLine, len(self._lastLines)))
self._logger.warning(error_text + ". Printer requested line {}, current line is {}, line history has {} entries.".format(lineToResend, self._currentLine, len(self._lastLines)))
if self.isPrinting():
# abort the print & disconnect, there's nothing we can do to rescue it
self._trigger_error(error_text, "resend")
@@ -3729,7 +3729,7 @@ class PrintingGcodeFileInformation(PrintingFileInformation):
"""
with self._handle_mutex:
if self._handle is None:
self._logger.warn(u"File {} is not open for reading".format(self._filename))
self._logger.warning(u"File {} is not open for reading".format(self._filename))
return None, None, None
try:
+1 -1
View File
@@ -429,7 +429,7 @@ class gcode(object):
elif T is not None:
if T > max_extruders:
self._logger.warn("GCODE tried to select tool %d, that looks wrong, ignoring for GCODE analysis" % T)
self._logger.warning("GCODE tried to select tool %d, that looks wrong, ignoring for GCODE analysis" % T)
elif T == currentExtruder:
pass
else:
+3 -3
View File
@@ -285,7 +285,7 @@ class PipCaller(CommandlineCaller):
p = sarge.run(sarge_command, stdout=sarge.Capture(), stderr=sarge.Capture())
if p.returncode != 0:
self._logger.warn("Error while trying to run pip --version: {}".format(p.stderr.text))
self._logger.warning("Error while trying to run pip --version: {}".format(p.stderr.text))
return None, None
output = PipCaller._preprocess(p.stdout.text)
@@ -296,11 +296,11 @@ class PipCaller(CommandlineCaller):
# we'll just split on whitespace and then try to use the second entry
if not output.startswith("pip"):
self._logger.warn("pip command returned unparseable output, can't determine version: {}".format(output))
self._logger.warning("pip command returned unparseable output, can't determine version: {}".format(output))
split_output = list(map(lambda x: x.strip(), output.split()))
if len(split_output) < 2:
self._logger.warn("pip command returned unparseable output, can't determine version: {}".format(output))
self._logger.warning("pip command returned unparseable output, can't determine version: {}".format(output))
version_segment = split_output[1]