diff options
author | Christian Poessinger <christian@poessinger.com> | 2020-04-09 07:39:12 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-04-09 07:39:12 +0200 |
commit | d7c1bab9b99689be5b99a5bdac3999229ea788ab (patch) | |
tree | de44f656e9017b8bc0fe97ae9bb61adfc1c7f018 /python/vyos | |
parent | b102408165037d57453ce4928b93958a54c69dcd (diff) | |
parent | a5d537d2ab3eadc2922a443de28ddd9b20dbb722 (diff) | |
download | vyos-1x-d7c1bab9b99689be5b99a5bdac3999229ea788ab.tar.gz vyos-1x-d7c1bab9b99689be5b99a5bdac3999229ea788ab.zip |
Merge pull request #316 from thomas-mangin/T2242
import: T2242: remove all import *
Diffstat (limited to 'python/vyos')
-rw-r--r-- | python/vyos/__init__.py | 2 | ||||
-rw-r--r-- | python/vyos/ifconfig/bond.py | 3 | ||||
-rw-r--r-- | python/vyos/ifconfig/bridge.py | 3 | ||||
-rw-r--r-- | python/vyos/ifconfig/ethernet.py | 2 | ||||
-rw-r--r-- | python/vyos/ifconfig/interface.py | 24 | ||||
-rw-r--r-- | python/vyos/ifconfig/stp.py | 2 | ||||
-rw-r--r-- | python/vyos/ioctl.py | 8 |
7 files changed, 28 insertions, 16 deletions
diff --git a/python/vyos/__init__.py b/python/vyos/__init__.py index 9b5ed21c9..e3e14fdd8 100644 --- a/python/vyos/__init__.py +++ b/python/vyos/__init__.py @@ -1 +1 @@ -from .base import * +from .base import ConfigError diff --git a/python/vyos/ifconfig/bond.py b/python/vyos/ifconfig/bond.py index e2ff71490..47dd4ff34 100644 --- a/python/vyos/ifconfig/bond.py +++ b/python/vyos/ifconfig/bond.py @@ -18,7 +18,8 @@ import os from vyos.ifconfig.interface import Interface from vyos.ifconfig.vlan import VLAN -from vyos.validate import * +from vyos.validate import assert_list +from vyos.validate import assert_positive @Interface.register diff --git a/python/vyos/ifconfig/bridge.py b/python/vyos/ifconfig/bridge.py index 94b0075d8..44b92c1db 100644 --- a/python/vyos/ifconfig/bridge.py +++ b/python/vyos/ifconfig/bridge.py @@ -16,7 +16,8 @@ from vyos.ifconfig.interface import Interface -from vyos.validate import * +from vyos.validate import assert_boolean +from vyos.validate import assert_positive @Interface.register diff --git a/python/vyos/ifconfig/ethernet.py b/python/vyos/ifconfig/ethernet.py index 291b326bf..542de4f59 100644 --- a/python/vyos/ifconfig/ethernet.py +++ b/python/vyos/ifconfig/ethernet.py @@ -18,8 +18,8 @@ import re from vyos.ifconfig.interface import Interface from vyos.ifconfig.vlan import VLAN +from vyos.validate import assert_list from vyos.util import run -from vyos.validate import * @Interface.register diff --git a/python/vyos/ifconfig/interface.py b/python/vyos/ifconfig/interface.py index 96057a943..22c71a464 100644 --- a/python/vyos/ifconfig/interface.py +++ b/python/vyos/ifconfig/interface.py @@ -18,21 +18,29 @@ import re import json import glob import time +from time import sleep +from os.path import isfile from copy import deepcopy +from datetime import timedelta -from vyos.validate import * # should not * include -from vyos.util import mac2eui64 -from vyos import ConfigError - +from hurry.filesize import size, alternative from ipaddress import IPv4Network, IPv6Address, IPv6Network from netifaces import ifaddresses, AF_INET, AF_INET6 -from time import sleep -from os.path import isfile from tabulate import tabulate -from hurry.filesize import size,alternative -from datetime import timedelta +from vyos.util import mac2eui64 +from vyos import ConfigError from vyos.ifconfig.dhcp import DHCP +from vyos.validate import is_ipv4 +from vyos.validate import is_ipv6 +from vyos.validate import is_intf_addr_assigned +from vyos.validate import assert_boolean +from vyos.validate import assert_list +from vyos.validate import assert_mac +from vyos.validate import assert_mtu +from vyos.validate import assert_positive +from vyos.validate import assert_range + class Interface(DHCP): options = [] diff --git a/python/vyos/ifconfig/stp.py b/python/vyos/ifconfig/stp.py index 97a3c1ff3..5e83206c2 100644 --- a/python/vyos/ifconfig/stp.py +++ b/python/vyos/ifconfig/stp.py @@ -16,7 +16,7 @@ from vyos.ifconfig.interface import Interface -from vyos.validate import * +from vyos.validate import assert_positive class STP: diff --git a/python/vyos/ioctl.py b/python/vyos/ioctl.py index e57d261e4..cfa75aac6 100644 --- a/python/vyos/ioctl.py +++ b/python/vyos/ioctl.py @@ -13,9 +13,11 @@ # 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 fcntl, struct, sys -from socket import * +import socket +import fcntl +import struct SIOCGIFFLAGS = 0x8913 @@ -28,7 +30,7 @@ def get_terminal_size(): def get_interface_flags(intf): """ Pull the SIOCGIFFLAGS """ nullif = '\0'*256 - sock = socket(AF_INET, SOCK_DGRAM) + sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) raw = fcntl.ioctl(sock.fileno(), SIOCGIFFLAGS, intf + nullif) flags, = struct.unpack('H', raw[16:18]) return flags |