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

Long line containing the await keyword is not being formatted while similar line without await does get proper formatting #771

Open
ilanKeshet opened this issue Sep 12, 2024 · 1 comment

Comments

@ilanKeshet
Copy link


Python Code

SOME_CONST_IT_DOESNT_REALLY_MATTER = "some_const"


async def some_async_function():
    some_function_which_takes_some_parameters(await some_other_async_function_returning_a_string(), SOME_CONST_IT_DOESNT_REALLY_MATTER, a_kw_arg_value=True)


def some_function_which_takes_some_parameters(*args, **kwargs):
    return args


async def some_other_async_function_returning_a_string() -> str:
    return "some string"


async def some_none_async_function():
    some_function_which_takes_some_parameters(some_other_non_async_function_returning_a_string(), SOME_CONST_IT_DOESNT_REALLY_MATTER, a_kw_arg_value=True)


def some_other_non_async_function_returning_a_string() -> str:
    return "some string"

Command Line and Configuration

-   repo: https://github.com/hhatto/autopep8
    rev: 'v2.3.1'
    hooks:
    -   id: autopep8
        args: ["--in-place", "--max-line-length", "120", "--experimental", "--ignore" , "E301"]

Command Line

$ autopep8 --in-place --max-line-length 120 --experimental --ignore E301

Your Environment

  • Python version: 3.9.2
  • autopep8 version: 2.3.1
  • Platform: macOSX

Expected result

SOME_CONST_IT_DOESNT_REALLY_MATTER = "some_const"


async def some_async_function():
    some_function_which_takes_some_parameters(
        await some_other_async_function_returning_a_string(),
        SOME_CONST_IT_DOESNT_REALLY_MATTER, a_kw_arg_value=True)


def some_function_which_takes_some_parameters(*args, **kwargs):
    return args


async def some_other_async_function_returning_a_string() -> str:
    return "some string"


async def some_none_async_function():
    some_function_which_takes_some_parameters(
        some_other_non_async_function_returning_a_string(),
        SOME_CONST_IT_DOESNT_REALLY_MATTER, a_kw_arg_value=True)


def some_other_non_async_function_returning_a_string() -> str:
    return "some string"

Actual result

SOME_CONST_IT_DOESNT_REALLY_MATTER = "some_const"


async def some_async_function():
    some_function_which_takes_some_parameters(await some_other_async_function_returning_a_string(), SOME_CONST_IT_DOESNT_REALLY_MATTER, a_kw_arg_value=True)


def some_function_which_takes_some_parameters(*args, **kwargs):
    return args


async def some_other_async_function_returning_a_string() -> str:
    return "some string"


async def some_none_async_function():
    some_function_which_takes_some_parameters(
        some_other_non_async_function_returning_a_string(),
        SOME_CONST_IT_DOESNT_REALLY_MATTER, a_kw_arg_value=True)


def some_other_non_async_function_returning_a_string() -> str:
    return "some string"
@ilanKeshet ilanKeshet changed the title Long line containing the await keyword is not being formatted while similar line without await does get formatting Long line containing the await keyword is not being formatted while similar line without await does get proper formatting Sep 12, 2024
@andrewpeck
Copy link

I am seeing this same issue.

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

No branches or pull requests

2 participants