mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-28 06:05:58 -04:00
Consistent use of ABC instead of ABCMeta where possible
This commit is contained in:
parent
ffd78be628
commit
d5b54e8cb5
11 changed files with 24 additions and 25 deletions
|
|
@ -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):
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue