Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add typehints to pyhf.tensor #1940

Merged
merged 23 commits into from
Aug 26, 2022
Merged
Show file tree
Hide file tree
Changes from 18 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[report]
exclude_lines =
if TYPE_CHECKING:
omit =
src/pyhf/typing.py
11 changes: 9 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,16 @@ repos:
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v0.971
hooks:
- id: mypy
- &mypy
matthewfeickert marked this conversation as resolved.
Show resolved Hide resolved
id: mypy
name: mypy with Python 3.7
files: src
args: []
additional_dependencies:
['numpy', 'types-tqdm', 'click', 'types-jsonpatch', 'types-pyyaml', 'types-jsonschema', 'importlib_metadata', 'packaging']
args: ["--python-version=3.7"]
- <<: *mypy
name: mypy with Python 3.10
args: ["--python-version=3.10"]

- repo: https://github.com/nbQA-dev/nbQA
rev: 1.4.0
Expand Down
3 changes: 3 additions & 0 deletions codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,6 @@ coverage:
project:
default:
threshold: 0.2%

ignore:
- "**/typing.py"
20 changes: 11 additions & 9 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -108,24 +108,20 @@ warn_unreachable = true

[[tool.mypy.overrides]]
module = [
'matplotlib.*',
'jax.*',
'click.*',
'click_completion.*',
'numpy.*',
'matplotlib.*',
'scipy.*',
'jsonpatch.*',
'tensorflow.*',
'tensorflow_probability.*',
'torch.*',
'uproot.*',
'yaml.*',
'jsonschema.*',
'tqdm.*',
]
ignore_missing_imports = true


matthewfeickert marked this conversation as resolved.
Show resolved Hide resolved
[[tool.mypy.overrides]]
module = [
'pyhf',
'pyhf.tensor.*',
'pyhf.optimize.*',
'pyhf.contrib.*',
'pyhf.infer.*',
Expand All @@ -146,5 +142,11 @@ module = [
'pyhf.pdf',
'pyhf.simplemodels',
'pyhf.probability',
'pyhf.tensor.common.*',
'pyhf.tensor.manager.*',
'pyhf.tensor',
'pyhf.tensor.jax_backend.*',
'pyhf.tensor.tensorflow_backend.*',
'pyhf.tensor.pytorch_backend.*',
]
ignore_errors = true
2 changes: 1 addition & 1 deletion src/pyhf/readxml.py
Original file line number Diff line number Diff line change
Expand Up @@ -438,7 +438,7 @@ def parse(
mounts = mounts or []
toplvl = ET.parse(configfile)
inputs = tqdm.tqdm(
[x.text for x in toplvl.findall('Input')],
[x.text for x in toplvl.findall('Input') if x.text],
unit='channel',
disable=not (track_progress),
)
Expand Down
Loading