-
Notifications
You must be signed in to change notification settings - Fork 1
Add typing throughout code base #12
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
base: master
Are you sure you want to change the base?
Conversation
return note_data, valid | ||
|
||
def parse_txt_input(txt_file: list[str]) -> defaultdict(list): | ||
def parse_txt_input(txt_file: list[str]) -> dict[str, dict[str or list[str]] or float or int ]: |
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.
Typing uses the Union operator |
return sub('4', '1', sub('[MKLF]', '0', line)) #replaces extra notes: M, K, L, F; replaces 4 note | ||
|
||
def parse_sm_input(sm_file: list[str]) -> tuple[defaultdict(list), bool]: | ||
def parse_sm_input(sm_file: list[str]) -> tuple[dict[str, dict[str or list[str]] or float or int ], bool]: |
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.
Same here
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.
Check my commit message. For Python version <3.10, I have to use OR instead of a Union operator. If you can test it from your end with a Python version 3.10+ and it still works then there shouldn't be any problem.
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.
Then Union[x, y, z]
from typing
should be used instead. As is, I don't think this PR passes pytype checks.
IMO the code base can be upgraded to Python 3.10+. 3.10 has been out for 2 years and it's worth using more modern features.
No description provided.