Encoding iterator. Encodes the input strings from the iterator using an IncrementalEncoder. errors and kwargs are passed through to the IncrementalEncoder constructor.
(iterator, encoding, errors='strict', **kwargs)
| 1036 | return lookup(encoding).streamwriter |
| 1037 | |
| 1038 | def iterencode(iterator, encoding, errors='strict', **kwargs): |
| 1039 | """ |
| 1040 | Encoding iterator. |
| 1041 | |
| 1042 | Encodes the input strings from the iterator using an IncrementalEncoder. |
| 1043 | |
| 1044 | errors and kwargs are passed through to the IncrementalEncoder |
| 1045 | constructor. |
| 1046 | """ |
| 1047 | encoder = getincrementalencoder(encoding)(errors, **kwargs) |
| 1048 | for input in iterator: |
| 1049 | output = encoder.encode(input) |
| 1050 | if output: |
| 1051 | yield output |
| 1052 | output = encoder.encode("", True) |
| 1053 | if output: |
| 1054 | yield output |
| 1055 | |
| 1056 | def iterdecode(iterator, encoding, errors='strict', **kwargs): |
| 1057 | """ |
nothing calls this directly
no test coverage detected