From e34a71b448f63cdf32c9d76b953cc3b5d052de3a Mon Sep 17 00:00:00 2001 From: Paul Romano Date: Tue, 31 Mar 2020 18:11:31 -0500 Subject: [PATCH] Remove unused imports across entire Python API --- openmc/arithmetic.py | 1 - openmc/cell.py | 4 +--- openmc/cmfd.py | 1 - openmc/data/ace.py | 3 +-- openmc/data/angle_energy.py | 1 - openmc/data/decay.py | 4 +--- openmc/data/endf.py | 10 ++-------- openmc/data/fission_energy.py | 4 ---- openmc/data/laboratory.py | 2 +- openmc/data/multipole.py | 2 +- openmc/data/photon.py | 3 +-- openmc/data/product.py | 2 -- openmc/data/reaction.py | 2 +- openmc/data/resonance.py | 1 - openmc/deplete/reaction_rates.py | 2 -- openmc/deplete/results.py | 1 - openmc/element.py | 1 - openmc/filter.py | 1 - openmc/filter_expansion.py | 3 --- openmc/geometry.py | 2 -- openmc/lattice.py | 1 - openmc/lib/cell.py | 1 - openmc/lib/core.py | 4 +--- openmc/lib/mesh.py | 4 +--- openmc/lib/nuclide.py | 3 --- openmc/lib/settings.py | 4 +--- openmc/material.py | 2 +- openmc/mesh.py | 3 +-- openmc/mgxs/groups.py | 1 - openmc/mgxs/library.py | 1 - openmc/mgxs/mdgxs.py | 4 ---- openmc/model/funcs.py | 4 ++-- openmc/nuclide.py | 2 -- openmc/openmoc_compatible.py | 3 --- openmc/plots.py | 2 -- openmc/polynomial.py | 6 +++--- openmc/region.py | 2 +- openmc/settings.py | 4 ---- openmc/source.py | 1 - openmc/stats/multivariate.py | 1 - openmc/stats/univariate.py | 1 - openmc/summary.py | 1 - openmc/tallies.py | 2 -- openmc/tally_derivative.py | 1 - openmc/trigger.py | 2 -- openmc/universe.py | 3 +-- 46 files changed, 21 insertions(+), 92 deletions(-) diff --git a/openmc/arithmetic.py b/openmc/arithmetic.py index 70c74066d..6a9700d79 100644 --- a/openmc/arithmetic.py +++ b/openmc/arithmetic.py @@ -1,4 +1,3 @@ -import sys import copy from collections.abc import Iterable diff --git a/openmc/cell.py b/openmc/cell.py index 426a502e0..ec0e415cd 100644 --- a/openmc/cell.py +++ b/openmc/cell.py @@ -5,15 +5,13 @@ from math import cos, sin, pi from numbers import Real from xml.etree import ElementTree as ET from uncertainties import UFloat -import sys -import warnings import numpy as np import openmc import openmc.checkvalue as cv from openmc.surface import Halfspace -from openmc.region import Region, Intersection, Complement +from openmc.region import Region, Complement from openmc._xml import get_text from .mixin import IDManagerMixin diff --git a/openmc/cmfd.py b/openmc/cmfd.py index 476ff0b30..a02a76387 100644 --- a/openmc/cmfd.py +++ b/openmc/cmfd.py @@ -15,7 +15,6 @@ from collections.abc import Iterable, Mapping from numbers import Real, Integral import sys import time -from ctypes import c_int import warnings import numpy as np diff --git a/openmc/data/ace.py b/openmc/data/ace.py index 3de3853ed..7d60d082e 100644 --- a/openmc/data/ace.py +++ b/openmc/data/ace.py @@ -17,9 +17,8 @@ generates ACE-format cross sections. from collections import OrderedDict import enum -from pathlib import PurePath, Path +from pathlib import Path import struct -import sys import numpy as np diff --git a/openmc/data/angle_energy.py b/openmc/data/angle_energy.py index 8cf9bcf5e..e460575d2 100644 --- a/openmc/data/angle_energy.py +++ b/openmc/data/angle_energy.py @@ -1,5 +1,4 @@ from abc import ABCMeta, abstractmethod -from io import StringIO import openmc.data from openmc.mixin import EqualityMixin diff --git a/openmc/data/decay.py b/openmc/data/decay.py index 9134b4829..505d72cf0 100644 --- a/openmc/data/decay.py +++ b/openmc/data/decay.py @@ -1,13 +1,11 @@ -from collections import namedtuple from collections.abc import Iterable from io import StringIO from math import log -from numbers import Real import re from warnings import warn import numpy as np -from uncertainties import ufloat, unumpy, UFloat +from uncertainties import ufloat, UFloat import openmc.checkvalue as cv from openmc.mixin import EqualityMixin diff --git a/openmc/data/endf.py b/openmc/data/endf.py index 8fe5c3bfa..51349c0be 100644 --- a/openmc/data/endf.py +++ b/openmc/data/endf.py @@ -8,18 +8,12 @@ http://www-nds.iaea.org/ndspub/documents/endf/endf102/endf102.pdf """ import io import re -import os -from math import pi from pathlib import PurePath -from collections import OrderedDict -from collections.abc import Iterable import numpy as np -from numpy.polynomial.polynomial import Polynomial -from .data import ATOMIC_SYMBOL, gnd_name -from .function import Tabulated1D, INTERPOLATION_SCHEME -from openmc.stats.univariate import Uniform, Tabular, Legendre +from .data import gnd_name +from .function import Tabulated1D try: from ._endf import float_endf _CYTHON = True diff --git a/openmc/data/fission_energy.py b/openmc/data/fission_energy.py index 95915650b..17cb6d9ce 100644 --- a/openmc/data/fission_energy.py +++ b/openmc/data/fission_energy.py @@ -1,10 +1,6 @@ from collections.abc import Callable from copy import deepcopy from io import StringIO -import sys - -import h5py -import numpy as np from .data import EV_PER_MEV from .endf import get_cont_record, get_list_record, get_tab1_record, Evaluation diff --git a/openmc/data/laboratory.py b/openmc/data/laboratory.py index 10403655d..87d9d2961 100644 --- a/openmc/data/laboratory.py +++ b/openmc/data/laboratory.py @@ -4,7 +4,7 @@ from numbers import Real, Integral import numpy as np import openmc.checkvalue as cv -from openmc.stats import Tabular, Univariate, Discrete +from openmc.stats import Tabular, Univariate from .angle_energy import AngleEnergy from .endf import get_tab2_record, get_tab1_record diff --git a/openmc/data/multipole.py b/openmc/data/multipole.py index 6178161ef..91f49e15f 100644 --- a/openmc/data/multipole.py +++ b/openmc/data/multipole.py @@ -1,4 +1,4 @@ -from numbers import Integral, Real +from numbers import Real from math import exp, erf, pi, sqrt import h5py diff --git a/openmc/data/photon.py b/openmc/data/photon.py index 9cc697b78..555fd783e 100644 --- a/openmc/data/photon.py +++ b/openmc/data/photon.py @@ -3,14 +3,13 @@ from collections.abc import Mapping, Callable from copy import deepcopy from io import StringIO from numbers import Integral, Real -from math import pi, sqrt +from math import pi import os import h5py import numpy as np import pandas as pd from scipy.interpolate import CubicSpline -from scipy.integrate import quad from openmc.mixin import EqualityMixin import openmc.checkvalue as cv diff --git a/openmc/data/product.py b/openmc/data/product.py index a6ea17bf9..f7778cfa9 100644 --- a/openmc/data/product.py +++ b/openmc/data/product.py @@ -1,7 +1,5 @@ from collections.abc import Iterable -from io import StringIO from numbers import Real -import sys import numpy as np diff --git a/openmc/data/reaction.py b/openmc/data/reaction.py index de2e5e924..73e666941 100644 --- a/openmc/data/reaction.py +++ b/openmc/data/reaction.py @@ -1,6 +1,6 @@ from collections.abc import Iterable, Callable, MutableMapping from copy import deepcopy -from numbers import Real, Integral +from numbers import Real from warnings import warn from io import StringIO diff --git a/openmc/data/resonance.py b/openmc/data/resonance.py index aa79aafa1..d7f35e3ea 100644 --- a/openmc/data/resonance.py +++ b/openmc/data/resonance.py @@ -1,4 +1,3 @@ -from collections import defaultdict from collections.abc import MutableSequence, Iterable import io diff --git a/openmc/deplete/reaction_rates.py b/openmc/deplete/reaction_rates.py index b1dc5b13f..299f1133f 100644 --- a/openmc/deplete/reaction_rates.py +++ b/openmc/deplete/reaction_rates.py @@ -2,8 +2,6 @@ An ndarray to store reaction rates with string, integer, or slice indexing. """ -from collections import OrderedDict - import numpy as np diff --git a/openmc/deplete/results.py b/openmc/deplete/results.py index 28b489d1f..37d0df7c0 100644 --- a/openmc/deplete/results.py +++ b/openmc/deplete/results.py @@ -5,7 +5,6 @@ Contains results generation and saving capabilities. from collections import OrderedDict import copy -from warnings import warn import numpy as np import h5py diff --git a/openmc/element.py b/openmc/element.py index a8e344ddf..69bd03ae6 100644 --- a/openmc/element.py +++ b/openmc/element.py @@ -4,7 +4,6 @@ import os from xml.etree import ElementTree as ET import openmc.checkvalue as cv -from numbers import Real from openmc.data import NATURAL_ABUNDANCE, atomic_mass diff --git a/openmc/filter.py b/openmc/filter.py index 7af029150..80827c6a4 100644 --- a/openmc/filter.py +++ b/openmc/filter.py @@ -1,7 +1,6 @@ from abc import ABCMeta from collections import OrderedDict from collections.abc import Iterable -import copy import hashlib from itertools import product from numbers import Real, Integral diff --git a/openmc/filter_expansion.py b/openmc/filter_expansion.py index cc085df8a..c26d5437b 100644 --- a/openmc/filter_expansion.py +++ b/openmc/filter_expansion.py @@ -1,9 +1,6 @@ from numbers import Integral, Real from xml.etree import ElementTree as ET -import numpy as np -import pandas as pd - import openmc.checkvalue as cv from . import Filter diff --git a/openmc/geometry.py b/openmc/geometry.py index c3d2cd76b..845ad8dc3 100644 --- a/openmc/geometry.py +++ b/openmc/geometry.py @@ -4,8 +4,6 @@ from copy import deepcopy from pathlib import Path from xml.etree import ElementTree as ET -import numpy as np - import openmc import openmc._xml as xml from openmc.checkvalue import check_type diff --git a/openmc/lattice.py b/openmc/lattice.py index 782664a29..97b6a6bf5 100644 --- a/openmc/lattice.py +++ b/openmc/lattice.py @@ -7,7 +7,6 @@ from numbers import Real from xml.etree import ElementTree as ET import numpy as np -import warnings import types import openmc.checkvalue as cv diff --git a/openmc/lib/cell.py b/openmc/lib/cell.py index 57946818d..e50c885d8 100644 --- a/openmc/lib/cell.py +++ b/openmc/lib/cell.py @@ -5,7 +5,6 @@ from ctypes import c_int, c_int32, c_double, c_char_p, POINTER from weakref import WeakValueDictionary import numpy as np -from numpy.ctypeslib import as_array from openmc.exceptions import AllocationError, InvalidIDError from . import _dll diff --git a/openmc/lib/core.py b/openmc/lib/core.py index d0fd41e6f..e83d6f106 100644 --- a/openmc/lib/core.py +++ b/openmc/lib/core.py @@ -1,14 +1,12 @@ import sys from contextlib import contextmanager -from ctypes import (CDLL, c_bool, c_int, c_int32, c_int64, c_double, c_char_p, +from ctypes import (c_bool, c_int, c_int32, c_int64, c_double, c_char_p, c_char, POINTER, Structure, c_void_p, create_string_buffer) -from warnings import warn import numpy as np from numpy.ctypeslib import as_array -from openmc.exceptions import AllocationError from . import _dll from .error import _error_handler import openmc.lib diff --git a/openmc/lib/mesh.py b/openmc/lib/mesh.py index bf51bdfe9..db138f3a2 100644 --- a/openmc/lib/mesh.py +++ b/openmc/lib/mesh.py @@ -1,15 +1,13 @@ -from collections.abc import Mapping, Iterable +from collections.abc import Mapping from ctypes import c_int, c_int32, c_double, POINTER from weakref import WeakValueDictionary -import numpy as np from numpy.ctypeslib import as_array from openmc.exceptions import AllocationError, InvalidIDError from . import _dll from .core import _FortranObjectWithID from .error import _error_handler -from .material import Material __all__ = ['RegularMesh', 'meshes'] diff --git a/openmc/lib/nuclide.py b/openmc/lib/nuclide.py index 81ef7e648..8714608d2 100644 --- a/openmc/lib/nuclide.py +++ b/openmc/lib/nuclide.py @@ -2,9 +2,6 @@ from collections.abc import Mapping from ctypes import c_int, c_char_p, POINTER, c_size_t from weakref import WeakValueDictionary -import numpy as np -from numpy.ctypeslib import as_array - from openmc.exceptions import DataError, AllocationError from . import _dll from .core import _FortranObject diff --git a/openmc/lib/settings.py b/openmc/lib/settings.py index 104bfdd93..b63b355e4 100644 --- a/openmc/lib/settings.py +++ b/openmc/lib/settings.py @@ -1,9 +1,7 @@ -from ctypes import (c_int, c_int32, c_int64, c_double, c_char_p, c_bool, - POINTER) +from ctypes import c_int, c_int32, c_int64, c_double, c_char_p, c_bool from . import _dll from .core import _DLLGlobal -from .error import _error_handler _RUN_MODES = {1: 'fixed source', 2: 'eigenvalue', diff --git a/openmc/material.py b/openmc/material.py index ee50287c7..a950569bf 100644 --- a/openmc/material.py +++ b/openmc/material.py @@ -1,7 +1,7 @@ from collections import OrderedDict, defaultdict, namedtuple, Counter from collections.abc import Iterable from copy import deepcopy -from numbers import Real, Integral +from numbers import Real from pathlib import Path import warnings import re diff --git a/openmc/mesh.py b/openmc/mesh.py index fcc1f2ee2..c490f604a 100644 --- a/openmc/mesh.py +++ b/openmc/mesh.py @@ -2,7 +2,6 @@ from abc import ABCMeta from collections.abc import Iterable from numbers import Real, Integral from xml.etree import ElementTree as ET -import sys import warnings import numpy as np @@ -10,7 +9,7 @@ import numpy as np import openmc.checkvalue as cv import openmc from openmc._xml import get_text -from openmc.mixin import EqualityMixin, IDManagerMixin +from openmc.mixin import IDManagerMixin class MeshBase(IDManagerMixin, metaclass=ABCMeta): diff --git a/openmc/mgxs/groups.py b/openmc/mgxs/groups.py index 5d7876644..06e2e80eb 100644 --- a/openmc/mgxs/groups.py +++ b/openmc/mgxs/groups.py @@ -1,7 +1,6 @@ from collections.abc import Iterable from numbers import Real import copy -import sys import numpy as np diff --git a/openmc/mgxs/library.py b/openmc/mgxs/library.py index 00b30f8ed..6ddd8e158 100644 --- a/openmc/mgxs/library.py +++ b/openmc/mgxs/library.py @@ -1,4 +1,3 @@ -import sys import os import copy import pickle diff --git a/openmc/mgxs/mdgxs.py b/openmc/mgxs/mdgxs.py index 75a2e6791..e23f927f4 100644 --- a/openmc/mgxs/mdgxs.py +++ b/openmc/mgxs/mdgxs.py @@ -1,12 +1,8 @@ from collections import OrderedDict -from collections.abc import Iterable import itertools from numbers import Integral -import warnings import os -import sys import copy -from abc import ABCMeta import numpy as np diff --git a/openmc/model/funcs.py b/openmc/model/funcs.py index 188f1a273..4b605d13b 100644 --- a/openmc/model/funcs.py +++ b/openmc/model/funcs.py @@ -6,8 +6,8 @@ from warnings import warn from operator import attrgetter from openmc import ( - XPlane, YPlane, Plane, ZCylinder, Quadric, Cylinder, XCylinder, - YCylinder, Material, Universe, Cell) + XPlane, YPlane, Plane, ZCylinder, Cylinder, XCylinder, + YCylinder, Universe, Cell) from openmc.checkvalue import ( check_type, check_value, check_length, check_less_than, check_iterable_type) diff --git a/openmc/nuclide.py b/openmc/nuclide.py index f7c725040..fcbfc2d60 100644 --- a/openmc/nuclide.py +++ b/openmc/nuclide.py @@ -1,7 +1,5 @@ import warnings -import openmc.checkvalue as cv - class Nuclide(str): """A nuclide that can be used in a material. diff --git a/openmc/openmoc_compatible.py b/openmc/openmoc_compatible.py index d18070740c..4bd09e771 100644 --- a/openmc/openmoc_compatible.py +++ b/openmc/openmoc_compatible.py @@ -1,6 +1,3 @@ -import copy -import operator - import numpy as np import openmoc diff --git a/openmc/plots.py b/openmc/plots.py index 51054549f..41a50a5f2 100644 --- a/openmc/plots.py +++ b/openmc/plots.py @@ -2,8 +2,6 @@ from collections.abc import Iterable, Mapping from numbers import Real, Integral from pathlib import Path import subprocess -import sys -import warnings from xml.etree import ElementTree as ET import numpy as np diff --git a/openmc/polynomial.py b/openmc/polynomial.py index 6c0e82461..c57b5fbdc 100644 --- a/openmc/polynomial.py +++ b/openmc/polynomial.py @@ -1,7 +1,7 @@ -import math -import numpy as np -import openmc from collections.abc import Iterable +import math + +import numpy as np def legendre_from_expcoef(coef, domain=(-1, 1)): diff --git a/openmc/region.py b/openmc/region.py index 0d86d99bb..bcff3d963 100644 --- a/openmc/region.py +++ b/openmc/region.py @@ -1,6 +1,6 @@ from abc import ABCMeta, abstractmethod from collections import OrderedDict -from collections.abc import Iterable, MutableSequence +from collections.abc import MutableSequence from copy import deepcopy import numpy as np diff --git a/openmc/settings.py b/openmc/settings.py index 8ea110be1..1379bc157 100644 --- a/openmc/settings.py +++ b/openmc/settings.py @@ -2,11 +2,7 @@ from collections.abc import Iterable, MutableSequence, Mapping from enum import Enum from pathlib import Path from numbers import Real, Integral -import warnings from xml.etree import ElementTree as ET -import sys - -import numpy as np from openmc._xml import clean_indentation, get_text import openmc.checkvalue as cv diff --git a/openmc/source.py b/openmc/source.py index 7b709321f..eecaf2c65 100644 --- a/openmc/source.py +++ b/openmc/source.py @@ -1,5 +1,4 @@ from numbers import Real -import sys from xml.etree import ElementTree as ET from openmc._xml import get_text diff --git a/openmc/stats/multivariate.py b/openmc/stats/multivariate.py index 3d258ee35..281e44570 100644 --- a/openmc/stats/multivariate.py +++ b/openmc/stats/multivariate.py @@ -2,7 +2,6 @@ from abc import ABCMeta, abstractmethod from collections.abc import Iterable from math import pi from numbers import Real -import sys from xml.etree import ElementTree as ET import numpy as np diff --git a/openmc/stats/univariate.py b/openmc/stats/univariate.py index 69386f678..64487f34f 100644 --- a/openmc/stats/univariate.py +++ b/openmc/stats/univariate.py @@ -1,7 +1,6 @@ from abc import ABCMeta, abstractmethod from collections.abc import Iterable from numbers import Real -import sys from xml.etree import ElementTree as ET import numpy as np diff --git a/openmc/summary.py b/openmc/summary.py index b5486ecb5..fa8781335 100644 --- a/openmc/summary.py +++ b/openmc/summary.py @@ -1,5 +1,4 @@ from collections.abc import Iterable -import re import warnings import numpy as np diff --git a/openmc/tallies.py b/openmc/tallies.py index a8687bb37..ac9b1e14c 100644 --- a/openmc/tallies.py +++ b/openmc/tallies.py @@ -1,12 +1,10 @@ from collections.abc import Iterable, MutableSequence import copy -import re from functools import partial, reduce from itertools import product from numbers import Integral, Real import operator from pathlib import Path -import warnings from xml.etree import ElementTree as ET import numpy as np diff --git a/openmc/tally_derivative.py b/openmc/tally_derivative.py index 9be748b2c..dea5fcd87 100644 --- a/openmc/tally_derivative.py +++ b/openmc/tally_derivative.py @@ -1,4 +1,3 @@ -import sys from numbers import Integral from xml.etree import ElementTree as ET diff --git a/openmc/trigger.py b/openmc/trigger.py index 1dcaf8a7d..1543d1ada 100644 --- a/openmc/trigger.py +++ b/openmc/trigger.py @@ -1,7 +1,5 @@ from numbers import Real from xml.etree import ElementTree as ET -import sys -import warnings from collections.abc import Iterable import openmc.checkvalue as cv diff --git a/openmc/universe.py b/openmc/universe.py index 1d65397f8..b5bcd866e 100644 --- a/openmc/universe.py +++ b/openmc/universe.py @@ -1,9 +1,8 @@ from collections import OrderedDict from collections.abc import Iterable from copy import copy, deepcopy -from numbers import Integral, Real +from numbers import Real import random -import sys import numpy as np