PyCQA / PyCQA/pycodestyle

W606: false positive when selecting async function from list by index

Open
#936 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
5.2k
Forks
754
PR merge metrics
No merged PRs in 30d

Description

Using version 2.6.0 in a clean Docker container (python 3.8.2)

Code to reproduce:

import asyncio


async def a(p):
    print(p)


async def b():
    await [a][0]("hi")

if __name__ == "__main__":
    asyncio.run(b())

Output:

root@47c18858d18f:/app# python -m pycodestyle test.py
test.py:9:5: W606 'async' and 'await' are reserved keywords starting with Python 3.7
root@47c18858d18f:/app#

This appears similar to #811, which was also about false positives on W606.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Run the provided Python 3.8 reproduction with pycodestyle 2.6.0, then trace the W606 handling that reports the warning for the indexed async function call. Done means the example no longer produces a false-positive W606 diagnostic; add or update a regression test if the project’s existing test structure identifies one.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.