Repository: MartinThoma/flake8-simplify (python)

Issue:
SIM104 proposes yield from under async generators
## Desired change

* **Rule(s)**: SIM104
* **Adjustment**: do not propose `yield from` on async generators.

## Explanation

Yield-from is strictly forbidden under async generators, it looks like flake8-simplify does not check if generator is async before proposing that change.

## Example

```python
async def items():
    for c in 'abc':
        yield c
```


Pull request:
SIM104: yield from is not possible for async functions
Closes #67

Patch:
diff --git a/flake8_simplify.py b/flake8_simplify.py
index c6487f3..c2da734 100644
--- a/flake8_simplify.py
+++ b/flake8_simplify.py
@@ -311,6 +311,8 @@ def _get_sim104(node: ast.For) -> List[Tuple[int, int, str]]:
         or node.orelse != []
     ):
         return errors
+    if isinstance(node.parent, ast.AsyncFunctionDef):  # type: ignore
+        return errors
     iterable = to_source(node.iter)
     errors.append(
         (node.lineno, node.col_offset, SIM104.format(iterable=iterable))


Test patch:
diff --git a/tests/test_simplify.py b/tests/test_simplify.py
index bc23a17..b429d04 100644
--- a/tests/test_simplify.py
+++ b/tests/test_simplify.py
@@ -153,6 +153,16 @@ def test_sim104():
     assert ret == {"1:0 SIM104 Use 'yield from iterable'"}
 
 
+def test_s104_async_generator_false_positive():
+    ret = _results(
+        """async def items():
+    for c in 'abc':
+        yield c"""
+    )
+    for el in ret:
+        assert "SIM104" not in el
+
+
 def test_sim105():
     ret = _results(
         """try: