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

csv_overrides: Add stronger type hints #1851

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

auscompgeek
Copy link
Member

Checklist

@auscompgeek auscompgeek added code quality Improvements to code quality talon Related to cursorless-talon labels Sep 5, 2023

def check_for_duplicates(
filename: str, default_values: Mapping[str, Mapping[str, str]]
):
results_map = {}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can't see what type this is supposed to be... because I don't think any items are ever assigned to this 😕

I recall this bit was in one of the other functions previously. Think this ended up being broken after a recent refactor.

file_path = get_full_path(filename)
super_default_values = get_super_values(default_values)
assert allow_unknown_values == (default_list_name is not None)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Turns out we have dependent types here! It would've been too annoying to check both allow_unknown_values and default_list_name in update_dicts to appease the type checker, but I'm also too lazy to update the callers of init_csv_and_watch_changes right now.

@pokey
Copy link
Member

pokey commented Sep 15, 2023

I see this is still draft—did you want me to have a look or wanted to make some changes first?

@auscompgeek
Copy link
Member Author

It'd probably make sense to address the above issue first, since as it stands there are no types that are coherent in check_for_duplicates.

@pokey
Copy link
Member

pokey commented Sep 29, 2023

Ah right yeah makes sense

@pokey pokey added needs-maintainer Needs to be finished by one of the Cursorless maintainers 30 mins PRs that are very close and just need a couple quick tweaks to merge; maintainer may take it and removed needs-maintainer Needs to be finished by one of the Cursorless maintainers labels Jun 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
30 mins PRs that are very close and just need a couple quick tweaks to merge; maintainer may take it code quality Improvements to code quality talon Related to cursorless-talon
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants