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

DM-36974: Clean up mypy annotations in lsst.daf.butler.script #753

Merged
merged 4 commits into from Nov 15, 2022

Conversation

timj
Copy link
Member

@timj timj commented Nov 11, 2022

We were using annotations in many of the files but allowed mypy to ignore them if they were not in typed functions. This fixes the entire directory so that everything is annotated. Mostly annotations and some very minor code rearrangements to let the annotations work (and some new variables created for the same reason)

Checklist

  • ran Jenkins
  • added a release note for user-visible changes to doc/changes

@timj timj requested a review from andy-slac November 11, 2022 21:48
Copy link
Contributor

@andy-slac andy-slac left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, few minor comments.

python/lsst/daf/butler/script/_associate.py Outdated Show resolved Hide resolved
python/lsst/daf/butler/script/_pruneDatasets.py Outdated Show resolved Hide resolved
from .._butler import Butler
from ..core import ValidationError


def configValidate(repo, quiet, dataset_type, ignore):
def configValidate(repo: str, quiet: bool, dataset_type: str, ignore: str) -> bool:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think dataset_type and ignore should be list[str], doctring needs some fixing too.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed. The problem being that we declare the API this calls to accept Iterable[str] and str itself matches that type. Grr.

python/lsst/daf/butler/script/queryDatasetTypes.py Outdated Show resolved Hide resolved
python/lsst/daf/butler/script/queryDimensionRecords.py Outdated Show resolved Hide resolved
@codecov
Copy link

codecov bot commented Nov 12, 2022

Codecov Report

Base: 85.30% // Head: 85.30% // Decreases project coverage by -0.00% ⚠️

Coverage data is based on head (7d03ce1) compared to base (0e87300).
Patch coverage: 83.84% of modified lines in pull request are covered.

❗ Current head 7d03ce1 differs from pull request most recent head d92793c. Consider uploading reports for the commit d92793c to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #753      +/-   ##
==========================================
- Coverage   85.30%   85.30%   -0.01%     
==========================================
  Files         260      260              
  Lines       34385    34424      +39     
  Branches     5806     5802       -4     
==========================================
+ Hits        29333    29366      +33     
- Misses       3815     3819       +4     
- Partials     1237     1239       +2     
Impacted Files Coverage Δ
...on/lsst/daf/butler/script/register_dataset_type.py 100.00% <ø> (ø)
python/lsst/daf/butler/script/exportCalibs.py 18.64% <45.45%> (+4.09%) ⬆️
python/lsst/daf/butler/script/queryDataIds.py 81.48% <66.66%> (-0.52%) ⬇️
...on/lsst/daf/butler/script/queryDimensionRecords.py 69.23% <66.66%> (+5.23%) ⬆️
python/lsst/daf/butler/script/retrieveArtifacts.py 87.50% <66.66%> (+1.78%) ⬆️
python/lsst/daf/butler/script/queryDatasets.py 84.00% <84.61%> (-2.77%) ⬇️
python/lsst/daf/butler/script/_pruneDatasets.py 97.61% <90.00%> (-2.39%) ⬇️
python/lsst/daf/butler/script/_associate.py 60.00% <100.00%> (+10.00%) ⬆️
python/lsst/daf/butler/script/butlerImport.py 77.77% <100.00%> (+11.11%) ⬆️
...thon/lsst/daf/butler/script/certifyCalibrations.py 35.29% <100.00%> (+4.04%) ⬆️
... and 12 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

We are supposed to use the return value and not assume internal
state change.
@timj timj merged commit b7b9b38 into main Nov 15, 2022
@timj timj deleted the tickets/DM-36974 branch November 15, 2022 04:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants