aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTomasz Kramkowski <tomasz@kramkow.ski>2025-08-15 21:48:09 +0100
committerTomasz Kramkowski <tomasz@kramkow.ski>2025-08-15 21:48:09 +0100
commit22169b99b7756349baddae84b2b4e058acce5599 (patch)
tree0872a0b01322f2b776ee99b43c54fd3e824cf85e
parenta961fbda426d79dc3c33a66848408e84b0737a98 (diff)
downloadkutter-22169b99b7756349baddae84b2b4e058acce5599.tar.gz
kutter-22169b99b7756349baddae84b2b4e058acce5599.tar.xz
kutter-22169b99b7756349baddae84b2b4e058acce5599.zip
Isort all scriptsv0.1.0-rc1
-rwxr-xr-xscripts/avrsim.py10
-rw-r--r--scripts/buildcommands.py17
-rwxr-xr-xscripts/calibrate_shaper.py14
-rw-r--r--scripts/canbus_query.py6
-rwxr-xr-xscripts/check_whitespace.py4
-rwxr-xr-xscripts/checkstack.py2
-rwxr-xr-xscripts/dump_mcu.py6
-rwxr-xr-xscripts/flash-ar100.py2
-rwxr-xr-xscripts/flash_usb.py10
-rwxr-xr-xscripts/graph_accelerometer.py13
-rwxr-xr-xscripts/graph_extruder.py9
-rwxr-xr-xscripts/graph_mesh.py17
-rwxr-xr-xscripts/graph_motion.py9
-rwxr-xr-xscripts/graph_shaper.py8
-rwxr-xr-xscripts/graph_temp_sensor.py13
-rwxr-xr-xscripts/graphstats.py8
-rwxr-xr-xscripts/logextract.py6
-rw-r--r--scripts/motan/analyzers.py5
-rwxr-xr-xscripts/motan/data_logger.py10
-rwxr-xr-xscripts/motan/motan_graph.py12
-rw-r--r--scripts/motan/readlog.py3
-rwxr-xr-xscripts/parsecandump.py4
-rw-r--r--scripts/spi_flash/spi_flash.py17
-rwxr-xr-xscripts/stepstats.py1
-rw-r--r--scripts/test_klippy.py6
-rwxr-xr-xscripts/update_chitu.py4
-rwxr-xr-xscripts/whconsole.py10
27 files changed, 166 insertions, 60 deletions
diff --git a/scripts/avrsim.py b/scripts/avrsim.py
index 0dd86200..9ea4d932 100755
--- a/scripts/avrsim.py
+++ b/scripts/avrsim.py
@@ -4,7 +4,15 @@
# Copyright (C) 2015-2018 Kevin O'Connor <kevin@koconnor.net>
#
# This file may be distributed under the terms of the GNU GPLv3 license.
-import sys, optparse, time, os, pty, fcntl, termios, errno
+import errno
+import fcntl
+import optparse
+import os
+import pty
+import sys
+import termios
+import time
+
import pysimulavr
SERIALBITS = 10 # 8N1 = 1 start, 8 data, 1 stop
diff --git a/scripts/buildcommands.py b/scripts/buildcommands.py
index f5a8da82..394f9ffa 100644
--- a/scripts/buildcommands.py
+++ b/scripts/buildcommands.py
@@ -4,13 +4,23 @@
# Copyright (C) 2016-2024 Kevin O'Connor <kevin@koconnor.net>
#
# This file may be distributed under the terms of the GNU GPLv3 license.
-import sys, os, subprocess, optparse, logging, shlex, socket, time, traceback
-import json, zlib
+import json
+import logging
+import optparse
+import os
+import shlex
+import socket
+import subprocess
+import sys
+import time
+import traceback
+import zlib
sys.path.append("./klippy")
-import klippy.klippy
import msgproto
+import klippy.klippy
+
FILEHEADER = """
/* DO NOT EDIT! This is an autogenerated file. See scripts/buildcommands.py. */
@@ -556,7 +566,6 @@ def check_output(prog):
return ""
-
def build_version(extra, cleanbuild):
version = klippy.klippy.__version__
if not version:
diff --git a/scripts/calibrate_shaper.py b/scripts/calibrate_shaper.py
index 6109d843..c91718f5 100755
--- a/scripts/calibrate_shaper.py
+++ b/scripts/calibrate_shaper.py
@@ -6,9 +6,15 @@
#
# This file may be distributed under the terms of the GNU GPLv3 license.
from __future__ import print_function
-import importlib, optparse, os, sys
+
+import importlib
+import optparse
+import os
+import sys
from textwrap import wrap
-import numpy as np, matplotlib
+
+import matplotlib
+import numpy as np
sys.path.append(
os.path.join(os.path.dirname(os.path.realpath(__file__)), "..", "klippy")
@@ -167,7 +173,9 @@ def setup_matplotlib(output_to_file):
if output_to_file:
matplotlib.rcParams.update({"figure.autolayout": True})
matplotlib.use("Agg")
- import matplotlib.pyplot, matplotlib.dates, matplotlib.font_manager
+ import matplotlib.dates
+ import matplotlib.font_manager
+ import matplotlib.pyplot
import matplotlib.ticker
diff --git a/scripts/canbus_query.py b/scripts/canbus_query.py
index 9620be84..c31734dd 100644
--- a/scripts/canbus_query.py
+++ b/scripts/canbus_query.py
@@ -4,7 +4,11 @@
# Copyright (C) 2021 Kevin O'Connor <kevin@koconnor.net>
#
# This file may be distributed under the terms of the GNU GPLv3 license.
-import sys, os, optparse, time
+import optparse
+import os
+import sys
+import time
+
import can
CANBUS_ID_ADMIN = 0x3F0
diff --git a/scripts/check_whitespace.py b/scripts/check_whitespace.py
index 9223213a..9b917c4e 100755
--- a/scripts/check_whitespace.py
+++ b/scripts/check_whitespace.py
@@ -4,7 +4,9 @@
# Copyright (C) 2018 Kevin O'Connor <kevin@koconnor.net>
#
# This file may be distributed under the terms of the GNU GPLv3 license.
-import sys, os.path, unicodedata
+import os.path
+import sys
+import unicodedata
HaveError = False
diff --git a/scripts/checkstack.py b/scripts/checkstack.py
index a562c2bd..2bbd32e9 100755
--- a/scripts/checkstack.py
+++ b/scripts/checkstack.py
@@ -9,8 +9,8 @@
# Usage:
# avr-objdump -d out/kutter.elf | scripts/checkstack.py
-import sys
import re
+import sys
# Functions that change stacks
STACKHOP = []
diff --git a/scripts/dump_mcu.py b/scripts/dump_mcu.py
index 5b6c6d49..e37ec357 100755
--- a/scripts/dump_mcu.py
+++ b/scripts/dump_mcu.py
@@ -5,17 +5,17 @@
#
# This file may be distributed under the terms of the GNU GPLv3 license.
-import sys
import argparse
+import logging
import os
+import sys
import traceback
-import logging
KUTTER_DIR = os.path.abspath(os.path.join(os.path.dirname(__file__), "../"))
sys.path.append(os.path.join(KUTTER_DIR, "klippy"))
+import clocksync
import reactor
import serialhdl
-import clocksync
###########################################################
#
diff --git a/scripts/flash-ar100.py b/scripts/flash-ar100.py
index 0896ae07..7c3fc92a 100755
--- a/scripts/flash-ar100.py
+++ b/scripts/flash-ar100.py
@@ -1,7 +1,7 @@
#!/usr/bin/env python3
# This file may be distributed under the terms of the GNU GPLv3 license.
-import mmap
import argparse
+import mmap
import sys
FW_START = 0x00004000
diff --git a/scripts/flash_usb.py b/scripts/flash_usb.py
index 2d3b4a4d..af8f18af 100755
--- a/scripts/flash_usb.py
+++ b/scripts/flash_usb.py
@@ -4,7 +4,15 @@
# Copyright (C) 2019 Kevin O'Connor <kevin@koconnor.net>
#
# This file may be distributed under the terms of the GNU GPLv3 license.
-import sys, os, re, subprocess, optparse, time, fcntl, termios, struct
+import fcntl
+import optparse
+import os
+import re
+import struct
+import subprocess
+import sys
+import termios
+import time
class error(Exception):
diff --git a/scripts/graph_accelerometer.py b/scripts/graph_accelerometer.py
index 7286c041..f33b76ef 100755
--- a/scripts/graph_accelerometer.py
+++ b/scripts/graph_accelerometer.py
@@ -5,9 +5,14 @@
# Copyright (C) 2020 Dmitry Butyugin <dmbutyugin@google.com>
#
# This file may be distributed under the terms of the GNU GPLv3 license.
-import importlib, optparse, os, sys
+import importlib
+import optparse
+import os
+import sys
from textwrap import wrap
-import numpy as np, matplotlib
+
+import matplotlib
+import numpy as np
sys.path.append(
os.path.join(os.path.dirname(os.path.realpath(__file__)), "..", "klippy")
@@ -250,7 +255,9 @@ def setup_matplotlib(output):
if output:
matplotlib.rcParams.update({"figure.autolayout": True})
matplotlib.use("Agg")
- import matplotlib.pyplot, matplotlib.dates, matplotlib.font_manager
+ import matplotlib.dates
+ import matplotlib.font_manager
+ import matplotlib.pyplot
import matplotlib.ticker
diff --git a/scripts/graph_extruder.py b/scripts/graph_extruder.py
index 7475c6aa..4e576b77 100755
--- a/scripts/graph_extruder.py
+++ b/scripts/graph_extruder.py
@@ -4,7 +4,10 @@
# Copyright (C) 2019-2021 Kevin O'Connor <kevin@koconnor.net>
#
# This file may be distributed under the terms of the GNU GPLv3 license.
-import math, optparse, datetime
+import datetime
+import math
+import optparse
+
import matplotlib
SEG_TIME = 0.000100
@@ -190,7 +193,9 @@ def setup_matplotlib(output_to_file):
if output_to_file:
matplotlib.rcParams.update({"figure.autolayout": True})
matplotlib.use("Agg")
- import matplotlib.pyplot, matplotlib.dates, matplotlib.font_manager
+ import matplotlib.dates
+ import matplotlib.font_manager
+ import matplotlib.pyplot
import matplotlib.ticker
diff --git a/scripts/graph_mesh.py b/scripts/graph_mesh.py
index af1a809e..e6262f2b 100755
--- a/scripts/graph_mesh.py
+++ b/scripts/graph_mesh.py
@@ -5,20 +5,21 @@
#
# This file may be distributed under the terms of the GNU GPLv3 license.
import argparse
-import sys
+import collections
+import errno
+import json
import os
+import re
+import socket
import stat
-import errno
+import sys
import time
-import socket
-import re
-import json
-import collections
-import numpy as np
+
import matplotlib
+import matplotlib.animation as ani
import matplotlib.cm as cm
import matplotlib.pyplot as plt
-import matplotlib.animation as ani
+import numpy as np
MESH_DUMP_REQUEST = json.dumps({"id": 1, "method": "bed_mesh/dump_mesh"})
diff --git a/scripts/graph_motion.py b/scripts/graph_motion.py
index 83072680..59df798a 100755
--- a/scripts/graph_motion.py
+++ b/scripts/graph_motion.py
@@ -5,7 +5,10 @@
# Copyright (C) 2020 Dmitry Butyugin <dmbutyugin@google.com>
#
# This file may be distributed under the terms of the GNU GPLv3 license.
-import optparse, datetime, math
+import datetime
+import math
+import optparse
+
import matplotlib
SEG_TIME = 0.000100
@@ -456,7 +459,9 @@ def setup_matplotlib(output_to_file):
global matplotlib
if output_to_file:
matplotlib.use("Agg")
- import matplotlib.pyplot, matplotlib.dates, matplotlib.font_manager
+ import matplotlib.dates
+ import matplotlib.font_manager
+ import matplotlib.pyplot
import matplotlib.ticker
diff --git a/scripts/graph_shaper.py b/scripts/graph_shaper.py
index b7886e28..67c13caa 100755
--- a/scripts/graph_shaper.py
+++ b/scripts/graph_shaper.py
@@ -5,7 +5,9 @@
# Copyright (C) 2020 Dmitry Butyugin <dmbutyugin@google.com>
#
# This file may be distributed under the terms of the GNU GPLv3 license.
-import optparse, math
+import math
+import optparse
+
import matplotlib
# A set of damping ratios to calculate shaper response for
@@ -274,7 +276,9 @@ def setup_matplotlib(output_to_file):
global matplotlib
if output_to_file:
matplotlib.use("Agg")
- import matplotlib.pyplot, matplotlib.dates, matplotlib.font_manager
+ import matplotlib.dates
+ import matplotlib.font_manager
+ import matplotlib.pyplot
import matplotlib.ticker
diff --git a/scripts/graph_temp_sensor.py b/scripts/graph_temp_sensor.py
index fa6a680c..a03805cf 100755
--- a/scripts/graph_temp_sensor.py
+++ b/scripts/graph_temp_sensor.py
@@ -4,9 +4,11 @@
# Copyright (C) 2020 Kevin O'Connor <kevin@koconnor.net>
#
# This file may be distributed under the terms of the GNU GPLv3 license.
-import sys, os, optparse
-import matplotlib
+import optparse
+import os
+import sys
+import matplotlib
######################################################################
# Dummy config / printer / etc. class emulation
@@ -124,7 +126,9 @@ def setup_matplotlib(output_to_file):
if output_to_file:
matplotlib.rcParams.update({"figure.autolayout": True})
matplotlib.use("Agg")
- import matplotlib.pyplot, matplotlib.dates, matplotlib.font_manager
+ import matplotlib.dates
+ import matplotlib.font_manager
+ import matplotlib.pyplot
import matplotlib.ticker
@@ -133,7 +137,8 @@ def import_sensors(config):
# Load adc_temperature.py and thermistor.py modules
kdir = os.path.join(os.path.dirname(__file__), "..", "klippy")
sys.path.append(kdir)
- import extras.adc_temperature, extras.thermistor
+ import extras.adc_temperature
+ import extras.thermistor
extras.thermistor.load_config(config)
extras.adc_temperature.load_config(config)
diff --git a/scripts/graphstats.py b/scripts/graphstats.py
index 4a8a7164..731d9758 100755
--- a/scripts/graphstats.py
+++ b/scripts/graphstats.py
@@ -4,7 +4,9 @@
# Copyright (C) 2016-2021 Kevin O'Connor <kevin@koconnor.net>
#
# This file may be distributed under the terms of the GNU GPLv3 license.
-import optparse, datetime
+import datetime
+import optparse
+
import matplotlib
MAXBANDWIDTH = 25000.0
@@ -64,7 +66,9 @@ def setup_matplotlib(output_to_file):
global matplotlib
if output_to_file:
matplotlib.use("Agg")
- import matplotlib.pyplot, matplotlib.dates, matplotlib.font_manager
+ import matplotlib.dates
+ import matplotlib.font_manager
+ import matplotlib.pyplot
import matplotlib.ticker
diff --git a/scripts/logextract.py b/scripts/logextract.py
index d6da323d..6c6d5937 100755
--- a/scripts/logextract.py
+++ b/scripts/logextract.py
@@ -4,7 +4,11 @@
# Copyright (C) 2017 Kevin O'Connor <kevin@koconnor.net>
#
# This file may be distributed under the terms of the GNU GPLv3 license.
-import sys, re, collections, ast, itertools
+import ast
+import collections
+import itertools
+import re
+import sys
def format_comment(line_num, line):
diff --git a/scripts/motan/analyzers.py b/scripts/motan/analyzers.py
index 917cb032..15f87ffc 100644
--- a/scripts/motan/analyzers.py
+++ b/scripts/motan/analyzers.py
@@ -3,9 +3,10 @@
# Copyright (C) 2021 Kevin O'Connor <kevin@koconnor.net>
#
# This file may be distributed under the terms of the GNU GPLv3 license.
-import math, collections
-import readlog
+import collections
+import math
+import readlog
######################################################################
# Analysis code
diff --git a/scripts/motan/data_logger.py b/scripts/motan/data_logger.py
index 8a525747..78d0ccef 100755
--- a/scripts/motan/data_logger.py
+++ b/scripts/motan/data_logger.py
@@ -4,7 +4,15 @@
# Copyright (C) 2020-2021 Kevin O'Connor <kevin@koconnor.net>
#
# This file may be distributed under the terms of the GNU GPLv3 license.
-import sys, os, optparse, socket, select, json, errno, time, zlib
+import errno
+import json
+import optparse
+import os
+import select
+import socket
+import sys
+import time
+import zlib
INDEX_UPDATE_TIME = 5.0
ClientInfo = {"program": "motan_data_logger", "version": "v0.1"}
diff --git a/scripts/motan/motan_graph.py b/scripts/motan/motan_graph.py
index 8d551340..e2e8e559 100755
--- a/scripts/motan/motan_graph.py
+++ b/scripts/motan/motan_graph.py
@@ -4,9 +4,13 @@
# Copyright (C) 2019-2021 Kevin O'Connor <kevin@koconnor.net>
#
# This file may be distributed under the terms of the GNU GPLv3 license.
-import sys, optparse, ast
+import ast
+import optparse
+import sys
+
+import analyzers
import matplotlib
-import readlog, analyzers
+import readlog
try:
import urlparse
@@ -75,7 +79,9 @@ def setup_matplotlib(output_to_file):
global matplotlib
if output_to_file:
matplotlib.use("Agg")
- import matplotlib.pyplot, matplotlib.dates, matplotlib.font_manager
+ import matplotlib.dates
+ import matplotlib.font_manager
+ import matplotlib.pyplot
import matplotlib.ticker
diff --git a/scripts/motan/readlog.py b/scripts/motan/readlog.py
index 8f86d4e2..0d7651b6 100644
--- a/scripts/motan/readlog.py
+++ b/scripts/motan/readlog.py
@@ -3,7 +3,8 @@
# Copyright (C) 2021 Kevin O'Connor <kevin@koconnor.net>
#
# This file may be distributed under the terms of the GNU GPLv3 license.
-import json, zlib
+import json
+import zlib
class error(Exception):
diff --git a/scripts/parsecandump.py b/scripts/parsecandump.py
index 4ae862dc..1688e68f 100755
--- a/scripts/parsecandump.py
+++ b/scripts/parsecandump.py
@@ -4,7 +4,9 @@
# Copyright (C) 2023 Kevin O'Connor <kevin@koconnor.net>
#
# This file may be distributed under the terms of the GNU GPLv3 license.
-import sys, os, optparse
+import optparse
+import os
+import sys
def import_msgproto():
diff --git a/scripts/spi_flash/spi_flash.py b/scripts/spi_flash/spi_flash.py
index b4141cd4..8d88e28a 100644
--- a/scripts/spi_flash/spi_flash.py
+++ b/scripts/spi_flash/spi_flash.py
@@ -5,23 +5,24 @@
# Copyright (C) 2022 H. Gregor Molter <gregor.molter@secretlab.de>
#
# This file may be distributed under the terms of the GNU GPLv3 license.
-import sys
import argparse
-import os
-import zlib
+import collections
import hashlib
+import json
import logging
-import collections
+import os
+import sys
import time
import traceback
-import json
+import zlib
+
import board_defs
+import clocksync
import fatfs_lib
-import util
+import mcu
import reactor
import serialhdl
-import clocksync
-import mcu
+import util
###########################################################
#
diff --git a/scripts/stepstats.py b/scripts/stepstats.py
index 4292a525..6f7710b1 100755
--- a/scripts/stepstats.py
+++ b/scripts/stepstats.py
@@ -6,6 +6,7 @@
# This file may be distributed under the terms of the GNU GPLv3 license.
import optparse
+
def main():
usage = "%prog [options] <comms file>"
opts = optparse.OptionParser(usage)
diff --git a/scripts/test_klippy.py b/scripts/test_klippy.py
index de7ce757..a7672f5e 100644
--- a/scripts/test_klippy.py
+++ b/scripts/test_klippy.py
@@ -3,7 +3,11 @@
# Copyright (C) 2018 Kevin O'Connor <kevin@koconnor.net>
#
# This file may be distributed under the terms of the GNU GPLv3 license.
-import sys, os, optparse, logging, subprocess
+import logging
+import optparse
+import os
+import subprocess
+import sys
TEMP_GCODE_FILE = "_test_.gcode"
TEMP_OUTPUT_FILE = "_test_output"
diff --git a/scripts/update_chitu.py b/scripts/update_chitu.py
index 62145371..4c8d09df 100755
--- a/scripts/update_chitu.py
+++ b/scripts/update_chitu.py
@@ -5,11 +5,11 @@
# Copied from Marlin and modified.
# Licensed under GPL-3.0
+import hashlib
import os
import struct
-import uuid
import sys
-import hashlib
+import uuid
def calculate_crc(contents, seed):
diff --git a/scripts/whconsole.py b/scripts/whconsole.py
index 59e726f1..6d4af8e1 100755
--- a/scripts/whconsole.py
+++ b/scripts/whconsole.py
@@ -4,7 +4,15 @@
# Copyright (C) 2020 Kevin O'Connor <kevin@koconnor.net>
#
# This file may be distributed under the terms of the GNU GPLv3 license.
-import sys, os, optparse, socket, fcntl, select, json, errno, time
+import errno
+import fcntl
+import json
+import optparse
+import os
+import select
+import socket
+import sys
+import time
# Set a file-descriptor as non-blocking