hhatto / autopep8

A tool that automatically formats Python code to conform to the PEP 8 style guide.
https://pypi.org/project/autopep8/
MIT License
4.56k stars 290 forks source link

Cases with list patterns doesn't format correctly #619

Closed vadim-su closed 2 years ago

vadim-su commented 2 years ago

Python Code

before:

match some_list:
    case [string] if isinstance(string, str):
        print("The first value is string")

after formatting:

some_list = ['str', 123]

match some_list:
    case[string] if isinstance(string, str):
        print("The first value is string")

case [string] -> case[string]

Command Line and Configuration

I use autopep8 without config.

Command Line

$ autopep8 test_case.py

Your Environment

hhatto commented 2 years ago

@deterok This problem has been resolved in autopep8 version 1.6.0 (and pycodestyle version 2.8.0). Could you please use version 1.6.0?

vadim-su commented 2 years ago

Ok thanks, I didn't check updates 😔