-
Notifications
You must be signed in to change notification settings - Fork 346
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3240 from c-po/spring-cleaning
T6199: spring cleaning - drop unused Python imports
- Loading branch information
Showing
141 changed files
with
226 additions
and
936 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
name: Pylint | ||
|
||
on: [push] | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
python-version: ["3.11"] | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v3 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install pylint | ||
- name: Analysing the code with pylint | ||
run: | | ||
make unused-imports |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
# Copyright 2017, 2019-2023 VyOS maintainers and contributors <[email protected]> | ||
# Copyright 2017-2024 VyOS maintainers and contributors <[email protected]> | ||
# | ||
# 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 @@ | |
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 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
# Copyright 2023 VyOS maintainers and contributors <[email protected]> | ||
# Copyright 2023-2024 VyOS maintainers and contributors <[email protected]> | ||
# | ||
# 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 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 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
# Copyright 2019-2022 VyOS maintainers and contributors <[email protected]> | ||
# Copyright 2019-2024 VyOS maintainers and contributors <[email protected]> | ||
# | ||
# 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'] | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
# Copyright 2020 VyOS maintainers and contributors <[email protected]> | ||
# Copyright 2020-2024 VyOS maintainers and contributors <[email protected]> | ||
# | ||
# 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 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
# Copyright 2020 VyOS maintainers and contributors <[email protected]> | ||
# Copyright 2020-2024 VyOS maintainers and contributors <[email protected]> | ||
# | ||
# 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 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 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
# Copyright 2019-2022 VyOS maintainers and contributors <[email protected]> | ||
# Copyright 2019-2024 VyOS maintainers and contributors <[email protected]> | ||
# | ||
# 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 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
# Copyright 2019-2023 VyOS maintainers and contributors <[email protected]> | ||
# Copyright 2019-2024 VyOS maintainers and contributors <[email protected]> | ||
# | ||
# 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 signal | ||
|
||
from time import time | ||
from time import sleep | ||
from tabulate import tabulate | ||
|
||
from vyos.configquery import ConfigTreeQuery | ||
|
@@ -155,4 +154,3 @@ def format(cls, data): | |
# add to the active list disabled instances | ||
groups.extend(cls.disabled()) | ||
return(tabulate(groups, headers)) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
# Copyright 2019-2023 VyOS maintainers and contributors <[email protected]> | ||
# Copyright 2019-2024 VyOS maintainers and contributors <[email protected]> | ||
# | ||
# 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 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
# Copyright 2019-2023 VyOS maintainers and contributors <[email protected]> | ||
# Copyright 2019-2024 VyOS maintainers and contributors <[email protected]> | ||
# | ||
# 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 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): | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
# Copyright 2019 VyOS maintainers and contributors <[email protected]> | ||
# Copyright 2019-2024 VyOS maintainers and contributors <[email protected]> | ||
# | ||
# 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 |
Oops, something went wrong.