Closed johndoknjas closed 2 weeks ago
Thanks for the PR! I'm a bit reluctant to merge it because type annotations without tests might get outdated quickly when the code changes. Is there a way to test that all type annotations are correct, while ignoring all other typing issues that a tool like Mypy might detect? Could you add such a test?
@jendrikseipp For sure, I'll work on adding a test to do this.
@jendrikseipp I've added a test that runs mypy, disabling error codes that mypy complains about at the moment. All of them seem like codes that in general shouldn't be needed to detect wrong type annotations.
By the way, before disabling the attr-defined
error code, I noticed mypy called out lines 552 and 659 in core.py - not sure if it's right about these being issues.
Thanks, I'll have a closer look at this when time allows.
Hey @jendrikseipp, just following up on this PR.
Thanks for your work on this!
No problem, and thank you for your feedback :)
Description
This PR adds type hints to make it slightly easier for users to use the api. Now for each element from
get_unused_code
, IDEs will display their type asItem
when highlighting over the variable. The same is done for the fields ofItem
, such as makingfilename
's type a Path (removing any potential confusion about whether it's a string).Related Issue
Checklist:
pre-commit run --all-files
to format and lint my code.