aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2020-06-12 09:55:57 -0400
committerKevin O'Connor <kevin@koconnor.net>2020-06-15 17:15:53 -0400
commitf931da1b87f1896660ec58c0e2434125c6306080 (patch)
tree52cd764d040dcab4ff1c32e1111a03e02503aeca
parent6edc2946db9758b4a77a72ad8818240f3a7ae096 (diff)
downloadkutter-f931da1b87f1896660ec58c0e2434125c6306080.tar.gz
kutter-f931da1b87f1896660ec58c0e2434125c6306080.tar.xz
kutter-f931da1b87f1896660ec58c0e2434125c6306080.zip
extras: Use "from . import module" for relative imports
Use alternate import syntax to improve Python3 compatibility. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
-rw-r--r--klippy/extras/ad5206.py2
-rw-r--r--klippy/extras/bed_mesh.py7
-rw-r--r--klippy/extras/bed_tilt.py3
-rw-r--r--klippy/extras/bltouch.py3
-rw-r--r--klippy/extras/bme280.py3
-rw-r--r--klippy/extras/controller_fan.py2
-rw-r--r--klippy/extras/delta_calibrate.py3
-rw-r--r--klippy/extras/display/__init__.py2
-rw-r--r--klippy/extras/display/display.py2
-rw-r--r--klippy/extras/display/st7920.py2
-rw-r--r--klippy/extras/display/uc1701.py3
-rw-r--r--klippy/extras/dotstar.py2
-rw-r--r--klippy/extras/hall_filament_width_sensor.py2
-rw-r--r--klippy/extras/heater_fan.py2
-rw-r--r--klippy/extras/htu21d.py5
-rw-r--r--klippy/extras/manual_stepper.py3
-rw-r--r--klippy/extras/mcp4451.py2
-rw-r--r--klippy/extras/mcp4728.py2
-rw-r--r--klippy/extras/pid_calibrate.py2
-rw-r--r--klippy/extras/probe.py3
-rw-r--r--klippy/extras/quad_gantry_level.py2
-rw-r--r--klippy/extras/replicape.py3
-rw-r--r--klippy/extras/screws_tilt_adjust.py2
-rw-r--r--klippy/extras/spi_temperature.py2
-rw-r--r--klippy/extras/sx1509.py2
-rw-r--r--klippy/extras/temperature_fan.py2
-rw-r--r--klippy/extras/thermistor.py2
-rw-r--r--klippy/extras/tmc2130.py2
-rw-r--r--klippy/extras/tmc2208.py2
-rw-r--r--klippy/extras/tmc2209.py2
-rw-r--r--klippy/extras/tmc2660.py2
-rw-r--r--klippy/extras/tmc5160.py2
-rw-r--r--klippy/extras/z_tilt.py3
33 files changed, 43 insertions, 40 deletions
diff --git a/klippy/extras/ad5206.py b/klippy/extras/ad5206.py
index 41130815..d4725801 100644
--- a/klippy/extras/ad5206.py
+++ b/klippy/extras/ad5206.py
@@ -3,7 +3,7 @@
# Copyright (C) 2017,2018 Kevin O'Connor <kevin@koconnor.net>
#
# This file may be distributed under the terms of the GNU GPLv3 license.
-import bus
+from . import bus
class ad5206:
def __init__(self, config):
diff --git a/klippy/extras/bed_mesh.py b/klippy/extras/bed_mesh.py
index 10c07063..9d5f491d 100644
--- a/klippy/extras/bed_mesh.py
+++ b/klippy/extras/bed_mesh.py
@@ -4,11 +4,8 @@
# Copyright (C) 2018-2019 Eric Callahan <arksine.code@gmail.com>
#
# This file may be distributed under the terms of the GNU GPLv3 license.
-import logging
-import math
-import json
-import probe
-import collections
+import logging, math, json, collections
+from . import probe
PROFILE_VERSION = 1
PROFILE_OPTIONS = {
diff --git a/klippy/extras/bed_tilt.py b/klippy/extras/bed_tilt.py
index 910b40a9..dd75655a 100644
--- a/klippy/extras/bed_tilt.py
+++ b/klippy/extras/bed_tilt.py
@@ -4,7 +4,8 @@
#
# This file may be distributed under the terms of the GNU GPLv3 license.
import logging
-import probe, mathutil
+import mathutil
+from . import probe
class BedTilt:
def __init__(self, config):
diff --git a/klippy/extras/bltouch.py b/klippy/extras/bltouch.py
index 8e9166bd..50e27e0e 100644
--- a/klippy/extras/bltouch.py
+++ b/klippy/extras/bltouch.py
@@ -4,7 +4,8 @@
#
# This file may be distributed under the terms of the GNU GPLv3 license.
import logging
-import homing, probe
+import homing
+from . import probe
SIGNAL_PERIOD = 0.020
MIN_CMD_TIME = 5 * SIGNAL_PERIOD
diff --git a/klippy/extras/bme280.py b/klippy/extras/bme280.py
index 8cf5f799..89b3556b 100644
--- a/klippy/extras/bme280.py
+++ b/klippy/extras/bme280.py
@@ -3,9 +3,8 @@
# Copyright (C) 2020 Eric Callahan <arksine.code@gmail.com>
#
# This file may be distributed under the terms of the GNU GPLv3 license.
-
-import bus
import logging
+from . import bus
REPORT_TIME = .8
BME280_CHIP_ADDR = 0x76
diff --git a/klippy/extras/controller_fan.py b/klippy/extras/controller_fan.py
index 1828a200..562ad2bc 100644
--- a/klippy/extras/controller_fan.py
+++ b/klippy/extras/controller_fan.py
@@ -3,7 +3,7 @@
# Copyright (C) 2019 Nils Friedchen <nils.friedchen@googlemail.com>
#
# This file may be distributed under the terms of the GNU GPLv3 license.
-import fan
+from . import fan
PIN_MIN_TIME = 0.100
diff --git a/klippy/extras/delta_calibrate.py b/klippy/extras/delta_calibrate.py
index f9af963a..c927eb5e 100644
--- a/klippy/extras/delta_calibrate.py
+++ b/klippy/extras/delta_calibrate.py
@@ -4,7 +4,8 @@
#
# This file may be distributed under the terms of the GNU GPLv3 license.
import math, logging, collections
-import probe, mathutil
+import mathutil
+from . import probe
# A "stable position" is a 3-tuple containing the number of steps
# taken since hitting the endstop on each delta tower. Delta
diff --git a/klippy/extras/display/__init__.py b/klippy/extras/display/__init__.py
index c839b098..1cea00e0 100644
--- a/klippy/extras/display/__init__.py
+++ b/klippy/extras/display/__init__.py
@@ -3,7 +3,7 @@
# Copyright (C) 2018 Kevin O'Connor <kevin@koconnor.net>
#
# This file may be distributed under the terms of the GNU GPLv3 license.
-import display
+from . import display
def load_config(config):
return display.load_config(config)
diff --git a/klippy/extras/display/display.py b/klippy/extras/display/display.py
index fdeb3e4c..3bdc47ea 100644
--- a/klippy/extras/display/display.py
+++ b/klippy/extras/display/display.py
@@ -6,7 +6,7 @@
#
# This file may be distributed under the terms of the GNU GPLv3 license.
import logging, os, ast
-import hd44780, st7920, uc1701, menu
+from . import hd44780, st7920, uc1701, menu
LCD_chips = {
'st7920': st7920.ST7920, 'hd44780': hd44780.HD44780,
diff --git a/klippy/extras/display/st7920.py b/klippy/extras/display/st7920.py
index 19828943..c0810378 100644
--- a/klippy/extras/display/st7920.py
+++ b/klippy/extras/display/st7920.py
@@ -4,7 +4,7 @@
#
# This file may be distributed under the terms of the GNU GPLv3 license.
import logging
-import font8x14
+from . import font8x14
BACKGROUND_PRIORITY_CLOCK = 0x7fffffff00000000
diff --git a/klippy/extras/display/uc1701.py b/klippy/extras/display/uc1701.py
index 921d3be4..b3157607 100644
--- a/klippy/extras/display/uc1701.py
+++ b/klippy/extras/display/uc1701.py
@@ -5,7 +5,8 @@
#
# This file may be distributed under the terms of the GNU GPLv3 license.
import logging
-import font8x14, extras.bus
+import extras.bus
+from . import font8x14
BACKGROUND_PRIORITY_CLOCK = 0x7fffffff00000000
diff --git a/klippy/extras/dotstar.py b/klippy/extras/dotstar.py
index 9939012e..3075217b 100644
--- a/klippy/extras/dotstar.py
+++ b/klippy/extras/dotstar.py
@@ -3,7 +3,7 @@
# Copyright (C) 2019 Kevin O'Connor <kevin@koconnor.net>
#
# This file may be distributed under the terms of the GNU GPLv3 license.
-import bus
+from . import bus
BACKGROUND_PRIORITY_CLOCK = 0x7fffffff00000000
diff --git a/klippy/extras/hall_filament_width_sensor.py b/klippy/extras/hall_filament_width_sensor.py
index ee3a6632..e065f175 100644
--- a/klippy/extras/hall_filament_width_sensor.py
+++ b/klippy/extras/hall_filament_width_sensor.py
@@ -3,7 +3,7 @@
# Copyright (C) 2019 Mustafa YILDIZ <mydiz@hotmail.com>
#
# This file may be distributed under the terms of the GNU GPLv3 license.
-import filament_switch_sensor
+from . import filament_switch_sensor
ADC_REPORT_TIME = 0.500
ADC_SAMPLE_TIME = 0.03
diff --git a/klippy/extras/heater_fan.py b/klippy/extras/heater_fan.py
index 1d435ee0..5d64160d 100644
--- a/klippy/extras/heater_fan.py
+++ b/klippy/extras/heater_fan.py
@@ -3,7 +3,7 @@
# Copyright (C) 2016-2018 Kevin O'Connor <kevin@koconnor.net>
#
# This file may be distributed under the terms of the GNU GPLv3 license.
-import fan
+from . import fan
PIN_MIN_TIME = 0.100
diff --git a/klippy/extras/htu21d.py b/klippy/extras/htu21d.py
index 3c9e0590..dd84bb27 100644
--- a/klippy/extras/htu21d.py
+++ b/klippy/extras/htu21d.py
@@ -3,6 +3,8 @@
# Copyright (C) 2020 Lucio Tarantino <lucio.tarantino@gmail.com>
#
# This file may be distributed under the terms of the GNU GPLv3 license.
+import logging
+from . import bus
######################################################################
# NOTE: The implementation requires write support of length 0
@@ -17,9 +19,6 @@
#
######################################################################
-import bus
-import logging
-
HTU21D_I2C_ADDR= 0x40
HTU21D_COMMANDS = {
diff --git a/klippy/extras/manual_stepper.py b/klippy/extras/manual_stepper.py
index c549a951..5807c04c 100644
--- a/klippy/extras/manual_stepper.py
+++ b/klippy/extras/manual_stepper.py
@@ -3,7 +3,8 @@
# Copyright (C) 2019 Kevin O'Connor <kevin@koconnor.net>
#
# This file may be distributed under the terms of the GNU GPLv3 license.
-import stepper, homing, force_move, chelper
+import stepper, homing, chelper
+from . import force_move
ENDSTOP_SAMPLE_TIME = .000015
ENDSTOP_SAMPLE_COUNT = 4
diff --git a/klippy/extras/mcp4451.py b/klippy/extras/mcp4451.py
index d8b798e4..12d3b6a0 100644
--- a/klippy/extras/mcp4451.py
+++ b/klippy/extras/mcp4451.py
@@ -3,7 +3,7 @@
# Copyright (C) 2018 Kevin O'Connor <kevin@koconnor.net>
#
# This file may be distributed under the terms of the GNU GPLv3 license.
-import bus
+from . import bus
WiperRegisters = [0x00, 0x01, 0x06, 0x07]
diff --git a/klippy/extras/mcp4728.py b/klippy/extras/mcp4728.py
index eb1c3904..674ab18c 100644
--- a/klippy/extras/mcp4728.py
+++ b/klippy/extras/mcp4728.py
@@ -3,7 +3,7 @@
# Copyright (C) 2018 Kevin O'Connor <kevin@koconnor.net>
#
# This file may be distributed under the terms of the GNU GPLv3 license.
-import bus
+from . import bus
class mcp4728:
def __init__(self, config):
diff --git a/klippy/extras/pid_calibrate.py b/klippy/extras/pid_calibrate.py
index 2bc6566c..a7768e57 100644
--- a/klippy/extras/pid_calibrate.py
+++ b/klippy/extras/pid_calibrate.py
@@ -4,7 +4,7 @@
#
# This file may be distributed under the terms of the GNU GPLv3 license.
import math, logging
-import heaters
+from . import heaters
class PIDCalibrate:
def __init__(self, config):
diff --git a/klippy/extras/probe.py b/klippy/extras/probe.py
index e58b6080..02d1b5b9 100644
--- a/klippy/extras/probe.py
+++ b/klippy/extras/probe.py
@@ -4,7 +4,8 @@
#
# This file may be distributed under the terms of the GNU GPLv3 license.
import logging
-import pins, homing, manual_probe
+import pins, homing
+from . import manual_probe
HINT_TIMEOUT = """
Make sure to home the printer before probing. If the probe
diff --git a/klippy/extras/quad_gantry_level.py b/klippy/extras/quad_gantry_level.py
index 300e2ce5..79e5c8ba 100644
--- a/klippy/extras/quad_gantry_level.py
+++ b/klippy/extras/quad_gantry_level.py
@@ -4,7 +4,7 @@
#
# This file may be distributed under the terms of the GNU GPLv3 license.
import logging
-import probe, z_tilt
+from . import probe, z_tilt
class QuadGantryLevel:
def __init__(self, config):
diff --git a/klippy/extras/replicape.py b/klippy/extras/replicape.py
index 5938502e..9236264f 100644
--- a/klippy/extras/replicape.py
+++ b/klippy/extras/replicape.py
@@ -4,7 +4,8 @@
#
# This file may be distributed under the terms of the GNU GPLv3 license.
import logging, os
-import pins, mcu, bus
+import pins, mcu
+from . import bus
REPLICAPE_MAX_CURRENT = 3.84
REPLICAPE_PCA9685_BUS = 2
diff --git a/klippy/extras/screws_tilt_adjust.py b/klippy/extras/screws_tilt_adjust.py
index caec9105..2dd54af3 100644
--- a/klippy/extras/screws_tilt_adjust.py
+++ b/klippy/extras/screws_tilt_adjust.py
@@ -4,7 +4,7 @@
#
# This file may be distributed under the terms of the GNU GPLv3 license.
import math
-import probe
+from . import probe
def parse_coord(config, param):
pair = config.get(param).strip().split(',', 1)
diff --git a/klippy/extras/spi_temperature.py b/klippy/extras/spi_temperature.py
index 48deace9..d6f0a2ba 100644
--- a/klippy/extras/spi_temperature.py
+++ b/klippy/extras/spi_temperature.py
@@ -5,7 +5,7 @@
#
# This file may be distributed under the terms of the GNU GPLv3 license.
import math
-import bus
+from . import bus
######################################################################
diff --git a/klippy/extras/sx1509.py b/klippy/extras/sx1509.py
index a6c700fc..7a4f24db 100644
--- a/klippy/extras/sx1509.py
+++ b/klippy/extras/sx1509.py
@@ -4,7 +4,7 @@
#
# This file may be distributed under the terms of the GNU GPLv3 license.
import pins
-import bus
+from . import bus
# Word registers
REG_RESET = 0x7D
diff --git a/klippy/extras/temperature_fan.py b/klippy/extras/temperature_fan.py
index 61c10e53..3a568113 100644
--- a/klippy/extras/temperature_fan.py
+++ b/klippy/extras/temperature_fan.py
@@ -3,7 +3,7 @@
# Copyright (C) 2016-2018 Kevin O'Connor <kevin@koconnor.net>
#
# This file may be distributed under the terms of the GNU GPLv3 license.
-import fan
+from . import fan
KELVIN_TO_CELSIUS = -273.15
MAX_FAN_TIME = 5.0
diff --git a/klippy/extras/thermistor.py b/klippy/extras/thermistor.py
index ff95afba..ab25c5c5 100644
--- a/klippy/extras/thermistor.py
+++ b/klippy/extras/thermistor.py
@@ -4,7 +4,7 @@
#
# This file may be distributed under the terms of the GNU GPLv3 license.
import math, logging
-import adc_temperature
+from . import adc_temperature
KELVIN_TO_CELSIUS = -273.15
diff --git a/klippy/extras/tmc2130.py b/klippy/extras/tmc2130.py
index 6fd0c75c..50d2ce84 100644
--- a/klippy/extras/tmc2130.py
+++ b/klippy/extras/tmc2130.py
@@ -4,7 +4,7 @@
#
# This file may be distributed under the terms of the GNU GPLv3 license.
import math, logging
-import bus, tmc
+from . import bus, tmc
TMC_FREQUENCY=13200000.
diff --git a/klippy/extras/tmc2208.py b/klippy/extras/tmc2208.py
index fa55fd70..31368e3c 100644
--- a/klippy/extras/tmc2208.py
+++ b/klippy/extras/tmc2208.py
@@ -4,7 +4,7 @@
#
# This file may be distributed under the terms of the GNU GPLv3 license.
import logging
-import tmc, tmc_uart, tmc2130
+from . import tmc, tmc_uart, tmc2130
TMC_FREQUENCY=12000000.
diff --git a/klippy/extras/tmc2209.py b/klippy/extras/tmc2209.py
index 5b97d906..9533488d 100644
--- a/klippy/extras/tmc2209.py
+++ b/klippy/extras/tmc2209.py
@@ -3,7 +3,7 @@
# Copyright (C) 2019 Stephan Oelze <stephan.oelze@gmail.com>
#
# This file may be distributed under the terms of the GNU GPLv3 license.
-import tmc2208, tmc2130, tmc, tmc_uart
+from . import tmc2208, tmc2130, tmc, tmc_uart
TMC_FREQUENCY=12000000.
diff --git a/klippy/extras/tmc2660.py b/klippy/extras/tmc2660.py
index 2f5ac527..2d7dac7f 100644
--- a/klippy/extras/tmc2660.py
+++ b/klippy/extras/tmc2660.py
@@ -5,7 +5,7 @@
#
# This file may be distributed under the terms of the GNU GPLv3 license.
import math, logging
-import bus, tmc
+from . import bus, tmc
Registers = {
"DRVCONF": 0xE, "SGCSCONF": 0xC, "SMARTEN": 0xA,
diff --git a/klippy/extras/tmc5160.py b/klippy/extras/tmc5160.py
index a188ba47..e02ae7a1 100644
--- a/klippy/extras/tmc5160.py
+++ b/klippy/extras/tmc5160.py
@@ -4,7 +4,7 @@
#
# This file may be distributed under the terms of the GNU GPLv3 license.
import math, logging
-import bus, tmc, tmc2130
+from . import bus, tmc, tmc2130
TMC_FREQUENCY=12000000.
diff --git a/klippy/extras/z_tilt.py b/klippy/extras/z_tilt.py
index 43c123de..577b7e70 100644
--- a/klippy/extras/z_tilt.py
+++ b/klippy/extras/z_tilt.py
@@ -4,7 +4,8 @@
#
# This file may be distributed under the terms of the GNU GPLv3 license.
import logging
-import probe, mathutil
+import mathutil
+from . import probe
class ZAdjustHelper:
def __init__(self, config, z_count):