aboutsummaryrefslogtreecommitdiffstats
path: root/klippy/extras/garbage_collection.py
diff options
context:
space:
mode:
Diffstat (limited to 'klippy/extras/garbage_collection.py')
-rw-r--r--klippy/extras/garbage_collection.py12
1 files changed, 7 insertions, 5 deletions
diff --git a/klippy/extras/garbage_collection.py b/klippy/extras/garbage_collection.py
index da51df3b..8769251f 100644
--- a/klippy/extras/garbage_collection.py
+++ b/klippy/extras/garbage_collection.py
@@ -6,16 +6,17 @@
import gc
import logging
+
class GarbageCollection:
def __init__(self, config):
self.printer = config.get_printer()
# feature check ... freeze/unfreeze is only available in python 3.7+
- can_freeze = hasattr(gc, 'freeze') and hasattr(gc, 'unfreeze')
+ can_freeze = hasattr(gc, "freeze") and hasattr(gc, "unfreeze")
if can_freeze:
- self.printer.register_event_handler("klippy:ready",
- self._handle_ready)
- self.printer.register_event_handler("klippy:disconnect",
- self._handle_disconnect)
+ self.printer.register_event_handler("klippy:ready", self._handle_ready)
+ self.printer.register_event_handler(
+ "klippy:disconnect", self._handle_disconnect
+ )
def _handle_ready(self):
logging.debug("Running full garbage collection and freezing")
@@ -27,5 +28,6 @@ class GarbageCollection:
logging.debug("Unfreezing garbage collection")
gc.unfreeze()
+
def load_config(config):
return GarbageCollection(config)