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

Clean up types and drop an unused variable #1216

Merged
merged 5 commits into from
Aug 29, 2024

Conversation

akaihola
Copy link
Contributor

@akaihola akaihola commented Aug 29, 2024

Fixes #1174

  • Variable added_fnames in cmd_add was only modified, never read
  • expand_subdir() yielded both Paths and strs. There are now a bit of hints which I used to verify with Mypy that the types are correct. I also managed to avoid some back-and-forth str<->Path conversions by changing which ones are stored in some variables.
  • correct type(...) == <SomeClass> to type(...) is <SomeClass>
  • use raw strings when the string contains backslashes (r"\windows\__init__.py") so Python doesn't try to interpret \w as a control character

@paul-gauthier
Copy link
Collaborator

Thanks for your interest in aider. I'm not currently looking to add types to this codebase. So it's tricky and time consuming for me to review a PR with all sorts of type annotations.

@akaihola
Copy link
Contributor Author

Thanks for your interest in aider. I'm not currently looking to add types to this codebase. So it's tricky and time consuming for me to review a PR with all sorts of type annotations.

Fair enough, I now reverted the addition of type hints in this PR.


(Regarding type annotations, #1217 (Gradual typing) would remove the need to review type annotations by running Mypy to check them automatically – also the Mypy configuration in #1217 is such a minimal one that the current code base passes the check with virtually no modifications.)

@paul-gauthier paul-gauthier merged commit 59cb457 into Aider-AI:main Aug 29, 2024
8 of 9 checks passed
@paul-gauthier
Copy link
Collaborator

Thanks for this. Nice cleanups.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Some drive-by easy-to-fix code smells
2 participants