mirror of
https://github.com/astral-sh/ruff.git
synced 2025-10-01 22:31:23 +00:00
Add "Notebook behavior" section for F704
, PLE1142
(#14266)
## Summary Move the relevant contents into "Notebook behavior" section similar to other rules.
This commit is contained in:
parent
84d4f114ef
commit
13883414af
2 changed files with 8 additions and 6 deletions
|
@ -31,15 +31,16 @@ impl fmt::Display for DeferralKeyword {
|
|||
/// The use of `yield`, `yield from`, or `await` outside of a function will
|
||||
/// raise a `SyntaxError`.
|
||||
///
|
||||
/// As an exception, `await` is allowed at the top level of a Jupyter notebook
|
||||
/// (see: [autoawait]).
|
||||
///
|
||||
/// ## Example
|
||||
/// ```python
|
||||
/// class Foo:
|
||||
/// yield 1
|
||||
/// ```
|
||||
///
|
||||
/// ## Notebook behavior
|
||||
/// As an exception, `await` is allowed at the top level of a Jupyter notebook
|
||||
/// (see: [autoawait]).
|
||||
///
|
||||
/// ## References
|
||||
/// - [Python documentation: `yield`](https://docs.python.org/3/reference/simple_stmts.html#the-yield-statement)
|
||||
///
|
||||
|
|
|
@ -11,9 +11,6 @@ use crate::checkers::ast::Checker;
|
|||
/// ## Why is this bad?
|
||||
/// Using `await` outside an `async` function is a syntax error.
|
||||
///
|
||||
/// As an exception, `await` is allowed at the top level of a Jupyter notebook
|
||||
/// (see: [autoawait]).
|
||||
///
|
||||
/// ## Example
|
||||
/// ```python
|
||||
/// import asyncio
|
||||
|
@ -32,6 +29,10 @@ use crate::checkers::ast::Checker;
|
|||
/// await asyncio.sleep(1)
|
||||
/// ```
|
||||
///
|
||||
/// ## Notebook behavior
|
||||
/// As an exception, `await` is allowed at the top level of a Jupyter notebook
|
||||
/// (see: [autoawait]).
|
||||
///
|
||||
/// ## References
|
||||
/// - [Python documentation: Await expression](https://docs.python.org/3/reference/expressions.html#await)
|
||||
/// - [PEP 492: Await Expression](https://peps.python.org/pep-0492/#await-expression)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue