summaryrefslogtreecommitdiff
path: root/pint
diff options
context:
space:
mode:
authorHernan <hernan.grecco@gmail.com>2019-12-27 10:54:45 -0300
committerHernan <hernan.grecco@gmail.com>2019-12-27 10:54:45 -0300
commit58956fa57fcafce0716f265f9ec81703cb3f547e (patch)
treed73a6fec9763c9b0a602b89909bc96b16084774d /pint
parent3ff439e386191b77cb5186bd98478595aa035355 (diff)
downloadpint-58956fa57fcafce0716f265f9ec81703cb3f547e.tar.gz
Fixes W293
Diffstat (limited to 'pint')
-rw-r--r--pint/context.py16
-rw-r--r--pint/definitions.py2
-rw-r--r--pint/formatting.py6
-rw-r--r--pint/numpy_func.py22
-rw-r--r--pint/quantity.py6
-rw-r--r--pint/registry.py84
-rw-r--r--pint/registry_helpers.py18
-rw-r--r--pint/systems.py28
-rw-r--r--pint/testsuite/__init__.py4
-rw-r--r--pint/testsuite/parameterized.py6
-rw-r--r--pint/testsuite/test_issues.py12
-rw-r--r--pint/testsuite/test_numpy.py4
-rw-r--r--pint/testsuite/test_umath.py18
-rw-r--r--pint/util.py42
14 files changed, 134 insertions, 134 deletions
diff --git a/pint/context.py b/pint/context.py
index 0034925..1ceb359 100644
--- a/pint/context.py
+++ b/pint/context.py
@@ -36,15 +36,15 @@ class Context:
"""A specialized container that defines transformation functions from one
dimension to another. Each Dimension are specified using a UnitsContainer.
Simple transformation are given with a function taking a single parameter.
-
+
Conversion functions may take optional keyword arguments and the context
can have default values for these arguments.
-
-
+
+
Additionally, a context may host redefinitions:
-
-
+
+
A redefinition must be performed among units that already exist in the registry. It
cannot change the dimensionality of a unit. The symbol and aliases are automatically
inherited from the registry.
@@ -108,7 +108,7 @@ class Context:
"""Creates a new context that shares the funcs dictionary with the
original context. The default values are copied from the original
context and updated with the new defaults.
-
+
If defaults is empty, return the same context.
Parameters
@@ -116,7 +116,7 @@ class Context:
context : Context
Original context.
**defaults
-
+
Returns
-------
@@ -298,7 +298,7 @@ class ContextChain(ChainMap):
def insert_contexts(self, *contexts):
"""Insert one or more contexts in reversed order the chained map.
(A rule in last context will take precedence)
-
+
To facilitate the identification of the context with the matching rule,
the *relation_to_context* dictionary of the context is used.
"""
diff --git a/pint/definitions.py b/pint/definitions.py
index 947a189..16dd840 100644
--- a/pint/definitions.py
+++ b/pint/definitions.py
@@ -59,7 +59,7 @@ class Definition:
Parameters
----------
definition :
-
+
Returns
-------
diff --git a/pint/formatting.py b/pint/formatting.py
index 4bcdf0b..0e84f82 100644
--- a/pint/formatting.py
+++ b/pint/formatting.py
@@ -18,7 +18,7 @@ __JOIN_REG_EXP = re.compile(r"\{\d*\}")
def _join(fmt, iterable):
"""Join an iterable with the format specified in fmt.
-
+
The format can be specified in two ways:
- PEP3101 format with two replacement fields (eg. '{} * {}')
- The concatenating string (eg. ' * ')
@@ -26,9 +26,9 @@ def _join(fmt, iterable):
Parameters
----------
fmt : str
-
+
iterable :
-
+
Returns
-------
diff --git a/pint/numpy_func.py b/pint/numpy_func.py
index ed91df1..0dcb878 100644
--- a/pint/numpy_func.py
+++ b/pint/numpy_func.py
@@ -23,13 +23,13 @@ HANDLED_FUNCTIONS = {}
def _is_quantity(obj):
"""Test for _units and _magnitude attrs.
-
+
This is done in place of isinstance(Quantity, arg), which would cause a circular import.
Parameters
----------
obj : Object
-
+
Returns
-------
@@ -44,7 +44,7 @@ def _is_quantity_sequence(obj):
Parameters
----------
obj : object
-
+
Returns
-------
@@ -71,7 +71,7 @@ def _get_first_input_units(args, kwargs=None):
def convert_arg(arg, pre_calc_units):
"""Convert quantities and sequences of quantities to pre_calc_units and strip units.
-
+
Helper function for convert_to_consistent_units. pre_calc_units must be given as a pint
Unit or None.
@@ -96,7 +96,7 @@ def convert_arg(arg, pre_calc_units):
def convert_to_consistent_units(*args, pre_calc_units=None, **kwargs):
"""Prepare args and kwargs for wrapping by unit conversion and stripping.
-
+
If pre_calc_units is not None, takes the args and kwargs for a NumPy function and converts
any Quantity or Sequence of Quantities into the units of the first Quantiy/Sequence of
Quantities and returns the magnitudes. Other args/kwargs are treated as dimensionless
@@ -114,7 +114,7 @@ def convert_to_consistent_units(*args, pre_calc_units=None, **kwargs):
def unwrap_and_wrap_consistent_units(*args):
"""Strip units from args while providing a rewrapping function.
-
+
Returns the given args as parsed by convert_to_consistent_units assuming units of
first arg with units, along with a wrapper to restore that unit to the output.
@@ -129,9 +129,9 @@ def unwrap_and_wrap_consistent_units(*args):
def get_op_output_unit(unit_op, first_input_units, all_args=None, size=None):
"""Determine resulting unit from given operation.
-
+
Options for `unit_op`:
-
+
- "sum": `first_input_units`, unless non-multiplicative, which raises
OffsetUnitCalculusError
- "mul": product of all units in `all_args`
@@ -149,9 +149,9 @@ def get_op_output_unit(unit_op, first_input_units, all_args=None, size=None):
Parameters
----------
unit_op :
-
+
first_input_units :
-
+
all_args :
(Default value = None)
size :
@@ -249,7 +249,7 @@ def implement_func(func_type, func_str, input_units=None, output_unit=None):
`get_op_output_unit`. If some other string, the string is parsed as a unit,
which becomes the unit of the output. If None, the bare magnitude is returned.
-
+
"""
# If NumPy is not available, do not attempt implement that which does not exist
if np is None:
diff --git a/pint/quantity.py b/pint/quantity.py
index 1bf3fb9..8bdf737 100644
--- a/pint/quantity.py
+++ b/pint/quantity.py
@@ -418,7 +418,7 @@ class Quantity(PrettyIPython, SharedRegistryObject):
"""Transforms a list of Quantities into an numpy.array quantity.
If no units are specified, the unit of the first element will be used.
Same as from_sequence.
-
+
If units is not specified and list is empty, the unit cannot be determined
and a ValueError is raised.
@@ -439,7 +439,7 @@ class Quantity(PrettyIPython, SharedRegistryObject):
def from_sequence(cls, seq, units=None):
"""Transforms a sequence of Quantities into an numpy.array quantity.
If no units are specified, the unit of the first element will be used.
-
+
If units is not specified and sequence is empty, the unit cannot be determined
and a ValueError is raised.
@@ -1597,7 +1597,7 @@ class Quantity(PrettyIPython, SharedRegistryObject):
def dot(self, b):
"""Dot product of two arrays.
-
+
Wraps np.dot().
"""
diff --git a/pint/registry.py b/pint/registry.py
index d4f75d3..cfade8b 100644
--- a/pint/registry.py
+++ b/pint/registry.py
@@ -122,9 +122,9 @@ class ContextCacheOverlay:
class BaseRegistry(metaclass=RegistryMeta):
"""Base class for all registries.
-
+
Capabilities:
-
+
- Register units, prefixes, and dimensions, and their relations.
- Convert between units.
- Find dimensionality of a unit.
@@ -329,7 +329,7 @@ class BaseRegistry(metaclass=RegistryMeta):
def _define(self, definition):
"""Add unit to the registry.
-
+
This method defines only multiplicative units, converting any other type
to `delta_` units.
@@ -434,7 +434,7 @@ class BaseRegistry(metaclass=RegistryMeta):
def _define_single_adder(self, key, value, unit_dict, casei_unit_dict):
"""Helper function to store a definition in the internal dictionaries.
-
+
It warns or raise error on redefinition.
"""
if key in unit_dict:
@@ -723,7 +723,7 @@ class BaseRegistry(metaclass=RegistryMeta):
def get_root_units(self, input_units, check_nonmult=True):
"""Convert unit or dict of units to the root units.
-
+
If any unit is non multiplicative and check_converter is True,
then None is returned as the multiplicative factor.
@@ -750,7 +750,7 @@ class BaseRegistry(metaclass=RegistryMeta):
def _get_root_units(self, input_units, check_nonmult=True):
"""Convert unit or dict of units to the root units.
-
+
If any unit is non multiplicative and check_converter is True,
then None is returned as the multiplicative factor.
@@ -794,7 +794,7 @@ class BaseRegistry(metaclass=RegistryMeta):
def get_base_units(self, input_units, check_nonmult=True, system=None):
"""Convert unit or dict of units to the base units.
-
+
If any unit is non multiplicative and check_converter is True,
then None is returned as the multiplicative factor.
@@ -937,7 +937,7 @@ class BaseRegistry(metaclass=RegistryMeta):
Parameters
----------
unit_name :
-
+
case_sensitive :
(Default value = True)
@@ -981,10 +981,10 @@ class BaseRegistry(metaclass=RegistryMeta):
@staticmethod
def _dedup_candidates(candidates):
"""Helper of parse_unit_name.
-
+
Given an iterable of unit triplets (prefix, name, suffix), remove those with
different names but equal value, preferring those with a prefix.
-
+
e.g. ('kilo', 'gram', '') and ('', 'kilogram', '')
"""
candidates = dict.fromkeys(candidates) # ordered set
@@ -1000,7 +1000,7 @@ class BaseRegistry(metaclass=RegistryMeta):
def parse_units(self, input_string, as_delta=None):
"""Parse a units expression and returns a UnitContainer with
the canonical names.
-
+
The expression can only contain products, ratios and powers of units.
Parameters
@@ -1085,20 +1085,20 @@ class BaseRegistry(metaclass=RegistryMeta):
self, input_string, case_sensitive=True, use_decimal=False, **values
):
"""Parse a mathematical expression including units and return a quantity object.
-
+
Numerical constants can be specified as keyword arguments and will take precedence
over the names defined in the registry.
Parameters
----------
input_string :
-
+
case_sensitive :
(Default value = True)
use_decimal :
(Default value = False)
**values :
-
+
Returns
-------
@@ -1124,7 +1124,7 @@ class BaseRegistry(metaclass=RegistryMeta):
class NonMultiplicativeRegistry(BaseRegistry):
"""Handle of non multiplicative units (e.g. Temperature).
-
+
Capabilities:
- Register non-multiplicative units and their relations.
- Convert between non-multiplicative units.
@@ -1163,7 +1163,7 @@ class NonMultiplicativeRegistry(BaseRegistry):
def _define(self, definition):
"""Add unit to the registry.
-
+
In addition to what is done by the BaseRegistry,
registers also non-multiplicative units.
@@ -1232,7 +1232,7 @@ class NonMultiplicativeRegistry(BaseRegistry):
def _convert(self, value, src, dst, inplace=False):
"""Convert value from some source to destination units.
-
+
In addition to what is done by the BaseRegistry,
converts between non-multiplicative units.
@@ -1304,11 +1304,11 @@ class NonMultiplicativeRegistry(BaseRegistry):
class ContextRegistry(BaseRegistry):
"""Handle of Contexts.
-
+
Conversion between units with different dimenstions according
to previously established relations (contexts).
(e.g. in the spectroscopy, conversion between frequency and energy is possible)
-
+
Capabilities:
- Register contexts.
- Enable and disable contexts.
@@ -1344,9 +1344,9 @@ class ContextRegistry(BaseRegistry):
def add_context(self, context: Context) -> None:
"""Add a context object to the registry.
-
+
The context will be accessible by its name and aliases.
-
+
Notice that this method will NOT enable the context. Use `enable_contexts`.
"""
@@ -1367,7 +1367,7 @@ class ContextRegistry(BaseRegistry):
def remove_context(self, name_or_alias: str) -> Context:
"""Remove a context from the registry and return it.
-
+
Notice that this methods will not disable the context. Use `disable_contexts`.
"""
@@ -1474,7 +1474,7 @@ class ContextRegistry(BaseRegistry):
kwargs :
keyword arguments for the context
*names_or_contexts :
-
+
**kwargs :
"""
@@ -1535,23 +1535,23 @@ class ContextRegistry(BaseRegistry):
name of the context.
kwargs :
keyword arguments for the contexts.
-
+
Context are called by their name::
-
-
+
+
If the context has an argument, you can specify its value as a keyword
argument::
-
-
+
+
Multiple contexts can be entered in single call:
-
-
+
+
or nested allowing you to give different values to the same keyword argument::
-
-
+
+
A nested context inherits the defaults from the containing context::
*names :
-
+
**kwargs :
@@ -1586,7 +1586,7 @@ class ContextRegistry(BaseRegistry):
def with_context(self, name, **kw):
"""Decorator to wrap a function call in a Pint context.
-
+
Use it to ensure that a certain context is active when
calling a function::
@@ -1597,9 +1597,9 @@ class ContextRegistry(BaseRegistry):
kwargs :
keyword arguments for the contexts.
name :
-
+
**kw :
-
+
Returns
-------
@@ -1632,7 +1632,7 @@ class ContextRegistry(BaseRegistry):
def _convert(self, value, src, dst, inplace=False):
"""Convert value from some source to destination units.
-
+
In addition to what is done by the BaseRegistry,
converts between units with different dimensions by following
transformation rules defined in the context.
@@ -1693,11 +1693,11 @@ class ContextRegistry(BaseRegistry):
class SystemRegistry(BaseRegistry):
"""Handle of Systems and Groups.
-
+
Conversion between units with different dimenstions according
to previously established relations (contexts).
(e.g. in the spectroscopy, conversion between frequency and energy is possible)
-
+
Capabilities:
- Register systems and groups.
- List systems
@@ -1729,7 +1729,7 @@ class SystemRegistry(BaseRegistry):
def _after_init(self):
"""After init function
-
+
Create default group.
Add all orphan units to it.
Set default system.
@@ -1847,10 +1847,10 @@ class SystemRegistry(BaseRegistry):
def get_base_units(self, input_units, check_nonmult=True, system=None):
"""Convert unit or dict of units to the base units.
-
+
If any unit is non multiplicative and check_converter is True,
then None is returned as the multiplicative factor.
-
+
Unlike BaseRegistry, in this registry root_units might be different
from base_units
diff --git a/pint/registry_helpers.py b/pint/registry_helpers.py
index 6bd21dd..d51daba 100644
--- a/pint/registry_helpers.py
+++ b/pint/registry_helpers.py
@@ -45,14 +45,14 @@ def _to_units_container(a, registry=None):
Parameters
----------
a :
-
+
registry :
(Default value = None)
Returns
-------
UnitsContainer, bool
-
+
"""
if isinstance(a, str) and "=" in a:
@@ -154,7 +154,7 @@ def _parse_wrap_args(args, registry=None):
def _apply_defaults(func, args, kwargs):
"""Apply default keyword arguments.
-
+
Named keywords may have been left blank. This function applies the default
values so that every argument is defined.
"""
@@ -170,15 +170,15 @@ def _apply_defaults(func, args, kwargs):
def wraps(ureg, ret, args, strict=True):
"""Wraps a function to become pint-aware.
-
+
Use it when a function requires a numerical value but in some specific
units. The wrapper function will take a pint quantity, convert to the units
specified in `args` and then call the wrapped function with the resulting
magnitude.
-
+
The value returned by the wrapped function will be converted to the units
specified in `ret`.
-
+
Use None to skip argument conversion.
Set strict to False, to accept also numerical values.
@@ -256,10 +256,10 @@ def wraps(ureg, ret, args, strict=True):
def check(ureg, *args):
"""Decorator to for quantity type checking for function inputs.
-
+
Use it to ensure that the decorated function input parameters match
the expected type of pint quantity.
-
+
Use None to skip argument checking.
Parameters
@@ -269,7 +269,7 @@ def check(ureg, *args):
args :
iterable of input units.
*args :
-
+
Returns
-------
diff --git a/pint/systems.py b/pint/systems.py
index 198baf2..fc8c532 100644
--- a/pint/systems.py
+++ b/pint/systems.py
@@ -26,16 +26,16 @@ from .util import (
class Group(SharedRegistryObject):
"""A group is a set of units.
-
+
Units can be added directly or by including other groups.
-
+
Members are computed dynamically, that is if a unit is added to a group X
all groups that include X are affected.
-
+
The group belongs to one Registry.
-
+
It can be specified in the definition file as::
-
+
@group <name> [using <group 1>, ..., <group N>]
<definition 1>
...
@@ -86,7 +86,7 @@ class Group(SharedRegistryObject):
@property
def members(self):
"""Names of the units that are members of the group.
-
+
Calculated to include to all units in all included _used_groups.
"""
@@ -242,28 +242,28 @@ class Group(SharedRegistryObject):
class System(SharedRegistryObject):
"""A system is a Group plus a set of base units.
-
+
Members are computed dynamically, that is if a unit is added to a group X
all groups that include X are affected.
-
+
The System belongs to one Registry.
-
+
It can be specified in the definition file as::
-
+
@system <name> [using <group 1>, ..., <group N>]
<rule 1>
...
<rule N>
@end
-
+
The syntax for the rule is:
-
+
new_unit_name : old_unit_name
-
+
where:
- old_unit_name: a root unit part which is going to be removed from the system.
- new_unit_name: a non root unit which is going to replace the old_unit.
-
+
If the new_unit_name and the old_unit_name, the later and the colon can be ommited.
"""
diff --git a/pint/testsuite/__init__.py b/pint/testsuite/__init__.py
index bd384d6..1614f59 100644
--- a/pint/testsuite/__init__.py
+++ b/pint/testsuite/__init__.py
@@ -143,7 +143,7 @@ def main():
def run():
"""Run all tests.
-
+
:return: a :class:`unittest.TestResult` object
Parameters
@@ -173,7 +173,7 @@ def add_docs(suite):
Parameters
----------
suite :
-
+
Returns
-------
diff --git a/pint/testsuite/parameterized.py b/pint/testsuite/parameterized.py
index ee4917d..8e5df98 100644
--- a/pint/testsuite/parameterized.py
+++ b/pint/testsuite/parameterized.py
@@ -109,7 +109,7 @@ class ParameterizedTestMixin(metaclass=ParameterizedTestCaseMetaClass):
cls, param_names, data, func_name_format="{func_name}_{case_num:05d}"
):
"""Decorator for parameterizing a test method - example:
-
+
@ParameterizedTestCase.parameterize(
("isbn", "expected_title"), [
("0262033844", "Introduction to Algorithms"),
@@ -118,9 +118,9 @@ class ParameterizedTestMixin(metaclass=ParameterizedTestCaseMetaClass):
Parameters
----------
param_names :
-
+
data :
-
+
func_name_format :
(Default value = "{func_name}_{case_num:05d}")
diff --git a/pint/testsuite/test_issues.py b/pint/testsuite/test_issues.py
index 04aa31d..8d6bd7e 100644
--- a/pint/testsuite/test_issues.py
+++ b/pint/testsuite/test_issues.py
@@ -527,21 +527,21 @@ class TestIssues(QuantityTestCase):
@ureg.wraps(ureg.second, (ureg.meters, ureg.meters / ureg.second ** 2))
def calculate_time_to_fall(height, gravity=Q_(9.8, "m/s^2")):
"""Calculate time to fall from a height h with a default gravity.
-
+
By default, the gravity is assumed to be earth gravity,
but it can be modified.
-
+
d = .5 * g * t**2
t = sqrt(2 * d / g)
Parameters
----------
height :
-
+
gravity :
(Default value = Q_(9.8)
"m/s^2") :
-
+
Returns
-------
@@ -568,11 +568,11 @@ class TestIssues(QuantityTestCase):
Parameters
----------
time :
-
+
rate :
(Default value = Q_(1)
"m/s") :
-
+
Returns
-------
diff --git a/pint/testsuite/test_numpy.py b/pint/testsuite/test_numpy.py
index 72fa70e..3f2bce1 100644
--- a/pint/testsuite/test_numpy.py
+++ b/pint/testsuite/test_numpy.py
@@ -1124,9 +1124,9 @@ class TestNumpyUnclassified(TestNumpyMethods):
@unittest.skip
class TestBitTwiddlingUfuncs(TestUFuncs):
"""Universal functions (ufuncs) > Bittwiddling functions
-
+
http://docs.scipy.org/doc/numpy/reference/ufuncs.html#bittwiddlingfunctions
-
+
bitwise_and(x1, x2[, out]) Compute the bitwise AND of two arrays elementwise.
bitwise_or(x1, x2[, out]) Compute the bitwise OR of two arrays elementwise.
bitwise_xor(x1, x2[, out]) Compute the bitwise XOR of two arrays elementwise.
diff --git a/pint/testsuite/test_umath.py b/pint/testsuite/test_umath.py
index 60559ed..75b7365 100644
--- a/pint/testsuite/test_umath.py
+++ b/pint/testsuite/test_umath.py
@@ -146,7 +146,7 @@ class TestUFuncs(QuantityTestCase):
rtol :
relative tolerance. (Default value = 1e-6)
"same") :
-
+
Returns
-------
@@ -271,9 +271,9 @@ class TestUFuncs(QuantityTestCase):
@helpers.requires_numpy()
class TestMathUfuncs(TestUFuncs):
"""Universal functions (ufunc) > Math operations
-
+
http://docs.scipy.org/doc/numpy/reference/ufuncs.html#math-operations
-
+
add(x1, x2[, out]) Add arguments element-wise.
subtract(x1, x2[, out]) Subtract arguments, element-wise.
multiply(x1, x2[, out]) Multiply arguments element-wise.
@@ -419,9 +419,9 @@ class TestMathUfuncs(TestUFuncs):
@helpers.requires_numpy()
class TestTrigUfuncs(TestUFuncs):
"""Universal functions (ufunc) > Trigonometric functions
-
+
http://docs.scipy.org/doc/numpy/reference/ufuncs.html#trigonometric-functions
-
+
sin(x[, out]) Trigonometric sine, element-wise.
cos(x[, out]) Cosine elementwise.
tan(x[, out]) Compute tangent element-wise.
@@ -676,9 +676,9 @@ class TestTrigUfuncs(TestUFuncs):
class TestComparisonUfuncs(TestUFuncs):
"""Universal functions (ufunc) > Comparison functions
-
+
http://docs.scipy.org/doc/numpy/reference/ufuncs.html#comparison-functions
-
+
greater(x1, x2[, out]) Return the truth value of (x1 > x2) element-wise.
greater_equal(x1, x2[, out]) Return the truth value of (x1 >= x2) element-wise.
less(x1, x2[, out]) Return the truth value of (x1 < x2) element-wise.
@@ -715,9 +715,9 @@ class TestComparisonUfuncs(TestUFuncs):
class TestFloatingUfuncs(TestUFuncs):
"""Universal functions (ufunc) > Floating functions
-
+
http://docs.scipy.org/doc/numpy/reference/ufuncs.html#floating-functions
-
+
isreal(x) Returns a bool array, where True if input element is real.
iscomplex(x) Returns a bool array, where True if input element is complex.
isfinite(x[, out]) Test element-wise for finite-ness (not infinity or not Not a Number).
diff --git a/pint/util.py b/pint/util.py
index fe3c172..aff507b 100644
--- a/pint/util.py
+++ b/pint/util.py
@@ -37,7 +37,7 @@ def matrix_to_string(
Parameters
----------
matrix :
-
+
row_headers :
(Default value = None)
col_headers :
@@ -69,7 +69,7 @@ def transpose(matrix):
Parameters
----------
matrix :
-
+
Returns
-------
@@ -305,7 +305,7 @@ class udict(dict):
class UnitsContainer(Mapping):
"""The UnitsContainer stores the product of units and their respective
exponent and implements the corresponding operations.
-
+
UnitsContainer is a read-only mapping. All operations (even in place ones)
Parameters
@@ -314,7 +314,7 @@ class UnitsContainer(Mapping):
Returns
-------
type
-
+
"""
@@ -351,7 +351,7 @@ class UnitsContainer(Mapping):
Parameters
----------
keys :
-
+
Returns
-------
@@ -369,9 +369,9 @@ class UnitsContainer(Mapping):
Parameters
----------
oldkey :
-
+
newkey :
-
+
Returns
-------
@@ -490,7 +490,7 @@ class UnitsContainer(Mapping):
class ParserHelper(UnitsContainer):
"""The ParserHelper stores in place the product of variables and
their respective exponent and implements the corresponding operations.
-
+
ParserHelper is a read-only mapping. All operations (even in place ones)
Parameters
@@ -514,13 +514,13 @@ class ParserHelper(UnitsContainer):
@classmethod
def from_word(cls, input_word):
"""Creates a ParserHelper object with a single variable with exponent one.
-
+
Equivalent to: ParserHelper({'word': 1})
Parameters
----------
input_word :
-
+
Returns
-------
@@ -552,7 +552,7 @@ class ParserHelper(UnitsContainer):
Parameters
----------
input_string :
-
+
Returns
-------
@@ -736,7 +736,7 @@ def _is_dim(name):
class SharedRegistryObject:
"""Base class for object keeping a reference to the registree.
-
+
Such object are for now Quantity and Unit, in a number of places it is
that an object from this class has a '_units' attribute.
@@ -765,7 +765,7 @@ class SharedRegistryObject:
Parameters
----------
other :
-
+
Returns
-------
@@ -814,7 +814,7 @@ def to_units_container(unit_like, registry=None):
Parameters
----------
unit_like :
-
+
registry :
(Default value = None)
@@ -842,12 +842,12 @@ def infer_base_unit(q):
Parameters
----------
q :
-
+
Returns
-------
type
-
+
"""
d = udict()
@@ -868,7 +868,7 @@ def getattr_maybe_raise(self, item):
Parameters
----------
item :
-
+
Returns
-------
@@ -882,12 +882,12 @@ def getattr_maybe_raise(self, item):
class SourceIterator:
"""Iterator to facilitate reading the definition files.
-
+
Accepts any sequence (like a list of lines, a file or another SourceIterator)
-
+
The iterator yields the line number and line (skipping comments and empty lines)
and stripping white spaces.
-
+
for lineno, line in SourceIterator(sequence):
# do something here
@@ -954,7 +954,7 @@ class BlockIterator(SourceIterator):
def iterable(y):
"""Check whether or not an object can be iterated over.
-
+
Vendored from numpy under the terms of the BSD 3-Clause License. (Copyright
(c) 2005-2019, NumPy Developers.)