clean up unused Python imports (#454)

* Remove unused python imports

These changes have been auto-generated with:

	pip3 install isort autoflake
	isort -rc -sl .
	autoflake --remove-all-unused-imports -i -r .
	isort -rc -m 3 .

Signed-off-by: Radostin Stoyanov <rstoyanov@fedoraproject.org>

* python: remove redundant parenthesis

Signed-off-by: Radostin Stoyanov <rstoyanov@fedoraproject.org>
This commit is contained in:
Radostin Stoyanov
2022-02-24 16:31:53 +00:00
committed by GitHub
parent 50f397b249
commit d84179e42f
36 changed files with 176 additions and 170 deletions

View File

@@ -2,6 +2,7 @@ import subprocess
from shortest_path import ShortestPath
class AppController:
def __init__(self, manifest=None, target=None, topo=None, net=None, links=None):

View File

@@ -1,5 +1,6 @@
from mininet.topo import Topo
class AppTopo(Topo):
def __init__(self, links, latencies={}, manifest=None, target=None,

View File

@@ -15,25 +15,21 @@
# limitations under the License.
#
import signal
import os
import sys
import subprocess
import argparse
import json
import importlib
import json
import os
import re
import sys
from time import sleep
from mininet.net import Mininet
from mininet.topo import Topo
from mininet.link import TCLink
from mininet.log import setLogLevel, info
from mininet.cli import CLI
from p4_mininet import P4Switch, P4Host
import apptopo
import appcontroller
import apptopo
from mininet.cli import CLI
from mininet.link import TCLink
from mininet.log import setLogLevel
from mininet.net import Mininet
from p4_mininet import P4Host, P4Switch
parser = argparse.ArgumentParser(description='Mininet demo')
parser.add_argument('--behavioral-exe', help='Path to behavioral executable',

View File

@@ -13,15 +13,16 @@
# limitations under the License.
#
from mininet.net import Mininet
from mininet.node import Switch, Host
from mininet.log import setLogLevel, info, error, debug
from mininet.moduledeps import pathCheck
import os
import socket
import tempfile
from sys import exit
from time import sleep
import os
import tempfile
import socket
from mininet.log import debug, error, info
from mininet.moduledeps import pathCheck
from mininet.node import Host, Switch
class P4Host(Host):
def config(self, **params):

View File

@@ -15,17 +15,16 @@
# limitations under the License.
#
from mininet.net import Mininet
from mininet.topo import Topo
from mininet.log import setLogLevel, info
from mininet.cli import CLI
from p4_mininet import P4Switch, P4Host
import argparse
from subprocess import PIPE, Popen
from time import sleep
from mininet.cli import CLI
from mininet.log import setLogLevel
from mininet.net import Mininet
from mininet.topo import Topo
from p4_mininet import P4Host, P4Switch
parser = argparse.ArgumentParser(description='Mininet demo')
parser.add_argument('--behavioral-exe', help='Path to behavioral executable',
type=str, action="store", required=True)

View File

@@ -14,6 +14,8 @@
#
import psutil
def check_listening_on_port(port):
for c in psutil.net_connections(kind='inet'):
if c.status == 'LISTEN' and c.laddr[1] == port:

View File

@@ -13,16 +13,14 @@
# limitations under the License.
#
from mininet.net import Mininet
from mininet.node import Switch, Host
from mininet.log import setLogLevel, info, error, debug
from mininet.moduledeps import pathCheck
from sys import exit
import os
import tempfile
import socket
from sys import exit
from time import sleep
from mininet.log import debug, error, info
from mininet.moduledeps import pathCheck
from mininet.node import Host, Switch
from netstat import check_listening_on_port
SWITCH_START_TIMEOUT = 10 # seconds

View File

@@ -16,11 +16,11 @@
import argparse
from collections import OrderedDict
import json
import os
import sys
import tarfile
from collections import OrderedDict
parser = argparse.ArgumentParser(description='p4apprunner')
parser.add_argument('--build-dir', help='Directory to build in.',

View File

@@ -12,9 +12,10 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
from .switch import SwitchConnection
from p4.tmp import p4config_pb2
from .switch import SwitchConnection
def buildDeviceConfig(bmv2_json_file_path=None):
"Builds the device config for BMv2"

View File

@@ -12,11 +12,10 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
import math
import re
import socket
import math
'''
This package contains several helper functions for encoding to and decoding from byte strings:
- integers

View File

@@ -15,10 +15,10 @@
import sys
from google.rpc import status_pb2, code_pb2
import grpc
from google.rpc import code_pb2, status_pb2
from p4.v1 import p4runtime_pb2
from p4.v1 import p4runtime_pb2_grpc
# Used to indicate that the gRPC error Status object returned by the server has
# an incorrect format.

View File

@@ -15,11 +15,12 @@
import re
import google.protobuf.text_format
from p4.v1 import p4runtime_pb2
from p4.config.v1 import p4info_pb2
from p4.v1 import p4runtime_pb2
from .convert import encode
class P4InfoHelper(object):
def __init__(self, p4_info_filepath):
p4info = p4info_pb2.P4Info()

View File

@@ -19,11 +19,10 @@ import json
import os
import sys
from . import bmv2
from . import helper
from p4.config.v1 import p4info_pb2
from . import bmv2, helper
def error(msg):
print(' - ERROR! ' + msg, file=sys.stderr)

View File

@@ -12,14 +12,13 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
from queue import Queue
from abc import abstractmethod
from datetime import datetime
from queue import Queue
import grpc
from p4.v1 import p4runtime_pb2
from p4.v1 import p4runtime_pb2_grpc
from p4.tmp import p4config_pb2
from p4.v1 import p4runtime_pb2, p4runtime_pb2_grpc
MSG_LOG_MAX_LEN = 1024

View File

@@ -14,15 +14,16 @@
# limitations under the License.
#
import sys, os, tempfile, socket
import os
import tempfile
from time import sleep
from mininet.node import Switch
from mininet.log import debug, error, info
from mininet.moduledeps import pathCheck
from mininet.log import info, error, debug
from p4_mininet import P4Switch, SWITCH_START_TIMEOUT
from mininet.node import Switch
from netstat import check_listening_on_port
from p4_mininet import SWITCH_START_TIMEOUT, P4Switch
class P4RuntimeSwitch(P4Switch):
"BMv2 switch with gRPC support"

View File

@@ -19,18 +19,20 @@
# We encourage you to dissect this script to better understand the BMv2/Mininet
# environment used by the P4 tutorial.
#
import os, sys, json, subprocess, re, argparse
import argparse
import json
import os
import subprocess
from time import sleep
from p4_mininet import P4Switch, P4Host
import p4runtime_lib.simple_controller
from mininet.cli import CLI
from mininet.link import TCLink
from mininet.net import Mininet
from mininet.topo import Topo
from mininet.link import TCLink
from mininet.cli import CLI
from p4_mininet import P4Host, P4Switch
from p4runtime_switch import P4RuntimeSwitch
import p4runtime_lib.simple_controller
def configureP4Switch(**switch_args):
""" Helper class that is called by mininet to initialize