♻️ Remove some Py2 stuff

This commit is contained in:
Gina Häußge committed 2021-02-10 17:52:35 +01:00
1 parent 6a9415b39f
commit 98860ece7f
16 files changed
+40 -50

No files matched your search

+2 -2
View File
@@ -11,7 +11,7 @@ from octoprint.settings import settings
from octoprint.util import is_hidden_path
class ConnectionProfile(object):
class ConnectionProfile:
def __init__(
self,
id,
@@ -48,7 +48,7 @@ class ConnectionProfile(object):
}
class ConnectionProfileManager(object):
class ConnectionProfileManager:
@classmethod
def to_profile(cls, data):
return ConnectionProfile.from_dict(data)
+4 -6
View File
@@ -7,8 +7,6 @@ import os
import time
from abc import ABCMeta
from future.utils import with_metaclass
from octoprint.comm.protocol import (
FileAwareProtocolListener,
FileManagementProtocolMixin,
@@ -18,7 +16,7 @@ from octoprint.comm.protocol import (
from octoprint.util.listener import ListenerAware
class LastResult(object):
class LastResult:
def __init__(self):
self.elapsed = None
self.clean_elapsed = None
@@ -29,7 +27,7 @@ class LastResult(object):
self.available = False
class Printjob(with_metaclass(ABCMeta, ProtocolListener, ListenerAware)):
class Printjob(ProtocolListener, ListenerAware, metaclass=ABCMeta):
parallel = False
"""Job runs parallel to regular communication."""
@@ -386,7 +384,7 @@ class LocalGcodeFilePrintjob(LocalFilePrintjob):
return processed
class CopyJobMixin(object):
class CopyJobMixin:
pass
@@ -579,7 +577,7 @@ class SDFilePrintjob(StoragePrintjob, FileAwareProtocolListener):
return payload
class PrintjobListener(object):
class PrintjobListener:
def on_job_started(self, job, suppress_script=False, *args, **kwargs):
pass
+12 -12
View File
@@ -373,7 +373,7 @@ class Protocol(ListenerAware, TransportListener):
return self.__class__.__name__
class ProtocolState(object):
class ProtocolState:
CONNECTING = "connecting"
CONNECTED = "connected"
DISCONNECTING = "disconnecting"
@@ -411,7 +411,7 @@ class ProtocolNotConnectedError(Exception):
pass
class ThreeAxisProtocolMixin(object):
class ThreeAxisProtocolMixin:
def move(
self, x=None, y=None, z=None, feedrate=None, relative=False, *args, **kwargs
):
@@ -424,7 +424,7 @@ class ThreeAxisProtocolMixin(object):
pass
class HeaterProtocolMixin(object):
class HeaterProtocolMixin:
def set_temperature(self, heater, temperature, wait=False, *args, **kwargs):
pass
@@ -435,7 +435,7 @@ class HeaterProtocolMixin(object):
return {}
class MultiToolProtocolMixin(object):
class MultiToolProtocolMixin:
def change_tool(self, tool, *args, **kwargs):
pass
@@ -460,7 +460,7 @@ class Fdm3dPrinterProtocolMixin(
pass
class FanControlProtocolMixin(object):
class FanControlProtocolMixin:
def set_fan_speed(self, speed, *args, **kwargs):
pass
@@ -468,7 +468,7 @@ class FanControlProtocolMixin(object):
pass
class MotorControlProtocolMixin(object):
class MotorControlProtocolMixin:
def enable_motors(self, *args, **kwargs):
self.set_motor_state(True)
@@ -482,7 +482,7 @@ class MotorControlProtocolMixin(object):
pass
class PowerControlProtocolMixin(object):
class PowerControlProtocolMixin:
def enable_power(self, *args, **kwargs):
self.set_power_state(True)
@@ -496,7 +496,7 @@ class PowerControlProtocolMixin(object):
return None
class FileAwareProtocolMixin(object):
class FileAwareProtocolMixin:
def init_file_storage(self, *args, **kwargs):
pass
@@ -538,7 +538,7 @@ class FileStreamingProtocolMixin(FileManagementProtocolMixin):
pass
class ProtocolListener(object):
class ProtocolListener:
def on_protocol_state(self, protocol, old_state, new_state, *args, **kwargs):
pass
@@ -591,7 +591,7 @@ class ProtocolListener(object):
pass
class FileAwareProtocolListener(object):
class FileAwareProtocolListener:
def on_protocol_file_storage_available(self, protocol, available, *args, **kwargs):
pass
@@ -616,7 +616,7 @@ class FileAwareProtocolListener(object):
pass
class PositionAwareProtocolListener(object):
class PositionAwareProtocolListener:
def on_protocol_position_all_update(self, protocol, position, *args, **kwargs):
pass
@@ -624,7 +624,7 @@ class PositionAwareProtocolListener(object):
pass
class FirmwareDataAwareProtocolListener(object):
class FirmwareDataAwareProtocolListener:
def on_protocol_firmware_info(self, protocol, info, *args, **kwargs):
pass
@@ -101,7 +101,7 @@ CAPABILITY_EMERGENCY_PARSER = "EMERGENCY_PARSER"
CAPABILITY_CHAMBER_TEMP = "CHAMBER_TEMPERATURE"
class FallbackValue(object):
class FallbackValue:
def __init__(self, value, fallback=None, test=None):
self.value = value
self.fallback = fallback
@@ -117,7 +117,7 @@ class FallbackValue(object):
return self.fallback
class BooleanCallbackValue(object):
class BooleanCallbackValue:
def __init__(self, callback):
assert callable(callback)
self.callback = callback
@@ -4,8 +4,6 @@ __copyright__ = "Copyright (C) 2018 The OctoPrint Project - Released under terms
import copy
import re
from future.utils import with_metaclass
from octoprint.util import pp
_compiled_regex_type = type(re.compile(r"a"))
@@ -44,7 +42,7 @@ class CommandMetaClass(type):
return c
class Command(with_metaclass(CommandMetaClass, object)):
class Command(metaclass=CommandMetaClass):
pattern = None
@@ -11,7 +11,7 @@ from .reprapfirmware import * # noqa: F401,F403
from .smoothieware import * # noqa: F401,F403
class FlavorOverride(object):
class FlavorOverride:
def __init__(self, flavor, overrides):
self._flavor = flavor
self._overrides = overrides
@@ -5,8 +5,6 @@ import logging
import re
import time
from future.utils import with_metaclass
from octoprint.comm.protocol.reprap.commands.gcode import GcodeCommand
from octoprint.comm.protocol.reprap.util import (
regex_float_pattern,
@@ -39,7 +37,7 @@ class FlavorMeta(type):
return cls
class GenericFlavor(with_metaclass(FlavorMeta, object)):
class GenericFlavor(metaclass=FlavorMeta):
key = "generic"
name = "Generic Flavor"
@@ -207,7 +207,7 @@ class SendToken(CountedEvent):
self._internal_set(self._counter - 1)
class LineHistory(object):
class LineHistory:
def __init__(self, max=None):
self.max = max
@@ -260,7 +260,7 @@ class LineHistory(object):
pass
class PositionRecord(object):
class PositionRecord:
_standard_attrs = {"x", "y", "z", "e", "f", "t"}
@classmethod
@@ -300,7 +300,7 @@ class PositionRecord(object):
return dict((attr, getattr(self, attr)) for attr in attrs)
class TemperatureRecord(object):
class TemperatureRecord:
def __init__(self):
self._tools = {}
self._bed = (None, None)
@@ -1,17 +1,13 @@
__license__ = "GNU Affero General Public License http://www.gnu.org/licenses/agpl.html"
__copyright__ = "Copyright (C) 2018 The OctoPrint Project - Released under terms of the AGPLv3 License"
from octoprint.util import PrependableQueue, TypeAlreadyInQueue, TypedQueue
try:
import queue
except ImportError:
import Queue as queue
import contextlib
import logging
import queue
import threading
from octoprint.util import PrependableQueue, TypeAlreadyInQueue, TypedQueue
class ScriptQueue(PrependableQueue):
pass
@@ -176,7 +172,7 @@ class SendQueue(PrependableQueue):
return self._resend_queue.qsize() + self._send_queue.qsize()
class QueueMarker(object):
class QueueMarker:
def __init__(self, callback):
self.callback = callback
+1 -1
View File
@@ -2,7 +2,7 @@ __license__ = "GNU Affero General Public License http://www.gnu.org/licenses/agp
__copyright__ = "Copyright (C) 2018 The OctoPrint Project - Released under terms of the AGPLv3 License"
class Script(object):
class Script:
def __init__(self, name, renderer, context=None):
if context is None:
context = {}
+3 -3
View File
@@ -170,7 +170,7 @@ class Transport(ListenerAware):
return self.__class__.__name__
class TransportState(object):
class TransportState:
CONNECTED = "connected"
DISCONNECTED = "disconnected"
DISCONNECTED_WITH_ERROR = "disconnected_with_error"
@@ -345,7 +345,7 @@ class PushingTransportWrapper(TransportWrapper):
return "PushingTransportWrapper({})".format(self.transport)
class TransportListener(object):
class TransportListener:
def on_transport_connected(self, transport):
pass
@@ -362,7 +362,7 @@ class TransportListener(object):
pass
class PushingTransportWrapperListener(object):
class PushingTransportWrapperListener:
def on_transport_data_pushed(self, transport, data):
pass
+2 -2
View File
@@ -14,7 +14,7 @@ def get_param_dict(data, options):
return result
class ParamType(object):
class ParamType:
type = "generic"
def __init__(
@@ -252,7 +252,7 @@ class ParamGroup(ParamType):
return dict((k, v.convert()) for k, v in value.items())
class Value(object):
class Value:
def __init__(self, value, title=None, warning=False, labels=None, help=None):
if labels is None:
labels = []
@@ -3,7 +3,7 @@ __license__ = "GNU Affero General Public License http://www.gnu.org/licenses/agp
__copyright__ = "Copyright (C) 2014 The OctoPrint Project - Released under terms of the AGPLv3 License"
class Storage(object):
class Storage:
"""
Interface of storage adapters for OctoPrint.
"""
@@ -2066,7 +2066,7 @@ class VirtualPrinter:
return "Error: {}".format(self._errors.get(error).format(*args, **kwargs))
class Outgoing(object):
class Outgoing:
def __init__(self):
self._outgoing = bytearray()
self._mutex = threading.RLock()
+1 -1
View File
@@ -2556,7 +2556,7 @@ class Settings:
f.write(script)
class SubSettings(object):
class SubSettings:
def __init__(
self,
settings,
+1 -1
View File
@@ -3,7 +3,7 @@ __license__ = "GNU Affero General Public License http://www.gnu.org/licenses/agp
__copyright__ = "Copyright (C) 2016 The OctoPrint Project - Released under terms of the AGPLv3 License"
class ListenerAware(object):
class ListenerAware:
def __init__(self):
self._listeners = set()