Commit Graph

3 Commits

Author SHA1 Message Date
Anthony Sottile
c4ee2ed36a Correct annotation for fileinput.input (#2223)
```python
import fileinput

with fileinput.input(files=('foo.txt',), inplace=True, backup='') as f:
    for line in f:
        print(f'prefix{line}', end='')
```

```
$ mypy test2.py
test2.py:3: error: "Iterable[str]" has no attribute "__enter__"; maybe "__iter__"?
test2.py:3: error: "Iterable[str]" has no attribute "__exit__"
```

```
$ mypy test2.py --custom-typeshed typeshed
$
```
2018-06-12 15:45:11 -07:00
Jelle Zijlstra
296f294b75 add fileinput.filelineno and fileinput.fileno (#1338) 2017-05-26 09:30:42 -07:00
Jelle Zijlstra
c930e889ee merge 2 and 3 stubs for fileinput (#1319)
* merge 2 and 3 stubs for fileinput

Plus some minor fixes.

* pytype doesn't like generic type aliases
2017-05-24 07:58:56 -07:00