diff --git a/gnpy/core/convert.py b/gnpy/core/convert.py index f2a51ae6..d26807b8 100755 --- a/gnpy/core/convert.py +++ b/gnpy/core/convert.py @@ -34,8 +34,7 @@ from difflib import get_close_matches from copy import copy from gnpy.core.utils import silent_remove from gnpy.core.exceptions import NetworkTopologyError -from gnpy.core.elements import Transceiver, Roadm, Edfa, Fused, Fiber -import time +from gnpy.core.elements import Edfa, Fused, Fiber all_rows = lambda sh, start=0: (sh.row(x) for x in range(start, sh.nrows)) diff --git a/gnpy/core/elements.py b/gnpy/core/elements.py index 3ba88213..d083aa5e 100644 --- a/gnpy/core/elements.py +++ b/gnpy/core/elements.py @@ -18,9 +18,9 @@ Network elements MUST implement two attributes .uid and .name representing a unique identifier and a printable name. ''' -from numpy import abs, arange, array, exp, divide, errstate, ones, squeeze -from numpy import interp, log10, mean, pi, polyfit, polyval, sum -from scipy.constants import c, h +from numpy import abs, arange, array, divide, errstate, ones +from numpy import interp, mean, pi, polyfit, polyval, sum +from scipy.constants import h from collections import namedtuple from gnpy.core.node import Node diff --git a/gnpy/core/equipment.py b/gnpy/core/equipment.py index 52b4ca64..c62728d9 100644 --- a/gnpy/core/equipment.py +++ b/gnpy/core/equipment.py @@ -8,8 +8,7 @@ gnpy.core.equipment This module contains functionality for specifying equipment. ''' -from numpy import clip, polyval -from operator import itemgetter +from numpy import clip from math import isclose from pathlib import Path from json import load diff --git a/gnpy/core/info.py b/gnpy/core/info.py index b662a18c..4f2923c6 100644 --- a/gnpy/core/info.py +++ b/gnpy/core/info.py @@ -10,11 +10,8 @@ This module contains classes for modelling :class:`SpectralInformation`. from collections import namedtuple -from numpy import array -from gnpy.core.utils import lin2db, db2lin -from json import loads -from gnpy.core.utils import load_json -from gnpy.core.equipment import automatic_nch, automatic_spacing +from gnpy.core.utils import lin2db +from gnpy.core.equipment import automatic_nch class Power(namedtuple('Power', 'signal nli ase')): """carriers power in W""" diff --git a/gnpy/core/network.py b/gnpy/core/network.py index b49d73de..306bd4e2 100644 --- a/gnpy/core/network.py +++ b/gnpy/core/network.py @@ -10,17 +10,16 @@ This module contains functions for constructing networks of network elements. from gnpy.core.convert import convert_file from networkx import DiGraph -from numpy import arange from scipy.interpolate import interp1d from logging import getLogger from os import path -from operator import itemgetter, attrgetter +from operator import attrgetter from gnpy.core import elements -from gnpy.core.elements import Fiber, Edfa, Transceiver, Roadm, Fused, RamanFiber +from gnpy.core.elements import Fiber, Edfa, Transceiver, Roadm, Fused from gnpy.core.equipment import edfa_nf from gnpy.core.exceptions import ConfigurationError, NetworkTopologyError from gnpy.core.units import UNITS -from gnpy.core.utils import (load_json, save_json, round2float, db2lin, merge_amplifier_restrictions) +from gnpy.core.utils import (load_json, save_json, round2float, merge_amplifier_restrictions) from collections import namedtuple logger = getLogger(__name__) diff --git a/gnpy/core/node.py b/gnpy/core/node.py index 9750e71d..15d7fe67 100644 --- a/gnpy/core/node.py +++ b/gnpy/core/node.py @@ -18,7 +18,6 @@ This base class provides a more convenient way to define a network element via subclassing. ''' -from uuid import uuid4 from collections import namedtuple class Location(namedtuple('Location', 'latitude longitude city region')): diff --git a/gnpy/core/request.py b/gnpy/core/request.py index a4599383..fe7ced15 100644 --- a/gnpy/core/request.py +++ b/gnpy/core/request.py @@ -16,17 +16,17 @@ See: draft-ietf-teas-yang-path-computation-01.txt """ from collections import namedtuple, OrderedDict -from logging import getLogger, basicConfig, CRITICAL, DEBUG, INFO +from logging import getLogger from networkx import (dijkstra_path, NetworkXNoPath, all_simple_paths) from networkx.utils import pairwise from numpy import mean -from gnpy.core.service_sheet import Request_element, Element -from gnpy.core.elements import Transceiver, Roadm, Edfa, Fused, Fiber -from gnpy.core.utils import db2lin, lin2db -from gnpy.core.info import create_input_spectral_information, SpectralInformation, Channel, Power +from gnpy.core.service_sheet import Element +from gnpy.core.elements import Transceiver, Roadm, Edfa +from gnpy.core.utils import lin2db +from gnpy.core.info import create_input_spectral_information from gnpy.core.exceptions import ServiceError, DisjunctionError import gnpy.core.ansi_escapes as ansi_escapes -from copy import copy, deepcopy +from copy import deepcopy from csv import writer from math import ceil diff --git a/gnpy/core/science_utils.py b/gnpy/core/science_utils.py index 0b9ec57a..9003eda9 100644 --- a/gnpy/core/science_utils.py +++ b/gnpy/core/science_utils.py @@ -8,7 +8,6 @@ from scipy.interpolate import interp1d from scipy.optimize import OptimizeResult from gnpy.core.utils import db2lin -from gnpy.core.parameters import SimParams logger = getLogger(__name__) diff --git a/gnpy/core/service_sheet.py b/gnpy/core/service_sheet.py index dc375b60..a8f2dfda 100644 --- a/gnpy/core/service_sheet.py +++ b/gnpy/core/service_sheet.py @@ -17,16 +17,13 @@ try: except ModuleNotFoundError: exit('Required: `pip install xlrd`') from collections import namedtuple -from logging import getLogger, basicConfig, CRITICAL, DEBUG, INFO +from logging import getLogger from json import dumps -from pathlib import Path from copy import deepcopy -from gnpy.core.equipment import load_equipment, automatic_nch -from gnpy.core.utils import db2lin, lin2db +from gnpy.core.utils import db2lin from gnpy.core.exceptions import ServiceError -from gnpy.core.network import load_network, build_network from gnpy.core.convert import corresp_names, corresp_next_node -from gnpy.core.elements import Transceiver, Roadm, Edfa, Fused, Fiber +from gnpy.core.elements import Transceiver, Roadm, Edfa, Fiber import gnpy.core.ansi_escapes as ansi_escapes SERVICES_COLUMN = 12