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>
This commit is contained in:
Kevin O'Connor 2020-06-12 09:55:57 -04:00
parent 6edc2946db
commit f931da1b87
33 changed files with 43 additions and 40 deletions

View File

@ -3,7 +3,7 @@
# Copyright (C) 2017,2018 Kevin O'Connor <kevin@koconnor.net> # Copyright (C) 2017,2018 Kevin O'Connor <kevin@koconnor.net>
# #
# This file may be distributed under the terms of the GNU GPLv3 license. # This file may be distributed under the terms of the GNU GPLv3 license.
import bus from . import bus
class ad5206: class ad5206:
def __init__(self, config): def __init__(self, config):

View File

@ -4,11 +4,8 @@
# Copyright (C) 2018-2019 Eric Callahan <arksine.code@gmail.com> # Copyright (C) 2018-2019 Eric Callahan <arksine.code@gmail.com>
# #
# This file may be distributed under the terms of the GNU GPLv3 license. # This file may be distributed under the terms of the GNU GPLv3 license.
import logging import logging, math, json, collections
import math from . import probe
import json
import probe
import collections
PROFILE_VERSION = 1 PROFILE_VERSION = 1
PROFILE_OPTIONS = { PROFILE_OPTIONS = {

View File

@ -4,7 +4,8 @@
# #
# This file may be distributed under the terms of the GNU GPLv3 license. # This file may be distributed under the terms of the GNU GPLv3 license.
import logging import logging
import probe, mathutil import mathutil
from . import probe
class BedTilt: class BedTilt:
def __init__(self, config): def __init__(self, config):

View File

@ -4,7 +4,8 @@
# #
# This file may be distributed under the terms of the GNU GPLv3 license. # This file may be distributed under the terms of the GNU GPLv3 license.
import logging import logging
import homing, probe import homing
from . import probe
SIGNAL_PERIOD = 0.020 SIGNAL_PERIOD = 0.020
MIN_CMD_TIME = 5 * SIGNAL_PERIOD MIN_CMD_TIME = 5 * SIGNAL_PERIOD

View File

@ -3,9 +3,8 @@
# Copyright (C) 2020 Eric Callahan <arksine.code@gmail.com> # Copyright (C) 2020 Eric Callahan <arksine.code@gmail.com>
# #
# This file may be distributed under the terms of the GNU GPLv3 license. # This file may be distributed under the terms of the GNU GPLv3 license.
import bus
import logging import logging
from . import bus
REPORT_TIME = .8 REPORT_TIME = .8
BME280_CHIP_ADDR = 0x76 BME280_CHIP_ADDR = 0x76

View File

@ -3,7 +3,7 @@
# Copyright (C) 2019 Nils Friedchen <nils.friedchen@googlemail.com> # Copyright (C) 2019 Nils Friedchen <nils.friedchen@googlemail.com>
# #
# This file may be distributed under the terms of the GNU GPLv3 license. # This file may be distributed under the terms of the GNU GPLv3 license.
import fan from . import fan
PIN_MIN_TIME = 0.100 PIN_MIN_TIME = 0.100

View File

@ -4,7 +4,8 @@
# #
# This file may be distributed under the terms of the GNU GPLv3 license. # This file may be distributed under the terms of the GNU GPLv3 license.
import math, logging, collections import math, logging, collections
import probe, mathutil import mathutil
from . import probe
# A "stable position" is a 3-tuple containing the number of steps # A "stable position" is a 3-tuple containing the number of steps
# taken since hitting the endstop on each delta tower. Delta # taken since hitting the endstop on each delta tower. Delta

View File

@ -3,7 +3,7 @@
# Copyright (C) 2018 Kevin O'Connor <kevin@koconnor.net> # Copyright (C) 2018 Kevin O'Connor <kevin@koconnor.net>
# #
# This file may be distributed under the terms of the GNU GPLv3 license. # This file may be distributed under the terms of the GNU GPLv3 license.
import display from . import display
def load_config(config): def load_config(config):
return display.load_config(config) return display.load_config(config)

View File

@ -6,7 +6,7 @@
# #
# This file may be distributed under the terms of the GNU GPLv3 license. # This file may be distributed under the terms of the GNU GPLv3 license.
import logging, os, ast import logging, os, ast
import hd44780, st7920, uc1701, menu from . import hd44780, st7920, uc1701, menu
LCD_chips = { LCD_chips = {
'st7920': st7920.ST7920, 'hd44780': hd44780.HD44780, 'st7920': st7920.ST7920, 'hd44780': hd44780.HD44780,

View File

@ -4,7 +4,7 @@
# #
# This file may be distributed under the terms of the GNU GPLv3 license. # This file may be distributed under the terms of the GNU GPLv3 license.
import logging import logging
import font8x14 from . import font8x14
BACKGROUND_PRIORITY_CLOCK = 0x7fffffff00000000 BACKGROUND_PRIORITY_CLOCK = 0x7fffffff00000000

View File

@ -5,7 +5,8 @@
# #
# This file may be distributed under the terms of the GNU GPLv3 license. # This file may be distributed under the terms of the GNU GPLv3 license.
import logging import logging
import font8x14, extras.bus import extras.bus
from . import font8x14
BACKGROUND_PRIORITY_CLOCK = 0x7fffffff00000000 BACKGROUND_PRIORITY_CLOCK = 0x7fffffff00000000

View File

@ -3,7 +3,7 @@
# Copyright (C) 2019 Kevin O'Connor <kevin@koconnor.net> # Copyright (C) 2019 Kevin O'Connor <kevin@koconnor.net>
# #
# This file may be distributed under the terms of the GNU GPLv3 license. # This file may be distributed under the terms of the GNU GPLv3 license.
import bus from . import bus
BACKGROUND_PRIORITY_CLOCK = 0x7fffffff00000000 BACKGROUND_PRIORITY_CLOCK = 0x7fffffff00000000

View File

@ -3,7 +3,7 @@
# Copyright (C) 2019 Mustafa YILDIZ <mydiz@hotmail.com> # Copyright (C) 2019 Mustafa YILDIZ <mydiz@hotmail.com>
# #
# This file may be distributed under the terms of the GNU GPLv3 license. # 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_REPORT_TIME = 0.500
ADC_SAMPLE_TIME = 0.03 ADC_SAMPLE_TIME = 0.03

View File

@ -3,7 +3,7 @@
# Copyright (C) 2016-2018 Kevin O'Connor <kevin@koconnor.net> # Copyright (C) 2016-2018 Kevin O'Connor <kevin@koconnor.net>
# #
# This file may be distributed under the terms of the GNU GPLv3 license. # This file may be distributed under the terms of the GNU GPLv3 license.
import fan from . import fan
PIN_MIN_TIME = 0.100 PIN_MIN_TIME = 0.100

View File

@ -3,6 +3,8 @@
# Copyright (C) 2020 Lucio Tarantino <lucio.tarantino@gmail.com> # Copyright (C) 2020 Lucio Tarantino <lucio.tarantino@gmail.com>
# #
# This file may be distributed under the terms of the GNU GPLv3 license. # 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 # NOTE: The implementation requires write support of length 0
@ -17,9 +19,6 @@
# #
###################################################################### ######################################################################
import bus
import logging
HTU21D_I2C_ADDR= 0x40 HTU21D_I2C_ADDR= 0x40
HTU21D_COMMANDS = { HTU21D_COMMANDS = {

View File

@ -3,7 +3,8 @@
# Copyright (C) 2019 Kevin O'Connor <kevin@koconnor.net> # Copyright (C) 2019 Kevin O'Connor <kevin@koconnor.net>
# #
# This file may be distributed under the terms of the GNU GPLv3 license. # 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_TIME = .000015
ENDSTOP_SAMPLE_COUNT = 4 ENDSTOP_SAMPLE_COUNT = 4

View File

@ -3,7 +3,7 @@
# Copyright (C) 2018 Kevin O'Connor <kevin@koconnor.net> # Copyright (C) 2018 Kevin O'Connor <kevin@koconnor.net>
# #
# This file may be distributed under the terms of the GNU GPLv3 license. # This file may be distributed under the terms of the GNU GPLv3 license.
import bus from . import bus
WiperRegisters = [0x00, 0x01, 0x06, 0x07] WiperRegisters = [0x00, 0x01, 0x06, 0x07]

View File

@ -3,7 +3,7 @@
# Copyright (C) 2018 Kevin O'Connor <kevin@koconnor.net> # Copyright (C) 2018 Kevin O'Connor <kevin@koconnor.net>
# #
# This file may be distributed under the terms of the GNU GPLv3 license. # This file may be distributed under the terms of the GNU GPLv3 license.
import bus from . import bus
class mcp4728: class mcp4728:
def __init__(self, config): def __init__(self, config):

View File

@ -4,7 +4,7 @@
# #
# This file may be distributed under the terms of the GNU GPLv3 license. # This file may be distributed under the terms of the GNU GPLv3 license.
import math, logging import math, logging
import heaters from . import heaters
class PIDCalibrate: class PIDCalibrate:
def __init__(self, config): def __init__(self, config):

View File

@ -4,7 +4,8 @@
# #
# This file may be distributed under the terms of the GNU GPLv3 license. # This file may be distributed under the terms of the GNU GPLv3 license.
import logging import logging
import pins, homing, manual_probe import pins, homing
from . import manual_probe
HINT_TIMEOUT = """ HINT_TIMEOUT = """
Make sure to home the printer before probing. If the probe Make sure to home the printer before probing. If the probe

View File

@ -4,7 +4,7 @@
# #
# This file may be distributed under the terms of the GNU GPLv3 license. # This file may be distributed under the terms of the GNU GPLv3 license.
import logging import logging
import probe, z_tilt from . import probe, z_tilt
class QuadGantryLevel: class QuadGantryLevel:
def __init__(self, config): def __init__(self, config):

View File

@ -4,7 +4,8 @@
# #
# This file may be distributed under the terms of the GNU GPLv3 license. # This file may be distributed under the terms of the GNU GPLv3 license.
import logging, os import logging, os
import pins, mcu, bus import pins, mcu
from . import bus
REPLICAPE_MAX_CURRENT = 3.84 REPLICAPE_MAX_CURRENT = 3.84
REPLICAPE_PCA9685_BUS = 2 REPLICAPE_PCA9685_BUS = 2

View File

@ -4,7 +4,7 @@
# #
# This file may be distributed under the terms of the GNU GPLv3 license. # This file may be distributed under the terms of the GNU GPLv3 license.
import math import math
import probe from . import probe
def parse_coord(config, param): def parse_coord(config, param):
pair = config.get(param).strip().split(',', 1) pair = config.get(param).strip().split(',', 1)

View File

@ -5,7 +5,7 @@
# #
# This file may be distributed under the terms of the GNU GPLv3 license. # This file may be distributed under the terms of the GNU GPLv3 license.
import math import math
import bus from . import bus
###################################################################### ######################################################################

View File

@ -4,7 +4,7 @@
# #
# This file may be distributed under the terms of the GNU GPLv3 license. # This file may be distributed under the terms of the GNU GPLv3 license.
import pins import pins
import bus from . import bus
# Word registers # Word registers
REG_RESET = 0x7D REG_RESET = 0x7D

View File

@ -3,7 +3,7 @@
# Copyright (C) 2016-2018 Kevin O'Connor <kevin@koconnor.net> # Copyright (C) 2016-2018 Kevin O'Connor <kevin@koconnor.net>
# #
# This file may be distributed under the terms of the GNU GPLv3 license. # This file may be distributed under the terms of the GNU GPLv3 license.
import fan from . import fan
KELVIN_TO_CELSIUS = -273.15 KELVIN_TO_CELSIUS = -273.15
MAX_FAN_TIME = 5.0 MAX_FAN_TIME = 5.0

View File

@ -4,7 +4,7 @@
# #
# This file may be distributed under the terms of the GNU GPLv3 license. # This file may be distributed under the terms of the GNU GPLv3 license.
import math, logging import math, logging
import adc_temperature from . import adc_temperature
KELVIN_TO_CELSIUS = -273.15 KELVIN_TO_CELSIUS = -273.15

View File

@ -4,7 +4,7 @@
# #
# This file may be distributed under the terms of the GNU GPLv3 license. # This file may be distributed under the terms of the GNU GPLv3 license.
import math, logging import math, logging
import bus, tmc from . import bus, tmc
TMC_FREQUENCY=13200000. TMC_FREQUENCY=13200000.

View File

@ -4,7 +4,7 @@
# #
# This file may be distributed under the terms of the GNU GPLv3 license. # This file may be distributed under the terms of the GNU GPLv3 license.
import logging import logging
import tmc, tmc_uart, tmc2130 from . import tmc, tmc_uart, tmc2130
TMC_FREQUENCY=12000000. TMC_FREQUENCY=12000000.

View File

@ -3,7 +3,7 @@
# Copyright (C) 2019 Stephan Oelze <stephan.oelze@gmail.com> # Copyright (C) 2019 Stephan Oelze <stephan.oelze@gmail.com>
# #
# This file may be distributed under the terms of the GNU GPLv3 license. # 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. TMC_FREQUENCY=12000000.

View File

@ -5,7 +5,7 @@
# #
# This file may be distributed under the terms of the GNU GPLv3 license. # This file may be distributed under the terms of the GNU GPLv3 license.
import math, logging import math, logging
import bus, tmc from . import bus, tmc
Registers = { Registers = {
"DRVCONF": 0xE, "SGCSCONF": 0xC, "SMARTEN": 0xA, "DRVCONF": 0xE, "SGCSCONF": 0xC, "SMARTEN": 0xA,

View File

@ -4,7 +4,7 @@
# #
# This file may be distributed under the terms of the GNU GPLv3 license. # This file may be distributed under the terms of the GNU GPLv3 license.
import math, logging import math, logging
import bus, tmc, tmc2130 from . import bus, tmc, tmc2130
TMC_FREQUENCY=12000000. TMC_FREQUENCY=12000000.

View File

@ -4,7 +4,8 @@
# #
# This file may be distributed under the terms of the GNU GPLv3 license. # This file may be distributed under the terms of the GNU GPLv3 license.
import logging import logging
import probe, mathutil import mathutil
from . import probe
class ZAdjustHelper: class ZAdjustHelper:
def __init__(self, config, z_count): def __init__(self, config, z_count):