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

UP014 introduces E999 IndentationError: expected an indented block #2224

Closed
spaceone opened this issue Jan 26, 2023 · 2 comments · Fixed by #2226
Closed

UP014 introduces E999 IndentationError: expected an indented block #2224

spaceone opened this issue Jan 26, 2023 · 2 comments · Fixed by #2226
Assignees
Labels
bug Something isn't working

Comments

@spaceone
Copy link
Contributor

$ cat foo.py
#!/usr/bin/python3
try:
    from typing import Any, IO, Dict, Iterator, List, Optional, Tuple, Type, NamedTuple  # noqa: F401                                                                       
    from types import TracebackType  # noqa: F401
    from argparse import Namespace  # noqa: F401
    Transaction = NamedTuple("Transaction", [("tid", int), ("dn", str), ("command", str)])                                                                                  
except ImportError:
    Transaction = namedtuple("Transaction", ["tid", "dn", "command"])  # type: ignore
$ ruff --select UP014 --fix foo.py
Found 1 error (1 fixed, 0 remaining).
$ cat foo.py
#!/usr/bin/python3
try:
    from typing import Any, IO, Dict, Iterator, List, Optional, Tuple, Type, NamedTuple  # noqa: F401
    from types import TracebackType  # noqa: F401
    from argparse import Namespace  # noqa: F401
    class Transaction(NamedTuple):
    tid: int
    dn: str
    command: str
except ImportError:
    Transaction = namedtuple("Transaction", ["tid", "dn", "command"])  # type: ignore
$ python3 foo.py
  File "foo.py", line 7
    tid: int
      ^
IndentationError: expected an indented block
@charliermarsh charliermarsh self-assigned this Jan 26, 2023
@charliermarsh
Copy link
Member

Fixing, thank you.

@charliermarsh
Copy link
Member

For now, turning these fixes off when the code is indented. Will come back with a proper fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants