Add type hints
Consider adding type hints so type checkers like mypy and on-the-fly documentation can work properly, at least for the most commonly used methods.
The return types are often already included in the documentation but aren't recognised correctly:
I'd expect something like (method) get: (note_id) -> gkeepapi.node.TopLevelNode | None instead
This was primarily to maintain Py2 compatibility, but we should now be in the clear. All deprecation work is currently tracked in the https://github.com/kiwiz/gkeepapi/tree/deprecate_py2 branch. If you're feeling adventurous, PRs are welcome. :]
Sure, I'll take a look at adding them.
Can we use 3.10-style union types TopLevelNode | Node or should we support ≤ 3.9 with Union[TopLevelNode, None] instead?
Let's use the latter to maximize compat.
Sure, I'll do it. Could you please rebase the branch?
Done. :+1:
Thanks, pushed up fixes.
Alright so instead of adding typing for everything all at once I'll focus on adding the initial Keep class typing, since that's the user-facing part. Some notes:
In Keep::login we get an APIAuth object to login and then branch on its return value, but APIAuth::login always returns True if it doesn't raise a LoginException. We then return True for Keep::login as well. Is this intentional?
Since Python doesn't have method overloading this update overrides this update.
Keep::login
Hmm, these probably shouldn't return anything. In the interest of preserving backwards compat, let's not document the return value, but keep them for now. The if statements can probably be removed.
RemindersAPI
Good eye. The reminders functionality doesn't work atm, but I would rename the second update to sync.
Tracking in #130