Skip to content

Commit

Permalink
Add pyupgrade to the list of pre-commit hooks (#69)
Browse files Browse the repository at this point in the history
  • Loading branch information
andersy005 authored Jan 13, 2022
1 parent 814b809 commit a659ae8
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 33 deletions.
25 changes: 10 additions & 15 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,20 @@ repos:
- id: check-json
- id: check-yaml
- id: double-quote-string-fixer
- id: debug-statements
- id: mixed-line-ending

- repo: https://github.com/asottile/pyupgrade
rev: v2.31.0
hooks:
- id: pyupgrade
args:
- '--py37-plus'

- repo: https://github.com/psf/black
rev: 21.12b0
hooks:
- id: black
- id: black-jupyter

- repo: https://github.com/keewis/blackdoc
rev: v0.3.4
Expand All @@ -24,10 +33,6 @@ repos:
hooks:
- id: flake8

- repo: https://github.com/asottile/seed-isort-config
rev: v2.2.0
hooks:
- id: seed-isort-config
- repo: https://github.com/PyCQA/isort
rev: 5.10.1
hooks:
Expand All @@ -37,13 +42,3 @@ repos:
rev: v2.5.1
hooks:
- id: prettier

- repo: https://github.com/nbQA-dev/nbQA
rev: 1.2.2
hooks:
- id: nbqa-black
additional_dependencies: [black==21.7b0]
- id: nbqa-pyupgrade
additional_dependencies: [pyupgrade==2.7.3]
- id: nbqa-isort
additional_dependencies: [isort==v5.9.2]
13 changes: 6 additions & 7 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
#
# complexity documentation build configuration file, created by
# sphinx-quickstart on Tue Jul 9 22:26:36 2013.
Expand Down Expand Up @@ -87,9 +86,9 @@
master_doc = 'index'

# General information about the project.
project = u'intake-thredds'
copyright = u'2019 onwards, intake-thredds developers'
author = u'intake-thredds developers'
project = 'intake-thredds'
copyright = '2019 onwards, intake-thredds developers'
author = 'intake-thredds developers'

# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
Expand Down Expand Up @@ -258,7 +257,7 @@
# Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title, author, documentclass [howto/manual]).
latex_documents = [
('index', 'intake-thredds.tex', u'intake-thredds Documentation', author, 'manual')
('index', 'intake-thredds.tex', 'intake-thredds Documentation', author, 'manual')
]

# The name of an image file (relative to this directory) to place at the top of
Expand Down Expand Up @@ -286,7 +285,7 @@

# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [('index', 'intake-thredds', u'intake-thredds Documentation', [author], 1)]
man_pages = [('index', 'intake-thredds', 'intake-thredds Documentation', [author], 1)]

# If true, show URL addresses after external links.
# man_show_urls = False
Expand All @@ -301,7 +300,7 @@
(
'index',
'intake-thredds',
u'intake-thredds Documentation',
'intake-thredds Documentation',
author,
'intake-thredds',
'One line description of project.',
Expand Down
2 changes: 1 addition & 1 deletion intake_thredds/source.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ def __init__(
metadata=None,
):

super(THREDDSMergedSource, self).__init__(metadata=metadata)
super().__init__(metadata=metadata)
self.urlpath = url
if 'simplecache::' in url:
self.metadata.update({'fsspec_pre_url': 'simplecache::'})
Expand Down
9 changes: 2 additions & 7 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,5 @@ line-length = 100
target-version = ['py38']
skip-string-normalization = true

[tool.nbqa.mutate]
isort = 1
black = 1
pyupgrade = 1

[tool.nbqa.addopts]
pyupgrade = ["--py36-plus"]
[build-system]
requires = ["setuptools>=45", "wheel", "setuptools_scm>=6.2"]
4 changes: 4 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,7 @@ line_length=100
skip=
docs/source/conf.py
setup.py

[tool:pytest]
console_output_style = count
addopts = --cov=./ --cov-report=xml --verbose
1 change: 0 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,5 @@
zip_safe=False,
keywords='intake thredds siphon catalogs',
use_scm_version={'version_scheme': 'post-release', 'local_scheme': 'dirty-tag'},
setup_requires=['setuptools_scm', 'setuptools>=30.3.0'],
classifiers=CLASSIFIERS,
)
4 changes: 2 additions & 2 deletions tests/test_source.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@ def test_THREDDSMergedSource(THREDDSMergedSource_cat):
ds = cat.to_dask()
assert dict(ds.dims) == {'lat': 73, 'lon': 144, 'time': 731}
d = cat.discover()
assert set(d['metadata']['coords']) == set(('lat', 'lon', 'time'))
assert set(d['metadata']['data_vars'].keys()) == set(['air'])
assert set(d['metadata']['coords']) == {'lat', 'lon', 'time'}
assert set(d['metadata']['data_vars'].keys()) == {'air'}


def test_THREDDSMergedSource_long_short(THREDDSMergedSource_cat, THREDDSMergedSource_cat_short):
Expand Down

0 comments on commit a659ae8

Please sign in to comment.