---
source: crates/ruff_linter/src/rules/pyflakes/mod.rs
---
F704 `yield` statement outside of a function
 --> F704.py:6:5
  |
5 | class Foo:
6 |     yield 2
  |     ^^^^^^^
  |

F704 `yield` statement outside of a function
  --> F704.py:9:1
   |
 9 | yield 3
   | ^^^^^^^
10 | yield from 3
11 | await f()
   |

F704 `yield from` statement outside of a function
  --> F704.py:10:1
   |
 9 | yield 3
10 | yield from 3
   | ^^^^^^^^^^^^
11 | await f()
   |

F704 `await` statement outside of a function
  --> F704.py:11:1
   |
 9 | yield 3
10 | yield from 3
11 | await f()
   | ^^^^^^^^^
12 |
13 | def _():
   |

F704 `await` statement outside of a function
  --> F704.py:27:2
   |
26 | # but not in comprehensions
27 | [await cor async for cor in f()]  # F704
   |  ^^^^^^^^^
28 | {await cor async for cor in f()}  # F704
29 | {await cor: 1 async for cor in f()}  # F704
   |

F704 `await` statement outside of a function
  --> F704.py:28:2
   |
26 | # but not in comprehensions
27 | [await cor async for cor in f()]  # F704
28 | {await cor async for cor in f()}  # F704
   |  ^^^^^^^^^
29 | {await cor: 1 async for cor in f()}  # F704
30 | [await cor for cor in f()]  # F704
   |

F704 `await` statement outside of a function
  --> F704.py:29:2
   |
27 | [await cor async for cor in f()]  # F704
28 | {await cor async for cor in f()}  # F704
29 | {await cor: 1 async for cor in f()}  # F704
   |  ^^^^^^^^^
30 | [await cor for cor in f()]  # F704
31 | {await cor for cor in f()}  # F704
   |

F704 `await` statement outside of a function
  --> F704.py:30:2
   |
28 | {await cor async for cor in f()}  # F704
29 | {await cor: 1 async for cor in f()}  # F704
30 | [await cor for cor in f()]  # F704
   |  ^^^^^^^^^
31 | {await cor for cor in f()}  # F704
32 | {await cor: 1 for cor in f()}  # F704
   |

F704 `await` statement outside of a function
  --> F704.py:31:2
   |
29 | {await cor: 1 async for cor in f()}  # F704
30 | [await cor for cor in f()]  # F704
31 | {await cor for cor in f()}  # F704
   |  ^^^^^^^^^
32 | {await cor: 1 for cor in f()}  # F704
   |

F704 `await` statement outside of a function
  --> F704.py:32:2
   |
30 | [await cor for cor in f()]  # F704
31 | {await cor for cor in f()}  # F704
32 | {await cor: 1 for cor in f()}  # F704
   |  ^^^^^^^^^
33 |
34 | # or in the iterator of an async generator, which is evaluated in the parent
   |

F704 `await` statement outside of a function
  --> F704.py:36:23
   |
34 | # or in the iterator of an async generator, which is evaluated in the parent
35 | # scope
36 | (cor async for cor in await f())  # F704
   |                       ^^^^^^^^^
37 | (await cor async for cor in [await c for c in f()])  # F704
   |

F704 `await` statement outside of a function
  --> F704.py:37:30
   |
35 | # scope
36 | (cor async for cor in await f())  # F704
37 | (await cor async for cor in [await c for c in f()])  # F704
   |                              ^^^^^^^
38 |
39 | # this is also okay because the comprehension is within the generator scope
   |
