-
Notifications
You must be signed in to change notification settings - Fork 135
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
typing: src/vorta/store
#1872
base: master
Are you sure you want to change the base?
typing: src/vorta/store
#1872
Conversation
src/vorta/store
src/vorta/store
for typesafety
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good progress. Typing is hard but valuable!
@@ -62,12 +63,12 @@ def init_db(con=None): | |||
# Delete old log entries after 6 months. | |||
# The last `create` command of each profile must not be deleted | |||
# since the scheduler uses it to determine the last backup time. | |||
last_backups_per_profile = ( | |||
last_backups_per_profile = Tuple( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this is proper use of type hints. Shouldn't it be the following instead?
last_backups_per_profile = Tuple( | |
last_backups_per_profile : Tuple = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
last_scheduled_backups_per_profile
just a bit below (line 71) was assigned like that ( = Tuple(...)) so, I did it to last_backups_per_profile
for consistency. I think it would be better to do it according to your suggestion or keep both like:
last_backups_per_profile: Tuple = Tuple(
src/vorta/store/migrations.py
Outdated
@@ -15,7 +17,7 @@ | |||
) | |||
|
|||
|
|||
def run_migrations(current_schema, db_connection): | |||
def run_migrations(current_schema: Any, db_connection: SqliteDatabase): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we have to specify Any
? Isn't it the default, implicit type hint?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I left that one undone. It should be SchemVersion
from vorta.store.models
src/vorta/store
for typesafetysrc/vorta/store
Description
To improve readability a bit, and towards making the codebase typesafe.
Related Issue
#1870
Types of changes
Checklist:
I provide my contribution under the terms of the license of this repository and I affirm the Developer Certificate of Origin.