For some reason, the code allowed using "convenience names" for
accessing properties since commit 58ac717f. To me, this looks like an
obvious anti-pattern because accessing a single property via three
different names only makes the code less readable. Let's kill this
"feature".
In case of the `Power` class, the code used "ase" and "nli" on the
majority of places, so let's use these abbreviations instead of their
spelt-out variants.
SpectralInformation was "clean" already, but there were calls to the
`update()` wrapper around the `namedtuple._replace`. Given that there
were no property aliases, it's safe to just call `_replace()` directly.
In case of the `Pref` class, once again always use `p_span0`, `p_spani`
instead of `p0` and `pi` -- it's a trivial change.
Since ReadTheDocs does not support [1] running as a CI check on GitHub
yet, let's make sure that we at least run sphinx. This would have caught
a recent docs breakage (see parent commit).
[1] https://github.com/readthedocs/readthedocs.org/issues/1340
Docs building started failing after our dependency update. The reason is
that the updated sphinx bibtex extension started being a bit stricter in
their interpretation of bibliography files:
parsing bibtex file /home/jkt/work/TIP/oopt-gnpy/docs/biblio.bib...
Exception occurred:
File "/home/jkt/work/TIP/_py/lib64/python3.6/site-packages/pybtex/errors.py", line 78, in report_error
raise exception
pybtex.database.input.bibtex.DuplicatePersonField: entry with key bononi_modeling_2012 has a duplicate year field
Fix this by using `date` as field name when a full date is given.
I misunderstood how Travis CI works; it's not a subshell, it's something
which affects the other commands. Let's just run everything from the
top-level directory.
Pinning dependencies to a specific version is safe in terms of
preventing accidental breakage, but it has a cost of possibly using
outdated dependencies.
Let's see if we can rely on the semantic versioning of our dependencies
here.
I'm doing this instead of other approaches (such as splitting the
top-level deps from "the rest of the dep chain" [1][2]) because I require
additional tools in my venv, such as the python-lnaguage-server. There
would be little point in injecting these into requirements to be used by
other people.
[1] https://www.kennethreitz.org/essays/a-better-pip-workflow
[2] 59eb51c026
Listing all transitive dependencies, including their respective versions
(as done by `pip freeze`, for example) is something which effectively
leads to installing outdated and possibly vulnerable software.
Let's get rid of the transitive dependencies.
Thanks to Esther for noticing.
The code determines these paths relative to the actual example .py file
already. Given that `pytest` and other bits expect to run from the
top-levle directory, let's remove this misleading instruction from the
docs.
I do not have a vector image of this one, unfortunately. The data
apparently comes from "someone at TIP", perhaps a hired graphic
designer. It was passed to me by Diego Landa when I asked for the
original dataset.
Rather than do the None-dance and document the default value within a
docstring, let's use the default value directly. This is safe because
numbers are immutable.
Because default arguments are evaluated *once*, not every time they are
called, a mutable default value is not "reset", and this happens:
>>> from gnpy.core.node import Node
>>> x=Node('123')
>>> y=Node('456')
>>> print(x.metadata)
{'location': Location(latitude=0, longitude=0, city=None, region=None)}
>>> print(y.metadata)
{'location': Location(latitude=0, longitude=0, city=None, region=None)}
>>> y.metadata['foo']=123
>>> print(x.metadata)
{'location': Location(latitude=0, longitude=0, city=None, region=None), 'foo': 123}
This is easily fixable by using an immutable value as a placeholder
here.
This feature is intended to support designs such as OpenROADM where the
line degree integrates a specific preamp/booster pair. In that case, it
does not make sense for our autodesign to "pick an amplifier". The
restrictions can be activated by:
- Listing them in `eqpt_config.json`, so that they are effective for all
ROADM instances.
- On a per-ROADM basis within the Excel sheet or the JSON definitions.
Restrictions apply to an entire ROADM as a whole, not to the individual
degrees.
If a per-degree exception is needed, the amplifier of this degree can be
defined in the equipment sheet or in the network definition.
If no booster amplifier should be placed on a degree, use the `Fused`
node in place of an amplifier.
Signed-off-by: Esther Le Rouzic <esther.lerouzic@orange.com>
Co-authored-by: Jan Kundrát <jan.kundrat@telecominfraproject.com>
testTopology listed corlay twice in Eqpt although it is a ILA.
should appear only once in node A column
update expected parser results for this change in tests/data
Signed-off-by: EstherLerouzic <esther.lerouzic@orange.com>
program was not correctly listing nodes when links duplicate EDFA entries.
I refactored it to make it simpler to understand.
I added coordinates on ../tests/data/testTopology.xls for plot purpose
Signed-off-by: EstherLerouzic <esther.lerouzic@orange.com>
I have no idea which one of the existing pypi modules is best for these,
and given that we're using just two escape codes, I think it makes sense
not to bother with a more capable third-party module just for two magic
strings.
Once the actual config-parsing code start raising these exceptions
instead of directly calling sys.exit(), the user experience would
deteriorate due to raw exception traces. There's little value in the
trace itself, so just wrap the whole config loading with pretty error
formatting.
We still do not point to a specific place where that error is defined
(such as a line/column in a given JSON file) because that information is
already lost by the time we perform these checks.
Also, these checks are largely open-coded ad-hoc stuff. Some required
items are not covered, raising KeyError instead. We should get a formal
schema for these...