Skip to content

Commit 5047e50

Browse files
authored
chore: format update before dropping Python 2/3.5 (#511)
1 parent 6c0351b commit 5047e50

File tree

4 files changed

+66
-71
lines changed

4 files changed

+66
-71
lines changed

.pre-commit-config.yaml

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ repos:
55
- id: black
66

77
- repo: https://github.com/nbQA-dev/nbQA
8-
rev: 0.5.7
8+
rev: 0.5.9
99
hooks:
1010
- id: nbqa-black
1111
additional_dependencies: [black==20.8b1]
@@ -34,7 +34,7 @@ repos:
3434
additional_dependencies: [pyyaml]
3535

3636
- repo: https://github.com/asottile/pyupgrade
37-
rev: v2.7.4
37+
rev: v2.10.0
3838
hooks:
3939
- id: pyupgrade
4040

@@ -43,6 +43,12 @@ repos:
4343
hooks:
4444
- id: isort
4545

46+
- repo: https://github.com/asottile/setup-cfg-fmt
47+
rev: v1.16.0
48+
hooks:
49+
- id: setup-cfg-fmt
50+
args: [--min-py3-version, "3.5"]
51+
4652
- repo: https://github.com/pycqa/flake8
4753
rev: 3.8.4
4854
hooks:
@@ -51,7 +57,7 @@ repos:
5157
additional_dependencies: [flake8-bugbear, flake8-print]
5258

5359
- repo: https://github.com/pre-commit/mirrors-mypy
54-
rev: v0.800
60+
rev: v0.812
5561
hooks:
5662
- id: mypy
5763
files: src

setup.cfg

Lines changed: 54 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,37 @@
11
[metadata]
22
name = boost_histogram
3+
description = The Boost::Histogram Python wrapper.
4+
long_description = file: README.md
5+
long_description_content_type = text/markdown
6+
url = https://github.com/scikit-hep/boost-histogram
37
author = Hans Dembinski and Henry Schreiner
48
author_email = [email protected]
59
maintainer = Hans Dembinski and Henry Schreiner
610
maintainer_email = [email protected]
7-
url = https://github.com/scikit-hep/boost-histogram
8-
description = The Boost::Histogram Python wrapper.
9-
long_description = file: README.md
10-
long_description_content_type = text/markdown
11-
license = BSD 3-Clause License
11+
license = BSD-3-Clause
12+
license_file = LICENSE
1213
classifiers =
1314
Development Status :: 4 - Beta
1415
Intended Audience :: Developers
1516
Intended Audience :: Information Technology
1617
Intended Audience :: Science/Research
1718
License :: OSI Approved :: BSD License
18-
Operating System :: Microsoft :: Windows
1919
Operating System :: MacOS
20+
Operating System :: Microsoft :: Windows
2021
Operating System :: POSIX
2122
Operating System :: Unix
23+
Programming Language :: C++
2224
Programming Language :: Python
25+
Programming Language :: Python :: 2
2326
Programming Language :: Python :: 2.7
27+
Programming Language :: Python :: 3
2428
Programming Language :: Python :: 3.5
2529
Programming Language :: Python :: 3.6
2630
Programming Language :: Python :: 3.7
2731
Programming Language :: Python :: 3.8
2832
Programming Language :: Python :: 3.9
29-
Programming Language :: C++
30-
Programming Language :: Python :: Implementation :: PyPy
3133
Programming Language :: Python :: Implementation :: CPython
34+
Programming Language :: Python :: Implementation :: PyPy
3235
Topic :: Scientific/Engineering
3336
Topic :: Scientific/Engineering :: Information Analysis
3437
Topic :: Scientific/Engineering :: Mathematics
@@ -37,14 +40,14 @@ classifiers =
3740
Topic :: Utilities
3841

3942
[options]
40-
python_requires = >=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*
4143
packages = find:
44+
install_requires =
45+
numpy>=1.13.3
46+
enum34>=1.1;python_version < '3.4'
47+
typing>=3.5;python_version < '3.5'
48+
python_requires = >=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*
4249
package_dir =
4350
=src
44-
install_requires =
45-
numpy >=1.13.3
46-
typing >= 3.5; python_version < '3.5'
47-
enum34 >= 1.1; python_version < '3.4'
4851

4952
[options.packages.find]
5053
where = src
@@ -53,7 +56,7 @@ exclude =
5356
extern
5457

5558
[tool:pytest]
56-
junit_family=xunit2
59+
junit_family = xunit2
5760
addopts = --benchmark-disable -Wd --strict-markers
5861
xfail_strict = True
5962
testpaths =
@@ -83,22 +86,7 @@ per-file-ignores =
8386
warn_unused_configs = True
8487
python_version = 2.7
8588
files = src
86-
87-
# Currently (0.800) identical to --strict
88-
# disallow_any_generics = True
89-
# disallow_subclassing_any = True
90-
# disallow_untyped_calls = True
91-
# disallow_untyped_defs = True
92-
# disallow_incomplete_defs = True
9389
check_untyped_defs = True
94-
# disallow_untyped_decorators = True
95-
# no_implicit_optional = True
96-
# warn_redundant_casts = True
97-
# warn_unused_ignores = True
98-
# warn_return_any = True
99-
# no_implicit_reexport = True
100-
# strict_equality = True
101-
10290

10391
[mypy-numpy]
10492
ignore_missing_imports = True
@@ -114,40 +102,40 @@ ignore_missing_imports = True
114102

115103
[check-manifest]
116104
ignore =
117-
.all-contributorsrc
118-
.clang-format
119-
.cmake-format.yaml
120-
.pre-commit-config.yaml
121-
.pre-commit-nodocker.yaml
122-
.readthedocs.yml
123-
.clang-tidy
124-
examples/**
125-
notebooks/**
126-
docs/**
127-
scripts/**
128-
dev-requirements.txt
129-
extern/**/*.py
130-
extern/**/*.md
131-
extern/**/*.rst
132-
extern/**/*.toml
133-
extern/*/checks/**
134-
extern/*/test/**
135-
extern/*/benchmark/**
136-
extern/*/doc/**
137-
extern/*/examples/**
138-
extern/*/tools/**
139-
extern/pybind11/docs/**
140-
extern/pybind11/tests/**
141-
CMakeLists.txt
142-
extern/*/README.md
143-
CONTRIBUTING.md
144-
Jamfile
145-
configure
146-
*.clang_complete
147-
*.html
148-
*.in
149-
*.json
150-
*.yml
151-
src/boost_histogram/_core.*
152-
src/boost_histogram/version.py
153-
tests/.pytest_cache/**
105+
.all-contributorsrc
106+
.clang-format
107+
.cmake-format.yaml
108+
.pre-commit-config.yaml
109+
.pre-commit-nodocker.yaml
110+
.readthedocs.yml
111+
.clang-tidy
112+
examples/**
113+
notebooks/**
114+
docs/**
115+
scripts/**
116+
dev-requirements.txt
117+
extern/**/*.py
118+
extern/**/*.md
119+
extern/**/*.rst
120+
extern/**/*.toml
121+
extern/*/checks/**
122+
extern/*/test/**
123+
extern/*/benchmark/**
124+
extern/*/doc/**
125+
extern/*/examples/**
126+
extern/*/tools/**
127+
extern/pybind11/docs/**
128+
extern/pybind11/tests/**
129+
CMakeLists.txt
130+
extern/*/README.md
131+
CONTRIBUTING.md
132+
Jamfile
133+
configure
134+
*.clang_complete
135+
*.html
136+
*.in
137+
*.json
138+
*.yml
139+
src/boost_histogram/_core.*
140+
src/boost_histogram/version.py
141+
tests/.pytest_cache/**

src/boost_histogram/_internal/hist.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ def __init__(self, *axes, **kwargs):
138138

139139
# Support objects that provide a to_boost method, like Uproot
140140
elif len(axes) == 1 and hasattr(axes[0], "_to_boost_histogram_"):
141-
self.__init__(axes[0]. _to_boost_histogram_())
141+
self.__init__(axes[0]._to_boost_histogram_()) # type: ignore
142142
return
143143

144144
# Keyword only trick (change when Python2 is dropped)
@@ -601,7 +601,7 @@ def to_numpy(self, flow=False, **kwargs):
601601
if dd:
602602
return hist, return_tuple[1:]
603603
else:
604-
return (hist,) + return_tuple[1:]
604+
return (hist,) + return_tuple[1:]
605605

606606
@inject_signature("self, *, deep=True")
607607
def copy(self, **kwargs):

tests/test_internal_histogram.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,7 @@ def test_numpy_dd():
135135
assert_array_equal(x1, x2)
136136
assert_array_equal(y1, y2)
137137

138+
138139
def test_numpy_weights():
139140
h = bh.Histogram(
140141
bh.axis.Regular(10, 0, 1), bh.axis.Regular(5, 0, 1), storage=bh.storage.Weight()

0 commit comments

Comments
 (0)