Add type annotations (top-level files)#2751
Conversation
|
Only annotated the vars that I could deduce with some confidence, so it's not complete, but should be correct. 3 thoughts moving forward:
|
gazpachoking
left a comment
There was a problem hiding this comment.
I only scanned through the first half so far, but looks good to me. I mostly had questions on your changes in the use of Optional. Figured I'd just ask if there is a reason you changed them before scanning the rest.
Agreed, this would be nice, much easier to check over and merge in stuff that's good in smaller chunks.
We are using loguru, which does do lazy evaluation using the
Loguru is a bit weird with how you add levels, and since we don't (can't) subclass the logger class a lot of tools give warnings on this. 😕 Here is where it's defined. Here are the loguru docs on the matter. If you can figure out a nicer way that PyCharm/mypy won't complain that would be great. Thanks for all your work on this! |
I couldn't find anything in the loguru docs regarding this. I know that stdlib logging is "lazy" (and safer) when using the "%s" formatting, as indicated by the relevant pylint warnings when trying to use I couldn't find anything indicating that loguru treats |
Hmm. I thought I had read this, but now I'm not so sure |
|
Thinking about the lazy log stuff further:
Given that, I'm thinking fstrings are fine. I don't think we should necessarily go replace every logging call right away, but I don't think there is a problem with it. If we actually have expensive logging stuff we want to avoid always calling, maybe we put it on the |
Motivation for changes:
Add/enrich type annotations
Detailed changes:
update-changelog.pyand files directly underflexgetmodulemypy_cache/anddmypy.jsonto gitignoreI can keep adding commits to this PR
Addressed issues:
Implemented feature requests:
Config usage if relevant (new plugin or updated schema):
Log and/or tests output (preferably both):
To Do: