Skip to content

Commit

Permalink
[pycodestyle] Avoid false positives related to type aliases (E252) (
Browse files Browse the repository at this point in the history
  • Loading branch information
InSyncWithFoo authored Jan 8, 2025
1 parent ee9a912 commit 3820af2
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
12 changes: 12 additions & 0 deletions crates/ruff_linter/resources/test/fixtures/pycodestyle/E25.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,3 +79,15 @@ def pep_696_good_method[A = int, B: object = str, C:object = memoryview](self):

# https://github.com/astral-sh/ruff/issues/15202
type Coro[T: object = Any] = Coroutine[None, None, T]


# https://github.com/astral-sh/ruff/issues/15339
type A = Annotated[
str, Foo(lorem='ipsum')
]
type B = Annotated[
int, lambda a=1: ...
]
type C = Annotated[
int, lambda a: ..., lambda a=1: ...
]
Original file line number Diff line number Diff line change
Expand Up @@ -531,7 +531,7 @@ impl DefinitionState {
Self::NotInDefinition => return,
};
match token_kind {
TokenKind::Lpar if type_params_state_mut.before_type_params() => {
TokenKind::Lpar | TokenKind::Equal if type_params_state_mut.before_type_params() => {
*type_params_state_mut = TypeParamsState::TypeParamsEnded;
}
TokenKind::Lsqb => match type_params_state_mut {
Expand Down

0 comments on commit 3820af2

Please sign in to comment.