diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 2cc43dc0..659437d7 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,15 +1,15 @@ repos: - repo: https://github.com/codespell-project/codespell - rev: v1.15.0 + rev: v2.2.6 hooks: - id: codespell args: [--ignore-words=.codespell-whitelist] -- repo: https://github.com/pre-commit/mirrors-isort - rev: v4.3.4 +- repo: https://github.com/pycqa/isort + rev: 5.13.2 hooks: - - id: isort + - id: isort - repo: https://github.com/pre-commit/mirrors-mypy - rev: v0.720 + rev: v1.7.1 hooks: - id: mypy args: [--no-strict-optional, --ignore-missing-imports] diff --git a/nebula/__init__.py b/nebula/__init__.py index f9bf1ed9..187ca68f 100644 --- a/nebula/__init__.py +++ b/nebula/__init__.py @@ -3,22 +3,20 @@ # print(f.renderText("Nebula")) import os -from nebula.netconsole import netconsole -from nebula.uart import uart -from nebula.tftpboot import tftpboot -from nebula.pdu import pdu -from nebula.manager import manager -from nebula.network import network -from nebula.driver import driver from nebula.builder import builder -from nebula.common import utils -from nebula.helper import helper -from nebula.downloader import downloader +from nebula.common import LINUX_DEFAULT_PATH, utils from nebula.coverage import coverage +from nebula.downloader import downloader +from nebula.driver import driver +from nebula.helper import helper from nebula.jtag import jtag +from nebula.manager import manager from nebula.netbox import netbox - -from nebula.common import LINUX_DEFAULT_PATH +from nebula.netconsole import netconsole +from nebula.network import network +from nebula.pdu import pdu +from nebula.tftpboot import tftpboot +from nebula.uart import uart if os.name in ["nt", "posix"] and os.path.exists(LINUX_DEFAULT_PATH): from nebula.usbmux import usbmux diff --git a/nebula/common.py b/nebula/common.py index a2744245..ce80c5c1 100644 --- a/nebula/common.py +++ b/nebula/common.py @@ -1,9 +1,10 @@ import logging import os -import nebula.errors as ne import yaml +import nebula.errors as ne + LINUX_DEFAULT_PATH = "/etc/default/nebula" WINDOWS_DEFAULT_PATH = "C:\\nebula\\nebula.yaml" diff --git a/nebula/downloader.py b/nebula/downloader.py index 5f790614..a11c643e 100644 --- a/nebula/downloader.py +++ b/nebula/downloader.py @@ -16,11 +16,12 @@ from artifactory import ArtifactoryPath from bs4 import BeautifulSoup from github import Github -from nebula.common import utils from requests.adapters import HTTPAdapter from requests.packages.urllib3.util.retry import Retry from tqdm import tqdm +from nebula.common import utils + log = logging.getLogger(__name__) diff --git a/nebula/fixtures.py b/nebula/fixtures.py index d9d5d994..fbb11a26 100644 --- a/nebula/fixtures.py +++ b/nebula/fixtures.py @@ -1,8 +1,9 @@ -import pytest -import os -import nebula import logging +import os +import pytest + +import nebula logging.getLogger().setLevel(logging.INFO) diff --git a/nebula/helper.py b/nebula/helper.py index fe8d1bc6..137987a7 100644 --- a/nebula/helper.py +++ b/nebula/helper.py @@ -4,9 +4,10 @@ import pathlib import click -import nebula.errors as ne import netifaces import yaml + +import nebula.errors as ne from nebula.common import multi_device_check from nebula.netbox import NetboxDevice, NetboxDevices, netbox diff --git a/nebula/main.py b/nebula/main.py index e2f07868..31f7d65a 100644 --- a/nebula/main.py +++ b/nebula/main.py @@ -1,4 +1,5 @@ from invoke import Collection, Program + from nebula import tasks program = Program(namespace=Collection.from_module(tasks), version="0.0.1") diff --git a/nebula/manager.py b/nebula/manager.py index 9b641c7e..e66cc944 100644 --- a/nebula/manager.py +++ b/nebula/manager.py @@ -4,10 +4,11 @@ import tarfile import time +import yaml + import nebula.common as common import nebula.errors as ne import nebula.helper as helper -import yaml from nebula.driver import driver from nebula.jtag import jtag from nebula.netconsole import netconsole @@ -322,7 +323,7 @@ def board_reboot_jtag_uart( # Check if u-boot loads first # log.info("Resetting with JTAG and checking if u-boot is reachable") # self.jtag.restart_board() - # do a power cylcle rather than jtag reboot to make sure jtag devices are working + # do a power cycle rather than jtag reboot to make sure jtag devices are working log.info("Resetting with JTAG and checking if u-boot is reachable") self.jtag.restart_board() if self.monitor[0]._enter_uboot_menu_from_power_cycle(): diff --git a/nebula/netbox.py b/nebula/netbox.py index 938805f9..5819041d 100644 --- a/nebula/netbox.py +++ b/nebula/netbox.py @@ -7,9 +7,10 @@ import pynetbox import yaml -from nebula.common import utils from numpy import isin +from nebula.common import utils + log = logging.getLogger(__name__) diff --git a/nebula/network.py b/nebula/network.py index bbef7f8f..c05dace5 100644 --- a/nebula/network.py +++ b/nebula/network.py @@ -8,8 +8,9 @@ import time import fabric -import nebula.errors as ne from fabric import Connection + +import nebula.errors as ne from nebula.common import utils log = logging.getLogger(__name__) diff --git a/nebula/pdu.py b/nebula/pdu.py index 8c55c010..76196f1c 100644 --- a/nebula/pdu.py +++ b/nebula/pdu.py @@ -1,9 +1,10 @@ import logging import time +from pyvesync_v2 import VeSync + from nebula import cyberpower as cpdu from nebula.common import utils -from pyvesync_v2 import VeSync log = logging.getLogger(__name__) diff --git a/nebula/resources/template_gen.yaml b/nebula/resources/template_gen.yaml index 88ce52e0..d2d34778 100644 --- a/nebula/resources/template_gen.yaml +++ b/nebula/resources/template_gen.yaml @@ -26,7 +26,7 @@ board-config: field_3: name: daughter default: FMCOMMS2-3 - help: "Daugther board name" + help: "Daughter board name" optional: False netbox_field: devices.custom_fields.device_daughter field_4: diff --git a/nebula/resources/template_rpi_gen.yaml b/nebula/resources/template_rpi_gen.yaml index 13f81d14..87d918f7 100644 --- a/nebula/resources/template_rpi_gen.yaml +++ b/nebula/resources/template_rpi_gen.yaml @@ -25,7 +25,7 @@ board-config: netbox_field: devices.custom_fields.device_carrier field_3: name: daughter - help: "Daugther board name" + help: "Daughter board name" optional: True netbox_field: devices.custom_fields.device_daughter field_4: diff --git a/nebula/tasks.py b/nebula/tasks.py index 6e7292f5..5799ac3d 100644 --- a/nebula/tasks.py +++ b/nebula/tasks.py @@ -3,10 +3,11 @@ import time from operator import truediv -import nebula import yaml from invoke import Collection, task +import nebula + logging.getLogger().setLevel(logging.WARNING) diff --git a/nebula/uart.py b/nebula/uart.py index dbb97970..481d34c3 100644 --- a/nebula/uart.py +++ b/nebula/uart.py @@ -9,9 +9,10 @@ import serial import xmodem -from nebula.common import utils from tqdm import tqdm +from nebula.common import utils + log = logging.getLogger(__name__) LINUX_SERIAL_FOLDER = "/dev/serial" diff --git a/nebula/usbmux.py b/nebula/usbmux.py index 362991dc..6d671b1f 100644 --- a/nebula/usbmux.py +++ b/nebula/usbmux.py @@ -9,9 +9,10 @@ from pathlib import Path import pyudev -from nebula.common import utils from usbsdmux import usbsdmux +from nebula.common import utils + log = logging.getLogger(__name__)