From ddc8b04203699430a33d2d78f27e8c3211def85e Mon Sep 17 00:00:00 2001 From: Christian Breunig Date: Tue, 31 Mar 2026 15:21:49 +0200 Subject: T8375: general import cleanup on the way to serial activation For the sake of nice grep lines and refactoring we have an unspoken - unwritten rule considered as folklore to have imports one per line. This helped in the past with refactorings. --- python/vyos/system/compat.py | 10 ++++++++-- python/vyos/system/grub.py | 12 ++++++++---- python/vyos/system/grub_util.py | 5 ++++- python/vyos/utils/serial.py | 4 +++- 4 files changed, 23 insertions(+), 8 deletions(-) (limited to 'python') diff --git a/python/vyos/system/compat.py b/python/vyos/system/compat.py index f4a50b237..24cad7041 100644 --- a/python/vyos/system/compat.py +++ b/python/vyos/system/compat.py @@ -14,12 +14,18 @@ # along with this library. If not, see . from pathlib import Path -from re import compile, MULTILINE, DOTALL +from re import compile +from re import MULTILINE +from re import DOTALL from functools import wraps from copy import deepcopy from typing import Union -from vyos.system import disk, grub, image, SYSTEM_CFG_VER +from vyos.flavor import get_image_serial_console +from vyos.system import disk +from vyos.system import grub +from vyos.system import image +from vyos.system import SYSTEM_CFG_VER from vyos.template import render TMPL_GRUB_COMPAT: str = 'grub/grub_compat.j2' diff --git a/python/vyos/system/grub.py b/python/vyos/system/grub.py index 0f04fa5e9..50651d20e 100644 --- a/python/vyos/system/grub.py +++ b/python/vyos/system/grub.py @@ -16,13 +16,17 @@ import platform from pathlib import Path -from re import MULTILINE, compile as re_compile +from re import MULTILINE +from re import compile as re_compile from shutil import copy2 -from uuid import uuid5, NAMESPACE_URL, UUID +from uuid import uuid5 +from uuid import NAMESPACE_URL +from uuid import UUID -from vyos.template import render -from vyos.utils.process import cmd, rc_cmd from vyos.system import disk +from vyos.template import render +from vyos.utils.process import cmd +from vyos.utils.process import rc_cmd # Define variables GRUB_DIR_MAIN: str = '/boot/grub' diff --git a/python/vyos/system/grub_util.py b/python/vyos/system/grub_util.py index e534334e6..344569168 100644 --- a/python/vyos/system/grub_util.py +++ b/python/vyos/system/grub_util.py @@ -13,7 +13,10 @@ # You should have received a copy of the GNU Lesser General Public License # along with this library. If not, see . -from vyos.system import disk, grub, image, compat +from vyos.system import disk +from vyos.system import grub +from vyos.system import image +from vyos.system import compat @compat.grub_cfg_update def set_console_speed(console_speed: str, root_dir: str = '') -> None: diff --git a/python/vyos/utils/serial.py b/python/vyos/utils/serial.py index 36b483e91..5d276fb17 100644 --- a/python/vyos/utils/serial.py +++ b/python/vyos/utils/serial.py @@ -13,7 +13,9 @@ # You should have received a copy of the GNU Lesser General Public # License along with this library. If not, see . -import os, re, json +import os +import re +import json from typing import List from vyos.base import Warning -- cgit v1.2.3