diff --git a/openmc/data/angle_energy.py b/openmc/data/angle_energy.py index e460575d2e..6009dc748a 100644 --- a/openmc/data/angle_energy.py +++ b/openmc/data/angle_energy.py @@ -1,10 +1,10 @@ -from abc import ABCMeta, abstractmethod +from abc import ABC, abstractmethod import openmc.data from openmc.mixin import EqualityMixin -class AngleEnergy(EqualityMixin, metaclass=ABCMeta): +class AngleEnergy(EqualityMixin, ABC): """Distribution in angle and energy of a secondary particle.""" @abstractmethod def to_hdf5(self, group): diff --git a/openmc/data/energy_distribution.py b/openmc/data/energy_distribution.py index bff97bf813..441cf8f9c6 100644 --- a/openmc/data/energy_distribution.py +++ b/openmc/data/energy_distribution.py @@ -1,4 +1,4 @@ -from abc import ABCMeta, abstractmethod +from abc import ABC, abstractmethod from collections.abc import Iterable from numbers import Integral, Real from warnings import warn @@ -13,7 +13,7 @@ from .data import EV_PER_MEV from .endf import get_tab1_record, get_tab2_record -class EnergyDistribution(EqualityMixin, metaclass=ABCMeta): +class EnergyDistribution(EqualityMixin, ABC): """Abstract superclass for all energy distributions.""" def __init__(self): pass diff --git a/openmc/data/function.py b/openmc/data/function.py index 9175e5e3bf..89602aabe4 100644 --- a/openmc/data/function.py +++ b/openmc/data/function.py @@ -1,4 +1,4 @@ -from abc import ABCMeta, abstractmethod +from abc import ABC, abstractmethod from collections.abc import Iterable, Callable from functools import reduce from itertools import zip_longest @@ -56,7 +56,7 @@ def sum_functions(funcs): return Polynomial(coeffs) -class Function1D(EqualityMixin, metaclass=ABCMeta): +class Function1D(EqualityMixin, ABC): """A function of one independent variable with HDF5 support.""" @abstractmethod def __call__(self): pass diff --git a/openmc/lattice.py b/openmc/lattice.py index 97b6a6bf53..41990f9164 100644 --- a/openmc/lattice.py +++ b/openmc/lattice.py @@ -1,4 +1,4 @@ -from abc import ABCMeta +from abc import ABC from collections import OrderedDict from collections.abc import Iterable from copy import deepcopy @@ -15,7 +15,7 @@ from openmc._xml import get_text from openmc.mixin import IDManagerMixin -class Lattice(IDManagerMixin, metaclass=ABCMeta): +class Lattice(IDManagerMixin, ABC): """A repeating structure wherein each element is a universe. Parameters diff --git a/openmc/mesh.py b/openmc/mesh.py index d2a93676fa..e793bb4efd 100644 --- a/openmc/mesh.py +++ b/openmc/mesh.py @@ -1,4 +1,4 @@ -from abc import ABCMeta +from abc import ABC from collections.abc import Iterable from numbers import Real, Integral from xml.etree import ElementTree as ET @@ -13,7 +13,7 @@ from openmc.mixin import IDManagerMixin from openmc.surface import _BOUNDARY_TYPES -class MeshBase(IDManagerMixin, metaclass=ABCMeta): +class MeshBase(IDManagerMixin, ABC): """A mesh that partitions geometry for tallying purposes. Parameters diff --git a/openmc/mgxs/mgxs.py b/openmc/mgxs/mgxs.py index c1fa92c176..1b93203bbb 100644 --- a/openmc/mgxs/mgxs.py +++ b/openmc/mgxs/mgxs.py @@ -3,7 +3,6 @@ from numbers import Integral import warnings import os import copy -from abc import ABCMeta import numpy as np import h5py @@ -128,7 +127,7 @@ def _df_column_convert_to_bin(df, current_name, new_name, values_to_bin, df.rename(columns={current_name: new_name}, inplace=True) -class MGXS(metaclass=ABCMeta): +class MGXS: """An abstract multi-group cross section for some energy group structure within some spatial domain. diff --git a/openmc/model/triso.py b/openmc/model/triso.py index f460c83fa3..183e925eba 100644 --- a/openmc/model/triso.py +++ b/openmc/model/triso.py @@ -2,7 +2,7 @@ import copy import warnings import itertools import random -from abc import ABCMeta, abstractproperty, abstractmethod +from abc import ABC, abstractproperty, abstractmethod from collections import Counter, defaultdict from collections.abc import Iterable from heapq import heappush, heappop @@ -100,7 +100,7 @@ class TRISO(openmc.Cell): k_min:k_max+1, j_min:j_max+1, i_min:i_max+1])) -class _Container(metaclass=ABCMeta): +class _Container(ABC): """Container in which to pack spheres. Parameters diff --git a/openmc/region.py b/openmc/region.py index bcff3d9633..cee66f18ad 100644 --- a/openmc/region.py +++ b/openmc/region.py @@ -1,4 +1,4 @@ -from abc import ABCMeta, abstractmethod +from abc import ABC, abstractmethod from collections import OrderedDict from collections.abc import MutableSequence from copy import deepcopy @@ -8,7 +8,7 @@ import numpy as np from openmc.checkvalue import check_type -class Region(metaclass=ABCMeta): +class Region(ABC): """Region of space that can be assigned to a cell. Region is an abstract base class that is inherited by diff --git a/openmc/stats/multivariate.py b/openmc/stats/multivariate.py index 281e445707..6710983baf 100644 --- a/openmc/stats/multivariate.py +++ b/openmc/stats/multivariate.py @@ -1,4 +1,4 @@ -from abc import ABCMeta, abstractmethod +from abc import ABC, abstractmethod from collections.abc import Iterable from math import pi from numbers import Real @@ -11,7 +11,7 @@ from openmc._xml import get_text from openmc.stats.univariate import Univariate, Uniform -class UnitSphere(metaclass=ABCMeta): +class UnitSphere(ABC): """Distribution of points on the unit sphere. This abstract class is used for angular distributions, since a direction is @@ -251,7 +251,7 @@ class Monodirectional(UnitSphere): return monodirectional -class Spatial(metaclass=ABCMeta): +class Spatial(ABC): """Distribution of locations in three-dimensional Euclidean space. Classes derived from this abstract class can be used for spatial diff --git a/openmc/stats/univariate.py b/openmc/stats/univariate.py index 64487f34f5..b11326ce32 100644 --- a/openmc/stats/univariate.py +++ b/openmc/stats/univariate.py @@ -1,4 +1,4 @@ -from abc import ABCMeta, abstractmethod +from abc import ABC, abstractmethod from collections.abc import Iterable from numbers import Real from xml.etree import ElementTree as ET @@ -14,7 +14,7 @@ _INTERPOLATION_SCHEMES = ['histogram', 'linear-linear', 'linear-log', 'log-linear', 'log-log'] -class Univariate(EqualityMixin, metaclass=ABCMeta): +class Univariate(EqualityMixin, ABC): """Probability distribution of a single random variable. The Univariate class is an abstract class that can be derived to implement a diff --git a/openmc/surface.py b/openmc/surface.py index 76be3b75dd..62f51085a3 100644 --- a/openmc/surface.py +++ b/openmc/surface.py @@ -1,4 +1,4 @@ -from abc import ABCMeta, abstractmethod +from abc import ABC, abstractmethod from collections import OrderedDict from collections.abc import Iterable from copy import deepcopy @@ -103,7 +103,7 @@ def get_rotation_matrix(rotation, order='xyz'): return R3 @ R2 @ R1 -class Surface(IDManagerMixin, metaclass=ABCMeta): +class Surface(IDManagerMixin, ABC): """An implicit surface with an associated boundary condition. An implicit surface is defined as the set of zeros of a function of the @@ -459,7 +459,7 @@ class Surface(IDManagerMixin, metaclass=ABCMeta): return cls(*coeffs, **kwargs) -class PlaneMixin(metaclass=ABCMeta): +class PlaneMixin: """A Plane mixin class for all operations on order 1 surfaces""" def __init__(self, **kwargs): super().__init__(**kwargs) @@ -918,7 +918,7 @@ class ZPlane(PlaneMixin, Surface): return point[2] - self.z0 -class QuadricMixin(metaclass=ABCMeta): +class QuadricMixin: """A Mixin class implementing common functionality for quadric surfaces""" @property