summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
Diffstat (limited to 'python')
-rw-r--r--python/vyos/accel_ppp.py7
-rw-r--r--python/vyos/config.py4
-rw-r--r--python/vyos/config_mgmt.py17
-rw-r--r--python/vyos/configdict.py4
-rw-r--r--python/vyos/configdiff.py6
-rw-r--r--python/vyos/configverify.py3
-rw-r--r--python/vyos/ethtool.py1
-rw-r--r--python/vyos/firewall.py3
-rw-r--r--python/vyos/frr.py3
-rw-r--r--python/vyos/ifconfig/bond.py3
-rw-r--r--python/vyos/ifconfig/interface.py1
-rw-r--r--python/vyos/ifconfig/vrrp.py4
-rw-r--r--python/vyos/ifconfig/vxlan.py5
-rw-r--r--python/vyos/ifconfig/wireguard.py3
-rw-r--r--python/vyos/iflag.py38
-rw-r--r--python/vyos/initialsetup.py4
-rw-r--r--python/vyos/ioctl.py5
-rw-r--r--python/vyos/kea.py3
-rw-r--r--python/vyos/progressbar.py4
-rw-r--r--python/vyos/qos/priority.py3
-rw-r--r--python/vyos/range_regex.py5
-rw-r--r--python/vyos/system/grub.py2
-rw-r--r--python/vyos/version.py6
-rwxr-xr-xpython/vyos/xml/generate.py7
-rw-r--r--python/vyos/xml/test_xml.py14
-rwxr-xr-xpython/vyos/xml_ref/generate_cache.py7
26 files changed, 57 insertions, 105 deletions
diff --git a/python/vyos/accel_ppp.py b/python/vyos/accel_ppp.py
index 0b4f8a9fe..a6f2ceb52 100644
--- a/python/vyos/accel_ppp.py
+++ b/python/vyos/accel_ppp.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python3
#
-# Copyright (C) 2022 VyOS maintainers and contributors
+# Copyright (C) 2022-2024 VyOS maintainers and contributors
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 or later as
@@ -13,14 +13,9 @@
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-#
-
-import sys
-import vyos.opmode
from vyos.utils.process import rc_cmd
-
def get_server_statistics(accel_statistics, pattern, sep=':') -> dict:
import re
diff --git a/python/vyos/config.py b/python/vyos/config.py
index 7619ad367..cca65f0eb 100644
--- a/python/vyos/config.py
+++ b/python/vyos/config.py
@@ -1,4 +1,4 @@
-# Copyright 2017, 2019-2023 VyOS maintainers and contributors <maintainers@vyos.io>
+# Copyright 2017-2024 VyOS maintainers and contributors <maintainers@vyos.io>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
@@ -60,12 +60,10 @@ In configuration mode, "base" functions like `exists`, `return_value` return val
while functions prefixed "effective" return values from the running config.
In operational mode, all functions return values from the running config.
-
"""
import re
import json
-from copy import deepcopy
from typing import Union
import vyos.configtree
diff --git a/python/vyos/config_mgmt.py b/python/vyos/config_mgmt.py
index 28ccee769..fc51d781c 100644
--- a/python/vyos/config_mgmt.py
+++ b/python/vyos/config_mgmt.py
@@ -1,4 +1,4 @@
-# Copyright 2023 VyOS maintainers and contributors <maintainers@vyos.io>
+# Copyright 2023-2024 VyOS maintainers and contributors <maintainers@vyos.io>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
@@ -19,18 +19,23 @@ import sys
import gzip
import logging
-from typing import Optional, Tuple, Union
+from typing import Optional
+from typing import Tuple
from filecmp import cmp
from datetime import datetime
-from textwrap import dedent, indent
+from textwrap import dedent
from pathlib import Path
from tabulate import tabulate
from shutil import copy, chown
-from urllib.parse import urlsplit, urlunsplit
+from urllib.parse import urlsplit
+from urllib.parse import urlunsplit
from vyos.config import Config
-from vyos.configtree import ConfigTree, ConfigTreeError, show_diff
-from vyos.load_config import load, LoadConfigError
+from vyos.configtree import ConfigTree
+from vyos.configtree import ConfigTreeError
+from vyos.configtree import show_diff
+from vyos.load_config import load
+from vyos.load_config import LoadConfigError
from vyos.defaults import directories
from vyos.version import get_full_version_data
from vyos.utils.io import ask_yes_no
diff --git a/python/vyos/configdict.py b/python/vyos/configdict.py
index cb9f0cbb8..870d7cfda 100644
--- a/python/vyos/configdict.py
+++ b/python/vyos/configdict.py
@@ -1,4 +1,4 @@
-# Copyright 2019-2022 VyOS maintainers and contributors <maintainers@vyos.io>
+# Copyright 2019-2024 VyOS maintainers and contributors <maintainers@vyos.io>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
@@ -203,8 +203,6 @@ def is_member(conf, interface, intftype=None):
empty -> Interface is not a member
key -> Interface is a member of this interface
"""
- from vyos.ifconfig import Section
-
ret_val = {}
intftypes = ['bonding', 'bridge']
diff --git a/python/vyos/configdiff.py b/python/vyos/configdiff.py
index 03b06c6d9..f975df45d 100644
--- a/python/vyos/configdiff.py
+++ b/python/vyos/configdiff.py
@@ -1,4 +1,4 @@
-# Copyright 2020 VyOS maintainers and contributors <maintainers@vyos.io>
+# Copyright 2020-2024 VyOS maintainers and contributors <maintainers@vyos.io>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
@@ -13,12 +13,12 @@
# You should have received a copy of the GNU Lesser General Public License
# along with this library. If not, see <http://www.gnu.org/licenses/>.
-from enum import IntFlag, auto
+from enum import IntFlag
+from enum import auto
from vyos.config import Config
from vyos.configtree import DiffTree
from vyos.configdict import dict_merge
-from vyos.configdict import list_diff
from vyos.utils.dict import get_sub_dict
from vyos.utils.dict import mangle_dict_keys
from vyos.utils.dict import dict_search_args
diff --git a/python/vyos/configverify.py b/python/vyos/configverify.py
index 55978ec9d..18642877a 100644
--- a/python/vyos/configverify.py
+++ b/python/vyos/configverify.py
@@ -23,8 +23,6 @@
from vyos import ConfigError
from vyos.utils.dict import dict_search
-from vyos.utils.dict import dict_search_recursive
-
# pattern re-used in ipsec migration script
dynamic_interface_pattern = r'(ppp|pppoe|sstpc|l2tp|ipoe)[0-9]+'
@@ -246,7 +244,6 @@ def verify_interface_exists(ifname, warning_only=False):
if the interface is defined on the CLI, if it's not found we try if
it exists at the OS level.
"""
- import os
from vyos.base import Warning
from vyos.configquery import ConfigTreeQuery
from vyos.utils.dict import dict_search_recursive
diff --git a/python/vyos/ethtool.py b/python/vyos/ethtool.py
index 5e241fc08..d45c9c272 100644
--- a/python/vyos/ethtool.py
+++ b/python/vyos/ethtool.py
@@ -13,7 +13,6 @@
# You should have received a copy of the GNU Lesser General Public
# License along with this library. If not, see <http://www.gnu.org/licenses/>.
-import os
import re
from json import loads
diff --git a/python/vyos/firewall.py b/python/vyos/firewall.py
index e29aeb0c6..0713eb370 100644
--- a/python/vyos/firewall.py
+++ b/python/vyos/firewall.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python3
#
-# Copyright (C) 2021-2023 VyOS maintainers and contributors
+# Copyright (C) 2021-2024 VyOS maintainers and contributors
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 or later as
@@ -30,7 +30,6 @@ from vyos.template import is_ipv4
from vyos.template import render
from vyos.utils.dict import dict_search_args
from vyos.utils.dict import dict_search_recursive
-from vyos.utils.process import call
from vyos.utils.process import cmd
from vyos.utils.process import run
diff --git a/python/vyos/frr.py b/python/vyos/frr.py
index c3703cbb4..e7743e9d5 100644
--- a/python/vyos/frr.py
+++ b/python/vyos/frr.py
@@ -1,4 +1,4 @@
-# Copyright 2020 VyOS maintainers and contributors <maintainers@vyos.io>
+# Copyright 2020-2024 VyOS maintainers and contributors <maintainers@vyos.io>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
@@ -69,7 +69,6 @@ import tempfile
import re
from vyos import ConfigError
-from vyos.utils.permission import chown
from vyos.utils.process import cmd
from vyos.utils.process import popen
from vyos.utils.process import STDOUT
diff --git a/python/vyos/ifconfig/bond.py b/python/vyos/ifconfig/bond.py
index 45e6e4c16..c6d0f1cff 100644
--- a/python/vyos/ifconfig/bond.py
+++ b/python/vyos/ifconfig/bond.py
@@ -1,4 +1,4 @@
-# Copyright 2019-2022 VyOS maintainers and contributors <maintainers@vyos.io>
+# Copyright 2019-2024 VyOS maintainers and contributors <maintainers@vyos.io>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
@@ -16,7 +16,6 @@
import os
from vyos.ifconfig.interface import Interface
-from vyos.utils.process import cmd
from vyos.utils.dict import dict_search
from vyos.utils.assertion import assert_list
from vyos.utils.assertion import assert_positive
diff --git a/python/vyos/ifconfig/interface.py b/python/vyos/ifconfig/interface.py
index b2cb621bc..1b86982c4 100644
--- a/python/vyos/ifconfig/interface.py
+++ b/python/vyos/ifconfig/interface.py
@@ -35,7 +35,6 @@ from vyos.defaults import directories
from vyos.template import render
from vyos.utils.network import mac2eui64
from vyos.utils.dict import dict_search
-from vyos.utils.file import read_file
from vyos.utils.network import get_interface_config
from vyos.utils.network import get_interface_namespace
from vyos.utils.network import is_netns_interface
diff --git a/python/vyos/ifconfig/vrrp.py b/python/vyos/ifconfig/vrrp.py
index fde903a53..ee9336d1a 100644
--- a/python/vyos/ifconfig/vrrp.py
+++ b/python/vyos/ifconfig/vrrp.py
@@ -1,4 +1,4 @@
-# Copyright 2019-2023 VyOS maintainers and contributors <maintainers@vyos.io>
+# Copyright 2019-2024 VyOS maintainers and contributors <maintainers@vyos.io>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
@@ -18,7 +18,6 @@ import json
import signal
from time import time
-from time import sleep
from tabulate import tabulate
from vyos.configquery import ConfigTreeQuery
@@ -155,4 +154,3 @@ class VRRP(object):
# add to the active list disabled instances
groups.extend(cls.disabled())
return(tabulate(groups, headers))
-
diff --git a/python/vyos/ifconfig/vxlan.py b/python/vyos/ifconfig/vxlan.py
index a2c4aad50..bdb48e303 100644
--- a/python/vyos/ifconfig/vxlan.py
+++ b/python/vyos/ifconfig/vxlan.py
@@ -1,4 +1,4 @@
-# Copyright 2019-2023 VyOS maintainers and contributors <maintainers@vyos.io>
+# Copyright 2019-2024 VyOS maintainers and contributors <maintainers@vyos.io>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
@@ -13,9 +13,6 @@
# You should have received a copy of the GNU Lesser General Public
# License along with this library. If not, see <http://www.gnu.org/licenses/>.
-from json import loads
-
-from vyos import ConfigError
from vyos.configdict import list_diff
from vyos.ifconfig import Interface
from vyos.utils.assertion import assert_list
diff --git a/python/vyos/ifconfig/wireguard.py b/python/vyos/ifconfig/wireguard.py
index 5704f8b64..5b5f25323 100644
--- a/python/vyos/ifconfig/wireguard.py
+++ b/python/vyos/ifconfig/wireguard.py
@@ -1,4 +1,4 @@
-# Copyright 2019-2023 VyOS maintainers and contributors <maintainers@vyos.io>
+# Copyright 2019-2024 VyOS maintainers and contributors <maintainers@vyos.io>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
@@ -25,7 +25,6 @@ from hurry.filesize import alternative
from vyos.ifconfig import Interface
from vyos.ifconfig import Operational
from vyos.template import is_ipv6
-from vyos.base import Warning
class WireGuardOperational(Operational):
def _dump(self):
diff --git a/python/vyos/iflag.py b/python/vyos/iflag.py
index 7ff8e5623..3ce73c1bf 100644
--- a/python/vyos/iflag.py
+++ b/python/vyos/iflag.py
@@ -1,4 +1,4 @@
-# Copyright 2019 VyOS maintainers and contributors <maintainers@vyos.io>
+# Copyright 2019-2024 VyOS maintainers and contributors <maintainers@vyos.io>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
@@ -13,26 +13,24 @@
# You should have received a copy of the GNU Lesser General Public
# License along with this library. If not, see <http://www.gnu.org/licenses/>.
-from enum import Enum, unique, IntEnum
-
+from enum import IntEnum
class IFlag(IntEnum):
""" net/if.h interface flags """
- IFF_UP = 0x1 #: Interface up/down status
- IFF_BROADCAST = 0x2 #: Broadcast address valid
- IFF_DEBUG = 0x4, #: Debugging
- IFF_LOOPBACK = 0x8 #: Is loopback network
- IFF_POINTOPOINT = 0x10 #: Is point-to-point link
- IFF_NOTRAILERS = 0x20 #: Avoid use of trailers
- IFF_RUNNING = 0x40 #: Resources allocated
- IFF_NOARP = 0x80 #: No address resolution protocol
- IFF_PROMISC = 0x100 #: Promiscuous mode
- IFF_ALLMULTI = 0x200 #: Receive all multicast
- IFF_MASTER = 0x400 #: Load balancer master
- IFF_SLAVE = 0x800 #: Load balancer slave
- IFF_MULTICAST = 0x1000 #: Supports multicast
- IFF_PORTSEL = 0x2000 #: Media type adjustable
- IFF_AUTOMEDIA = 0x4000 #: Automatic media type enabled
- IFF_DYNAMIC = 0x8000 #: Is a dial-up device with dynamic address
-
+ IFF_UP = 0x1 #: Interface up/down status
+ IFF_BROADCAST = 0x2 #: Broadcast address valid
+ IFF_DEBUG = 0x4, #: Debugging
+ IFF_LOOPBACK = 0x8 #: Is loopback network
+ IFF_POINTOPOINT = 0x10 #: Is point-to-point link
+ IFF_NOTRAILERS = 0x20 #: Avoid use of trailers
+ IFF_RUNNING = 0x40 #: Resources allocated
+ IFF_NOARP = 0x80 #: No address resolution protocol
+ IFF_PROMISC = 0x100 #: Promiscuous mode
+ IFF_ALLMULTI = 0x200 #: Receive all multicast
+ IFF_MASTER = 0x400 #: Load balancer master
+ IFF_SLAVE = 0x800 #: Load balancer slave
+ IFF_MULTICAST = 0x1000 #: Supports multicast
+ IFF_PORTSEL = 0x2000 #: Media type adjustable
+ IFF_AUTOMEDIA = 0x4000 #: Automatic media type enabled
+ IFF_DYNAMIC = 0x8000 #: Is a dial-up device with dynamic address
diff --git a/python/vyos/initialsetup.py b/python/vyos/initialsetup.py
index 3b280dc6b..cb6b9e459 100644
--- a/python/vyos/initialsetup.py
+++ b/python/vyos/initialsetup.py
@@ -1,7 +1,7 @@
# initialsetup -- functions for setting common values in config file,
# for use in installation and first boot scripts
#
-# Copyright (C) 2018-2023 VyOS maintainers and contributors
+# Copyright (C) 2018-2024 VyOS maintainers and contributors
#
# This library is free software; you can redistribute it and/or modify it under the terms of
# the GNU Lesser General Public License as published by the Free Software Foundation;
@@ -14,8 +14,6 @@
# You should have received a copy of the GNU Lesser General Public License along with this library;
# if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-import vyos.configtree
-
from vyos.utils.auth import make_password_hash
from vyos.utils.auth import split_ssh_public_key
diff --git a/python/vyos/ioctl.py b/python/vyos/ioctl.py
index cfa75aac6..51574c1db 100644
--- a/python/vyos/ioctl.py
+++ b/python/vyos/ioctl.py
@@ -1,4 +1,4 @@
-# Copyright 2019 VyOS maintainers and contributors <maintainers@vyos.io>
+# Copyright 2019-2024 VyOS maintainers and contributors <maintainers@vyos.io>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
@@ -13,7 +13,6 @@
# You should have received a copy of the GNU Lesser General Public
# License along with this library. If not, see <http://www.gnu.org/licenses/>.
-import sys
import os
import socket
import fcntl
@@ -29,7 +28,7 @@ def get_terminal_size():
def get_interface_flags(intf):
""" Pull the SIOCGIFFLAGS """
- nullif = '\0'*256
+ nullif = '\0'*256
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
raw = fcntl.ioctl(sock.fileno(), SIOCGIFFLAGS, intf + nullif)
flags, = struct.unpack('H', raw[16:18])
diff --git a/python/vyos/kea.py b/python/vyos/kea.py
index 89ae7ca81..addfdba49 100644
--- a/python/vyos/kea.py
+++ b/python/vyos/kea.py
@@ -1,4 +1,4 @@
-# Copyright 2023 VyOS maintainers and contributors <maintainers@vyos.io>
+# Copyright 2023-2024 VyOS maintainers and contributors <maintainers@vyos.io>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
@@ -22,7 +22,6 @@ from vyos.template import isc_static_route
from vyos.template import netmask_from_cidr
from vyos.utils.dict import dict_search_args
from vyos.utils.file import file_permissions
-from vyos.utils.file import read_file
from vyos.utils.process import run
kea4_options = {
diff --git a/python/vyos/progressbar.py b/python/vyos/progressbar.py
index 7bc9d9856..8d1042672 100644
--- a/python/vyos/progressbar.py
+++ b/python/vyos/progressbar.py
@@ -1,4 +1,4 @@
-# Copyright 2023 VyOS maintainers and contributors <maintainers@vyos.io>
+# Copyright 2023-2024 VyOS maintainers and contributors <maintainers@vyos.io>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
@@ -17,12 +17,10 @@ import math
import os
import signal
import subprocess
-import sys
from vyos.utils.io import is_dumb_terminal
from vyos.utils.io import print_error
-
class Progressbar:
def __init__(self, step=None):
self.total = 0.0
diff --git a/python/vyos/qos/priority.py b/python/vyos/qos/priority.py
index 8182400f9..7f0a67032 100644
--- a/python/vyos/qos/priority.py
+++ b/python/vyos/qos/priority.py
@@ -1,4 +1,4 @@
-# Copyright 2022 VyOS maintainers and contributors <maintainers@vyos.io>
+# Copyright 2022-2024 VyOS maintainers and contributors <maintainers@vyos.io>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
@@ -14,7 +14,6 @@
# License along with this library. If not, see <http://www.gnu.org/licenses/>.
from vyos.qos.base import QoSBase
-from vyos.utils.dict import dict_search
class Priority(QoSBase):
_parent = 1
diff --git a/python/vyos/range_regex.py b/python/vyos/range_regex.py
index a8190d140..81e9d2e7e 100644
--- a/python/vyos/range_regex.py
+++ b/python/vyos/range_regex.py
@@ -22,7 +22,6 @@ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
'''
-import math
# coding=utf8
@@ -67,7 +66,7 @@ def regex_for_range(min_, max_):
min_ = 0
if max_ >= 0:
- positive_subpatterns = split_to_patterns(min_, max_)
+ positive_subpatterns = split_to_patterns(min_, max_)
negative_only_subpatterns = ['-' + val for val in negative_subpatterns if val not in positive_subpatterns]
positive_only_subpatterns = [val for val in positive_subpatterns if val not in negative_subpatterns]
@@ -139,4 +138,4 @@ def range_to_pattern(start, stop):
if any_digit_count > 1:
pattern += '{{{}}}'.format(any_digit_count)
- return pattern \ No newline at end of file
+ return pattern
diff --git a/python/vyos/system/grub.py b/python/vyos/system/grub.py
index 5ab9d76f0..faf68c2d1 100644
--- a/python/vyos/system/grub.py
+++ b/python/vyos/system/grub.py
@@ -18,7 +18,6 @@ import platform
from pathlib import Path
from re import MULTILINE, compile as re_compile
from shutil import copy2
-from typing import Union
from uuid import uuid5, NAMESPACE_URL, UUID
from vyos.template import render
@@ -463,4 +462,3 @@ def sort_inodes(dir_path: str) -> None:
for item in temp_list_new:
new_name = Path(f'{item.as_posix()[0:-4]}')
item.rename(new_name)
-
diff --git a/python/vyos/version.py b/python/vyos/version.py
index 1c5651c83..b5ed2705b 100644
--- a/python/vyos/version.py
+++ b/python/vyos/version.py
@@ -1,4 +1,4 @@
-# Copyright 2017-2023 VyOS maintainers and contributors <maintainers@vyos.io>
+# Copyright 2017-2024 VyOS maintainers and contributors <maintainers@vyos.io>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
@@ -30,7 +30,7 @@ Example of the version data dict::
"""
import os
-import json
+
import requests
import vyos.defaults
@@ -40,10 +40,8 @@ from vyos.utils.process import popen
from vyos.utils.process import run
from vyos.utils.process import DEVNULL
-
version_file = os.path.join(vyos.defaults.directories['data'], 'version.json')
-
def get_version_data(fname=version_file):
"""
Get complete version data
diff --git a/python/vyos/xml/generate.py b/python/vyos/xml/generate.py
index dfbbadd74..267cb84f6 100755
--- a/python/vyos/xml/generate.py
+++ b/python/vyos/xml/generate.py
@@ -1,7 +1,7 @@
#!/usr/bin/env python3
-# Copyright (C) 2020 VyOS maintainers and contributors
+# Copyright (C) 2020-2024 VyOS maintainers and contributors
#
# This library is free software; you can redistribute it and/or modify it under the terms of
# the GNU Lesser General Public License as published by the Free Software Foundation;
@@ -12,17 +12,14 @@
# See the GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License along with this library;
-# if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
import os
-import sys
import pprint
import argparse
-from vyos.xml import kw
from vyos.xml import load
-
# import json
# def save_json(fname, loaded):
# with open(fname, 'w') as w:
diff --git a/python/vyos/xml/test_xml.py b/python/vyos/xml/test_xml.py
index 3a6f0132d..50fdc7470 100644
--- a/python/vyos/xml/test_xml.py
+++ b/python/vyos/xml/test_xml.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python3
#
-# Copyright (C) 2020 VyOS maintainers and contributors
+# Copyright (C) 2020-2024 VyOS maintainers and contributors
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 or later as
@@ -13,22 +13,14 @@
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-#
-#
-
-import os
-import unittest
-from unittest import TestCase, mock
+from unittest import TestCase
from vyos.xml import load_configuration
-import sys
-
-
class TestSearch(TestCase):
def setUp(self):
self.xml = load_configuration()
-
+
def test_(self):
last = self.xml.traverse("")
self.assertEqual(last, '')
diff --git a/python/vyos/xml_ref/generate_cache.py b/python/vyos/xml_ref/generate_cache.py
index d1ccb0f81..5f3f84dee 100755
--- a/python/vyos/xml_ref/generate_cache.py
+++ b/python/vyos/xml_ref/generate_cache.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python3
#
-# Copyright (C) 2023 VyOS maintainers and contributors
+# Copyright (C) 2023-2024 VyOS maintainers and contributors
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 or later as
@@ -13,19 +13,14 @@
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-#
-#
import sys
import json
from argparse import ArgumentParser
from argparse import ArgumentTypeError
-from os import getcwd
-from os import makedirs
from os.path import join
from os.path import abspath
from os.path import dirname
-from os.path import basename
from xmltodict import parse
_here = dirname(__file__)