Skip to content

Commit

Permalink
Merge pull request #36 from khaeru/hotfix/2021-02-22
Browse files Browse the repository at this point in the history
Small fixes
  • Loading branch information
khaeru committed Feb 22, 2021
2 parents 7561ce7 + acb88a3 commit 1b7567d
Show file tree
Hide file tree
Showing 8 changed files with 21 additions and 13 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:
- name: Lint with flake8 & isort
run: |
pip install flake8 isort
flake8 --count --max-complexity=15 --show-source --statistics
flake8 --count --max-complexity=14 --show-source --statistics
isort --check-only .
- name: Check typing with mypy
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,5 +47,5 @@ jobs:
uses: pypa/gh-action-pypi-publish@v1.4.1
if: github.event_name == 'release'
with:
user: ${{ secrets.PYPI_USERNAME }}
password: ${{ secrets.PYPI_PASSWORD }}
user: __token__
password: ${{ secrets.PYPI_TOKEN }}
4 changes: 2 additions & 2 deletions doc/releasing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Address any failures before releasing.
2. Tag the release candidate version, i.e. with a ``rcN`` suffix, and push::

$ git tag v1.2.3rc1
$ git push --tags
$ git push --tags origin master

3. Check:

Expand All @@ -31,7 +31,7 @@ Address any failures before releasing.
4. (optional) Tag the release itself and push::

$ git tag v1.2.3
$ git push --tags
$ git push --tags origin master

This step (but *not* step (2)) can also be performed directly on GitHub; see (5), next.

Expand Down
9 changes: 7 additions & 2 deletions doc/whatsnew.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,13 @@ What's new
:backlinks: none
:depth: 1

.. Next release
.. ============
Next release
============

Bug fixes
---------

- :meth:`.Computer.add_single` incorrectly calls :meth:`.check_keys` on iterables (e.g. :class:`pandas.DataFrame`) that are not computations (:pull:`36`).

v1.1.0 (2021-02-16)
===================
Expand Down
3 changes: 2 additions & 1 deletion genno/compat/pyam/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@ def iamc(c: Computer, info):
collapse_func = collapse_info.pop("callback", util.collapse)

# Use the Computer method to add the coversion step
keys.extend(
# NB convert_pyam() returns a single key when applied to a single key
keys.append(
c.convert_pyam(
keys[-1],
rename=info.pop("rename", {}),
Expand Down
9 changes: 6 additions & 3 deletions genno/core/computer.py
Original file line number Diff line number Diff line change
Expand Up @@ -318,9 +318,12 @@ def add_single(self, key, *computation, strict=False, index=False):
# Key already exists in graph
raise KeyExistsError(key)

# Check that keys used in *comp* are in the graph
keylike = filter(lambda e: isinstance(e, (str, Key)), computation)
self.check_keys(*keylike)
# Check valid computations: a tuple with a callable, or a list of other
# keys. Don't check a single value that is iterable, e.g. pd.DataFrame
if isinstance(computation, (list, tuple)):
# Check that keys used in *comp* are in the graph
keylike = filter(lambda e: isinstance(e, (str, Key)), computation)
self.check_keys(*keylike)

if index:
# String equivalent of *key* with all dimensions dropped, but name
Expand Down
2 changes: 1 addition & 1 deletion genno/core/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@


class ComputationError(Exception):
"""Wrapper to print intelligible exception information for :meth:`.get`.
"""Wrapper to print intelligible exception information for :meth:`.Computer.get`.
In order to aid in debugging, this helper:
Expand Down
1 change: 0 additions & 1 deletion genno/tests/test_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
from genno.compat.pyam import HAS_PYAM
from genno.config import HANDLERS, handles


# NB ixmp is currently used in the genno test suite: ixmp.testing.run_notebook is
# imported by test_exceptions.py. This in turn cases ixmp to register its own
# handlers: 2 new, and 1 overriding the built-in one for "units:".
Expand Down

0 comments on commit 1b7567d

Please sign in to comment.