Commit Graph

10 Commits

Author SHA1 Message Date
Rebecca Chen
5dc89fe8cf Add undocumented methods codecs.utf_16_be_{decode,encode}. (#3091)
I found the signatures here:
6a16b18224/Modules/_codecsmodule.c (L729)

https://github.com/google/pytype/issues/348 was opened against
pytype about utf_16_be_encode being missing.
2019-06-26 20:29:16 -07:00
Aymeric Augustin
0b6d134795 Support the errors arg in codecs factory functions. (#2752) 2019-02-09 15:06:46 +01:00
Rebecca Chen
7dbc8748dc Add __iter__ method to codecs.StreamReader. (#2463) 2018-09-18 13:46:16 +02:00
Martin DeMello
19708fac61 add __enter__, __exit__ and __getattr__ to streamreader/writer (#2411) 2018-09-04 13:38:18 -07:00
Siva Chandra
01abd34327 Use class with __call__ method instead of callable. (#2418)
This will enable checking positional and keyword parameters.
2018-09-03 09:50:01 -07:00
Jelle Zijlstra
6bbf3d89eb Further improve codecs stubs (#2217)
- remove header comments
- uppercase type aliases
- remove old-style type annotations
- unquote forward refs
- reformat the file
- remove values for globals
- don't use private names from codecs stub in io.pyi
2018-06-11 22:24:34 -07:00
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