Skip to content

Commit

Permalink
Merge branch 'main' into test-with-flox
Browse files Browse the repository at this point in the history
* main:
  Avoid quadratic behaviour when dropping bounds (xarray-contrib#349)
  Bump actions/setup-python from 3 to 4 (xarray-contrib#344)
  rstcheck with sphinx config (xarray-contrib#348)
  Add howfairis badge. (xarray-contrib#308)
  [pre-commit.ci] pre-commit autoupdate (xarray-contrib#345)
  • Loading branch information
dcherian committed Jul 15, 2022
2 parents 6298060 + 3ddf96a commit 84645b0
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/pypi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v3
uses: actions/setup-python@v4
with:
python-version: '3.x'
- name: Install dependencies
Expand Down
13 changes: 7 additions & 6 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ repos:
files: .+\.py$

- repo: https://github.com/psf/black
rev: 22.3.0
rev: 22.6.0
hooks:
- id: black

Expand All @@ -19,15 +19,16 @@ repos:
- id: flake8

- repo: https://github.com/pre-commit/mirrors-mypy
rev: v0.942
rev: v0.961
hooks:
- id: mypy
additional_dependencies: [types-all]

- repo: https://github.com/myint/rstcheck
rev: 3f92957478422df87bd730abde66f089cc1ee19b
- repo: https://github.com/rstcheck/rstcheck
rev: v5.0.0
hooks:
- id: rstcheck
additional_dependencies: [sphinx]

- repo: https://github.com/executablebooks/mdformat
rev: 0.7.14
Expand All @@ -51,14 +52,14 @@ repos:
additional_dependencies: [mdformat==0.7.14]

- repo: https://github.com/asottile/pyupgrade
rev: v2.31.1
rev: v2.34.0
hooks:
- id: pyupgrade
args:
- "--py37-plus"

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.1.0
rev: v4.3.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
Expand Down
3 changes: 3 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@
.. image:: https://zenodo.org/badge/267381269.svg
:target: https://zenodo.org/badge/latestdoi/267381269

.. image:: https://img.shields.io/badge/fair--software.eu-%E2%97%8F%20%20%E2%97%8F%20%20%E2%97%8F%20%20%E2%97%8F%20%20%E2%97%8B-yellow
:target: https://fair-software.eu

cf-xarray
=========

Expand Down
5 changes: 3 additions & 2 deletions cf_xarray/accessor.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ def _apply_single_mapper(mapper):

try:
results = mapper(obj, key)
except KeyError as e:
except (KeyError, ValueError) as e:
if error or "I expected only one." in repr(e):
raise e
else:
Expand Down Expand Up @@ -621,6 +621,7 @@ def _getitem(
"""

obj = accessor._obj
all_bounds = obj.cf.bounds if isinstance(obj, Dataset) else {}
kind = str(type(obj).__name__)
scalar_key = isinstance(key, str)

Expand All @@ -638,7 +639,7 @@ def drop_bounds(names):
if not isinstance(obj, DataArray) and scalar_key:
bounds = set()
for name in names:
bounds.update(obj.cf.bounds.get(name, []))
bounds.update(all_bounds.get(name, []))
names = set(names) - bounds
return names

Expand Down

0 comments on commit 84645b0

Please sign in to comment.