mm21 / trilium-alchemy

Python SDK and CLI toolkit for Trilium Notes
GNU Affero General Public License v3.0
10 stars 1 forks source link

pyright updates for model.py and entity.py #14

Closed jwhonce closed 8 months ago

jwhonce commented 1 year ago
mm21 commented 1 year ago

Hi, thanks for submitting this! I've been doing some typing work myself lately so went ahead and merged that.

I think most of these # type: ignores should actually be properly fixed. IMO that should generally only be used for special cases like descriptors, wherein there's a fundamental impasse between the API and implementation.

There are a couple different classes of common problems, and I see you've already addressed some of them this way, but I think this approach can be applied to the remaining # type: ignores as well.

  1. Has a lifecycle where it may be None: add | None to the type

Examples:

  1. Shouldn't actually be assigned as None: remove = None Essentially if it's initialized in __init__, then it can be simply declared - it's not expected to be None at any point during its lifecycle.

Example:

Some of them may be more tricky than others, or require more in-depth knowledge of the design. Feel free to leave those and I'll be happy to work on them.

jwhonce commented 8 months ago

With changes in trilium-notes future, I have moved to logseq.