async/await keywords not recognized in code block?
See original GitHub issueHi,
My documentation looks like this:
.. code-block:: python
async with aiohttp.ClientSession() as session:
gh = GitHubAPI(session, "mariatta", oauth_token=os.getenv("GH_AUTH"))
When I run blacken-docs, I’m getting this error:
code block parse error Cannot parse: 1:6: async with aiohttp.ClientSession() as session:
But when I removed the async
keyword, it works:
.. code-block:: python
with aiohttp.ClientSession() as session:
gh = GitHubAPI(session, "mariatta", oauth_token=os.getenv("GH_AUTH"))
Same problem when I have this type of code block:
.. code-block:: python
await gh.patch(url, data={"state": "closed"})
Removing the await
keyword works.
Any idea?
Thanks.
Issue Analytics
- State:
- Created 5 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
async/await keywords not recognized in code block? #1 - GitHub
Hi, My documentation looks like this: .. code-block:: python async with aiohttp.ClientSession() as session: gh = GitHubAPI(session, ...
Read more >.net - C# async and await keywords not working as expected ...
When the compiler encounters await keyword it will automatically schedule a task in task scheduler. The operation waits (in a non-blocking ...
Read more >async - C# Reference - Microsoft Learn
The async keyword is contextual in that it's a keyword only when it modifies a method, a lambda expression, or an anonymous method....
Read more >async function - JavaScript - MDN Web Docs - Mozilla
Use of async and await enables the use of ordinary try / catch blocks around asynchronous code. Note: The await keyword is only...
Read more >Async and Await | The Odin Project
The async keyword is what lets the JavaScript engine know that you are declaring an asynchronous function. This is required to use await...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Since there’s not terribly much that can be done from the
blacken-docs
side I’m going to close this with a sad wontfix. Thanks again for the issue 😃Thanks 😃