ESGF / esgf-download

ESGF data transfer and replication tool
https://esgf.github.io/esgf-download/
BSD 3-Clause "New" or "Revised" License
15 stars 2 forks source link

Update pre-commit hooks and address small mypy warnings #19

Closed Zeitsperre closed 1 year ago

Zeitsperre commented 1 year ago

Changes

Discussion

The following was failing for me previously and is still failing now:


mypy.....................................................................Failed
- hook id: mypy
- exit code: 1

esgpull/models/query.py:125: error: Argument "status" to "File" has incompatible type "str"; expected "SQLCoreOperations[FileStatus] | FileStatus"  [arg-type]
esgpull/models/query.py:203: error: Argument "status" to "File" has incompatible type "str"; expected "SQLCoreOperations[FileStatus] | FileStatus"  [arg-type]
esgpull/models/query.py:325: error: Argument "description" to "Tag" has incompatible type "str | None"; expected "SQLCoreOperations[str | None] | str"  [arg-type]
Found 3 errors in 1 file (checked 78 source files)
svenrdz commented 1 year ago

Thanks again for contributing!

This PR is very helpful, I didn't know about precommit.ci, that solves my issue of manually updating versions. I also didn't know about pyupgrade, it's nice to have a tool that decides whether to import from typing or collections.abc, I'm always confused on which one to use.

About the mypy issues that remain, I had to disable it in my editor as it was killing my CPU, and since precommit only runs on staged files, those errors must have gone through silently, good catch!

Zeitsperre commented 1 year ago

@svenrdz

pre-commit.ci has been an enormous help for me dealing with coding conventions and preventing bad code being committed. There are numerous available hooks (https://pre-commit.com/hooks.html) and the configuration I've shared here is self-updating and used in many of the projects I manage.

It might be worthwhile to add the installation process for pre-commit to the contributing guide!