Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix the type hints in base_store.py #1108

Merged

Conversation

gycsaba96
Copy link
Contributor

Type hints could provide better maintainability. My final goal is to fix the typing of the main core components at least. I also hope to catch some bugs along the way. This PR fixes base_store.py.

  • Use the _Element class instead of the Element factory for typing.
  • Make BaseStore generic so that subclasses can have the precise return and parameter types instead of Any.
  • The stored objects are required to have certain fields.

One can test the result using mypy:

mypy GTG/core/base_store.py 

(You might need to install the lxml-stubs python package.)

gycsaba96 added 2 commits May 30, 2024 19:18
- Use the _Element class instead of the Element factory for typing.
- Make BaseStore generic so that subclasses can have the precise
  return and parameter types instead of Any.
- The stored objects are required to have certain fields.
@diegogangl diegogangl added enhancement maintainability Automated tests suite, tooling, refactoring, or anything that makes it easier for developers labels Jun 3, 2024
@diegogangl diegogangl merged commit 548c3d1 into getting-things-gnome:master Jun 3, 2024
1 check passed
@diegogangl
Copy link
Contributor

LGTM. Merged, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement maintainability Automated tests suite, tooling, refactoring, or anything that makes it easier for developers
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants