Commit Graph

4 Commits

Author SHA1 Message Date
Jelle Zijlstra
bdb06b5b81 improve codecs stubs (#2114)
Started out as progress towards #1476, but I ended up fixing a few more things:
- fixed the signature of _encode_type, which actually returns a pair, not a string
- made some attributes into properties in order to prevent the descriptor protocol from turning them into methods
- found a bug in CPython in the process (python/cpython#6779)

I used the following test file to make sure these classes are now instantiable:

```python
import codecs
import io
from typing import IO

bio = io.BytesIO()
cod = codecs.lookup('utf-8')

codecs.StreamReaderWriter(bio, codecs.StreamReader, codecs.StreamWriter)
codecs.StreamRecoder(bio, cod.encode, cod.decode, codecs.StreamReader, codecs.StreamWriter)
```
2018-06-11 15:53:15 -07:00
Daniel Bowtell
bb8b9bdaec codecs.iter(en|de)code fix return type (#1807)
codecs.iterencode and codecs.iterdecode should both return Generators rather than Iterators
2018-01-02 12:49:34 -08:00
Jelle Zijlstra
7c2d82fcb5 Add to codecs.StreamReaderWriter stub (#1032)
* Add to codecs.StreamReaderWriter stub

Closes #732

* BinaryIO -> IO[_encoded]
2017-03-21 08:15:46 -07:00
Jelle Zijlstra
cf6c563ce1 codecs: merge 2 and 3 stubs (#960) 2017-03-10 15:50:14 -08:00