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

Run everything through 'black' #1442

Merged
merged 10 commits into from
May 18, 2022
Merged

Run everything through 'black' #1442

merged 10 commits into from
May 18, 2022

Conversation

Byron
Copy link
Member

@Byron Byron commented May 17, 2022

That way people who use it won't be deterred, while it unifies style
everywhere.

@Byron Byron force-pushed the black-fmt branch 2 times, most recently from 2574989 to f501fcb Compare May 18, 2022 00:12
@Byron Byron merged commit 38e9a18 into main May 18, 2022
EliahKagan added a commit to EliahKagan/GitPython that referenced this pull request Mar 10, 2024
The superclass _traverse method call in Tree.traverse appears to
have once had a working suppression for the incompatbile types of
two arguments, `predicate` and `prune`, as well as for an argument
that required (and requires) no suppression, `depth`. These three
arguments were written on the same line, which bad a `type: ignore`
comment on it. But when black formatting was applied in 21ec529
(gitpython-developers#1442), that comment moved so that it was on a line with just the
`depth` call that didn't need it, rather than the others that did.

Since then, mypy has reported errors, which further seem intended
to suppress based on the surrounding context and the use of `cast`
to deal with the static type incompatibilities going the other way.

This misplaced suppression was one of the ones I very recently
removed in 84fc806. But really there should be a suppression for
those arguments (at least for now, while the code remains written
that way, given that a suppression is intended).

This suppresses the error effectively by inserting two suppression
comments, one for each of the two arguments. This is more specific
than a single suppression applying to the whole call, and keeping
the arguments on separate lines both makes black happy and makes
clear that it is not by coincidence that the error is suppressed
for both of them. The new suppressions are also written for the
specific mypy error at issue, rather than fully general as before.

This change decreases the number of mypy errors by two.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

1 participant