mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-28 14:15:42 -04:00
Cleaner openmc.deplete namespace with __all__
Provide explicit __all__ lists for files in openmc/deplete containing classes that should be brought into the "primary" API. This prevents cluttering the openmc.deplete namespace caused by the wildcard imports ``` from .nuclide import * ... ``` The abc, cram, and helpers modules are imported simply as ``` from . import abc from . import cram from . import helpers ```
This commit is contained in:
parent
72471d249f
commit
b3c5d98454
9 changed files with 29 additions and 3 deletions
|
|
@ -35,7 +35,10 @@ from .nuclide import *
|
|||
from .chain import *
|
||||
from .operator import *
|
||||
from .reaction_rates import *
|
||||
from .abc import *
|
||||
from .atom_number import *
|
||||
from .results import *
|
||||
from .results_list import *
|
||||
from .integrators import *
|
||||
from . import abc
|
||||
from . import cram
|
||||
from . import helpers
|
||||
|
|
|
|||
|
|
@ -24,6 +24,13 @@ from .results import Results
|
|||
from .chain import Chain
|
||||
from .results_list import ResultsList
|
||||
|
||||
|
||||
__all__ = [
|
||||
"OperatorResult", "TransportOperator", "ReactionRateHelper",
|
||||
"EnergyHelper", "FissionYieldHelper", "TalliedFissionYieldHelper",
|
||||
"Integrator", "SIIntegrator"]
|
||||
|
||||
|
||||
OperatorResult = namedtuple('OperatorResult', ['k', 'rates'])
|
||||
OperatorResult.__doc__ = """\
|
||||
Result of applying transport operator
|
||||
|
|
|
|||
|
|
@ -45,6 +45,8 @@ _REACTIONS = [
|
|||
]
|
||||
|
||||
|
||||
__all__ = ["Chain"]
|
||||
|
||||
def replace_missing(product, decay_data):
|
||||
"""Replace missing product with suitable decay daughter.
|
||||
|
||||
|
|
|
|||
|
|
@ -13,8 +13,6 @@ import scipy.sparse.linalg as sla
|
|||
|
||||
from . import comm
|
||||
|
||||
__all__ = ["deplete", "timed_deplete", "CRAM16", "CRAM48"]
|
||||
|
||||
|
||||
def deplete(chain, x, rates, dt, matrix_func=None):
|
||||
"""Deplete materials using given reaction rates for a specified time
|
||||
|
|
|
|||
|
|
@ -17,6 +17,10 @@ from numpy import empty
|
|||
|
||||
from openmc.checkvalue import check_type
|
||||
|
||||
__all__ = [
|
||||
"DecayTuple", "ReactionTuple", "Nuclide", "FissionYield",
|
||||
"FissionYieldDistribution"]
|
||||
|
||||
|
||||
DecayTuple = namedtuple('DecayTuple', 'type target branching_ratio')
|
||||
DecayTuple.__doc__ = """\
|
||||
|
|
|
|||
|
|
@ -30,6 +30,9 @@ from .helpers import (
|
|||
FissionYieldCutoffHelper, AveragedFissionYieldHelper)
|
||||
|
||||
|
||||
__all__ = ["Operator", "OperatorResult"]
|
||||
|
||||
|
||||
def _distribute(items):
|
||||
"""Distribute items across MPI communicator
|
||||
|
||||
|
|
|
|||
|
|
@ -7,6 +7,9 @@ from collections import OrderedDict
|
|||
import numpy as np
|
||||
|
||||
|
||||
__all__ = ["ReactionRates"]
|
||||
|
||||
|
||||
class ReactionRates(np.ndarray):
|
||||
"""Reaction rates resulting from a transport operator call
|
||||
|
||||
|
|
|
|||
|
|
@ -16,6 +16,9 @@ from .reaction_rates import ReactionRates
|
|||
_VERSION_RESULTS = (1, 0)
|
||||
|
||||
|
||||
__all__ = ["Results"]
|
||||
|
||||
|
||||
class Results(object):
|
||||
"""Output of a depletion run
|
||||
|
||||
|
|
|
|||
|
|
@ -5,6 +5,9 @@ from .results import Results, _VERSION_RESULTS
|
|||
from openmc.checkvalue import check_filetype_version
|
||||
|
||||
|
||||
__all__ = ["ResultsList"]
|
||||
|
||||
|
||||
class ResultsList(list):
|
||||
"""A list of openmc.deplete.Results objects
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue