Skip to content

Commit

Permalink
Fix internal cross-references in the documentation.
Browse files Browse the repository at this point in the history
  • Loading branch information
ynikitenko committed Apr 22, 2020
1 parent b443f31 commit 4faf240
Show file tree
Hide file tree
Showing 26 changed files with 84 additions and 85 deletions.
16 changes: 8 additions & 8 deletions lena/context/functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def check_context_str(d, s):
True if *d* contains a subdictionary, which is represented by *s*.
Dots in *s* signify nesting.
*s* must have at least two dot-separated parts,
otherwise :exc:`~lena.core.LenaValueError` is raised.
otherwise :exc:`.LenaValueError` is raised.
See also :func:`str_to_dict`.
"""
Expand Down Expand Up @@ -173,7 +173,7 @@ def get_recursively(d, keys, default=_sentinel):
(it represents nested dictionaries).
If any of them is not found, *default* is returned
if "default" is given,
otherwise :exc:`~lena.core.LenaKeyError` is raised.
otherwise :exc:`.LenaKeyError` is raised.
If *keys* is empty, *d* is returned.
Expand All @@ -192,9 +192,9 @@ def get_recursively(d, keys, default=_sentinel):
because it allows more flexibility.
If *d* is not a dictionary or if *keys* have unknown types,
:exc:`~lena.core.LenaTypeError` is raised.
:exc:`.LenaTypeError` is raised.
If *keys* is a dictionary with more than one key at some level,
:exc:`~lena.core.LenaValueError` is raised.
:exc:`.LenaValueError` is raised.
"""
has_default = default is not _sentinel
if not isinstance(d, dict):
Expand Down Expand Up @@ -290,7 +290,7 @@ def intersection(*dicts, **kwargs):
If any of *dicts* is not a dictionary
or if some *kwargs* are unknown,
:exc:`~lena.core.LenaTypeError` is raised.
:exc:`.LenaTypeError` is raised.
"""
if not all([isinstance(d, dict) for d in dicts]):
raise lena.core.LenaTypeError(
Expand Down Expand Up @@ -379,7 +379,7 @@ def str_to_dict(s):
Dots represent nested dictionaries.
*s*, if not empty, must have at least two dot-separated parts
(*a.b*), otherwise :exc:`~lena.core.LenaValueError` is raised.
(*a.b*), otherwise :exc:`.LenaValueError` is raised.
If *s* is empty, an empty dictionary is returned.
*s* can be a dictionary. In this case it is returned as it is.
Expand Down Expand Up @@ -448,7 +448,7 @@ def update_nested(d, other):
If *d[key]* is not a dictionary
or if there is not one key in *other*,
:exc:`~lena.core.LenaValueError` is raised.
:exc:`.LenaValueError` is raised.
"""
if not isinstance(other, dict) or len(other) != 1:
raise lena.core.LenaValueError(
Expand Down Expand Up @@ -499,7 +499,7 @@ def update_recursively(d, other):
True
Both *d* and *other* must be dictionaries,
otherwise :exc:`~lena.core.LenaTypeError` is raised.
otherwise :exc:`.LenaTypeError` is raised.
"""
if isinstance(other, str):
other = str_to_dict(other)
Expand Down
16 changes: 8 additions & 8 deletions lena/core/adapters.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ def __init__(self, el, call=_SENTINEL):
it is checked whether *el* is callable itself.
If :class:`Call` failed to instantiate with *el* and *call*,
:exc:`~lena.core.LenaTypeError` is raised.
:exc:`.LenaTypeError` is raised.
"""
_init_callable(self, el, call)

Expand All @@ -109,7 +109,7 @@ def __init__(self, el, fill="fill", compute="compute"):
In this case *compute* is *request*.
If callable methods *fill* and *compute* or *request*
were not found, :exc:`~lena.core.LenaTypeError` is raised.
were not found, :exc:`.LenaTypeError` is raised.
"""
fill_method = getattr(el, fill, None)
compute_method = getattr(el, compute, None)
Expand Down Expand Up @@ -153,7 +153,7 @@ def __init__(self, el, fill_into=_SENTINEL, explicit=True):
then *fill_into* method is searched, then *__call__*,
then *run*.
If none of them is found and callable,
:exc:`~lena.core.LenaTypeError` is raised.
:exc:`.LenaTypeError` is raised.
Note that callable elements and elements with *fill_into* method
have different interface.
Expand Down Expand Up @@ -244,11 +244,11 @@ def __init__(self, el, fill="fill", request="request", reset=True, bufsize=1):
:attr:`bufsize` is the maximum size of subslices during *run*.
*bufsize* must be a natural number,
otherwise :exc:`~lena.core.LenaValueError` is raised.
otherwise :exc:`.LenaValueError` is raised.
If callable *fill* and *request* methods were not found,
or *FillRequest* could not be derived from *FillCompute*,
or if *reset* is ``True``, but *el* has no method *reset*,
:exc:`~lena.core.LenaTypeError` is raised.
:exc:`.LenaTypeError` is raised.
"""
fill = getattr(el, fill, None)
request = getattr(el, request, None)
Expand Down Expand Up @@ -390,10 +390,10 @@ def __init__(self, el, run=_SENTINEL):
*Run(None, run=<my_function>)*.
If the initialization failed,
:exc:`~lena.core.LenaTypeError` is raised.
:exc:`.LenaTypeError` is raised.
:class:`Run` is used implicitly during the initialization
of :class:`~lena.core.Sequence`.
of :class:`.Sequence`.
"""
if run is _SENTINEL:
# no explicit method name given
Expand Down Expand Up @@ -466,7 +466,7 @@ def __init__(self, el, call=_SENTINEL):
it is checked whether *el* is callable itself.
If :class:`SourceEl` failed to instantiate with *el* and *call*,
:exc:`~lena.core.LenaTypeError` is raised.
:exc:`.LenaTypeError` is raised.
"""
_init_callable(self, el, call)

Expand Down
4 changes: 2 additions & 2 deletions lena/core/fill_compute_seq.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,12 +72,12 @@ def __init__(self, *args):
only the first one is chosen
(the subsequent ones are used as simple *Run* elements).
To change that, explicitly cast the first element
to :class:`~lena.core.FillInto`.
to :class:`.FillInto`.
If *FillCompute* element was not found,
or if the sequences before and after that
could not be correctly initialized,
:exc:`~lena.core.LenaTypeError` is raised.
:exc:`.LenaTypeError` is raised.
"""
# *args* can consist of one tuple, which is in that case expanded.
_init_sequence_with_el(
Expand Down
6 changes: 3 additions & 3 deletions lena/core/fill_request_seq.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,17 @@ def __init__(self, *args, **kwargs):
only the first one is chosen
(the subsequent ones are used as simple *Run* elements).
To change that, explicitly cast the first element
to :class:`~lena.core.FillInto`.
to :class:`.FillInto`.
*kwargs* can contain *bufsize*, which is used during *run*.
See :class:`FillRequest` for more information on *run*.
By default *bufsize* is *1*. Other *kwargs* raise
:exc:`~lena.core.LenaTypeError`.
:exc:`.LenaTypeError`.
If *FillRequest* element was not found,
or if the sequences before or after that
could not be correctly initialized,
:exc:`~lena.core.LenaTypeError` is raised.
:exc:`.LenaTypeError` is raised.
"""
# *args* can consist of one tuple, which in that case is expanded.
if "bufsize" in kwargs:
Expand Down
8 changes: 4 additions & 4 deletions lena/core/fill_seq.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def fill(self, value):
class FillSeq(lena_sequence.LenaSequence):
"""Sequence with :meth:`fill` method.
Sequence of :class:`~lena.core.FillInto` elements,
Sequence of :class:`.FillInto` elements,
each filling the following ones.
The last element has *fill* method and is filled itself.
Expand All @@ -33,14 +33,14 @@ class FillSeq(lena_sequence.LenaSequence):

def __init__(self, *args):
"""*args* except the last one are
:class:`~lena.core.FillInto` elements.
:class:`.FillInto` elements.
The last argument must have a *fill* method.
If any argument
could not be converted to :class:`~lena.core.FillInto`,
could not be converted to :class:`.FillInto`,
or if the last argument has no *fill* method,
or if an *args* is empty,
:exc:`~lena.core.LenaTypeError` is raised.
:exc:`.LenaTypeError` is raised.
"""
self._seq = []

Expand Down
8 changes: 4 additions & 4 deletions lena/core/split.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,15 +66,15 @@ class Split(object):
def __init__(self, seqs, bufsize=1000, copy_buf=True):
"""*seqs* must be a list of Sequence, Source, FillComputeSeq
or FillRequestSeq sequences
(any other container will raise :exc:`~lena.core.LenaTypeError`).
(any other container will raise :exc:`.LenaTypeError`).
If *seqs* is empty, *Split* acts as an empty *Sequence* and
yields all values it receives.
*bufsize* is the size of the buffer for the input flow.
If *bufsize* is ``None``,
whole input flow is materialized in the buffer.
*bufsize* must be a natural number or ``None``,
otherwise :exc:`~lena.core.LenaValueError` is raised.
otherwise :exc:`.LenaValueError` is raised.
*copy_buf* sets whether the buffer should be copied during *run*.
This is important if different sequences can change input data
Expand Down Expand Up @@ -144,8 +144,8 @@ def __call__(self):
After its flow is empty, next sequence is called, etc.
This method is available only if each self sequence is a
:class:`~lena.core.Source`,
otherwise :exc:`~lena.core.LenaAttributeError` is raised during the execution.
:class:`.Source`,
otherwise :exc:`.LenaAttributeError` is raised during the execution.
"""
if self._n_seq_types != 1 or not ct.is_source(self._sequences[0]):
raise exceptions.LenaAttributeError(
Expand Down
4 changes: 2 additions & 2 deletions lena/flow/cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ def drop_cache(self):
"""Remove file with cache if that exists, pass otherwise.
If cache exists and is readable, but could not be deleted,
:exc:`~lena.core.LenaEnvironmentError` is raised."""
:exc:`.LenaEnvironmentError` is raised."""
try:
os.remove(self._filename)
except OSError:
Expand Down Expand Up @@ -117,7 +117,7 @@ def run(self, flow):
def alter_sequence(seq):
"""If the Sequence *seq* contains a :class:`Cache`,
which has an up-to-date cache,
a :class:`~lena.core.Source` is built
a :class:`.Source` is built
based on the flattened *seq* and returned.
Otherwise the *seq* is returned unchanged.
"""
Expand Down
6 changes: 3 additions & 3 deletions lena/flow/elements.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ class TransformIf(object):
and different flows should be transformed
to common data types (like Histograms) before merging.
In some cases, however, there emerge values of very different types
(like in :class:`~lena.flow.SplitIntoBins`),
(like in :class:`.SplitIntoBins`),
and this class may be useful.
Todo: probably it should be structure-transparent
(that is work for histogram content directly)
Expand All @@ -99,10 +99,10 @@ class TransformIf(object):
"""

def __init__(self, select, seq):
"""*select* is converted to :class:`~lena.flow.Selector`.
"""*select* is converted to :class:`.Selector`.
See its specifications for available options.
*seq* is converted to :class:`~lena.core.Sequence`.
*seq* is converted to :class:`.Sequence`.
"""
if isinstance(select, lena.flow.Selector):
self._select = select
Expand Down
2 changes: 1 addition & 1 deletion lena/flow/functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def seq_map(seq, container, one_result=True):
This can be a list or a single value.
If *one_result* is True, the result must be a single value.
In this case, if results contain less than or more than one element,
:exc:`~lena.core.LenaValueError` is raised.
:exc:`.LenaValueError` is raised.
The list of results (lists or single values) is returned.
The results are in the same order as read from the *container*.
Expand Down
2 changes: 1 addition & 1 deletion lena/flow/group_by.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def __init__(self, group_by):
a subcontext (see :func:`.get_recursively`).
If *group_by* is not a callable or a string,
:exc:`~lena.core.LenaTypeError` is raised.
:exc:`.LenaTypeError` is raised.
"""
self.groups = dict()
if callable(group_by):
Expand Down
4 changes: 2 additions & 2 deletions lena/flow/group_plots.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def __init__(self, group_by, select, transform=(), scale=None,
If *scale* is not an instance of :class:`.GroupScale`,
it is converted to that class.
If a plot could not be rescaled,
:exc:`~lena.core.LenaValueError` is raised.
:exc:`.LenaValueError` is raised.
For more options, use :class:`.GroupScale`.
*transform* is a sequence, which processes individual plots
Expand Down Expand Up @@ -101,7 +101,7 @@ def run(self, flow):
to the given value or plot.
If that plot was not selected (is missing in the captured group)
or its norm could not be calculated,
:exc:`~lena.core.LenaValueError` is raised.
:exc:`.LenaValueError` is raised.
"""
def update_group_with_context(grp):
# get common context
Expand Down
4 changes: 2 additions & 2 deletions lena/flow/group_scale.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class GroupScale(object):
def __init__(self, scale_to, allow_zero_scale=False, allow_unknown_scale=False):
"""*scale_to* defines the method of scaling.
If a number is given, group items are scaled to that.
Otherwise it is converted to a :class:`~lena.flow.Selector`,
Otherwise it is converted to a :class:`.Selector`,
which must return a unique item from the group.
Group items will be scaled to the scale of that item.
Expand Down Expand Up @@ -42,7 +42,7 @@ def scale(self, group):
If any item could not be rescaled and
options were not set to ignore that,
:exc:`~lena.core.LenaValueError` is raised.
:exc:`.LenaValueError` is raised.
"""
# get scale to be used
if isinstance(self._scale_to, numbers.Number):
Expand Down
2 changes: 1 addition & 1 deletion lena/flow/selectors.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ def __init__(self, selector):
If it is a *tuple*, boolean *and* is applied to the results.
If incorrect arguments are provided,
:exc:`~lena.core.LenaTypeError` is raised.
:exc:`.LenaTypeError` is raised.
"""
# Callable classes are treated as classes, not callables
if inspect.isclass(selector):
Expand Down

0 comments on commit 4faf240

Please sign in to comment.