aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/tools/python3/src/Lib/codecs.py
diff options
context:
space:
mode:
authorshadchin <shadchin@yandex-team.ru>2022-02-10 16:44:30 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:44:30 +0300
commit2598ef1d0aee359b4b6d5fdd1758916d5907d04f (patch)
tree012bb94d777798f1f56ac1cec429509766d05181 /contrib/tools/python3/src/Lib/codecs.py
parent6751af0b0c1b952fede40b19b71da8025b5d8bcf (diff)
downloadydb-2598ef1d0aee359b4b6d5fdd1758916d5907d04f.tar.gz
Restoring authorship annotation for <shadchin@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'contrib/tools/python3/src/Lib/codecs.py')
-rw-r--r--contrib/tools/python3/src/Lib/codecs.py44
1 files changed, 22 insertions, 22 deletions
diff --git a/contrib/tools/python3/src/Lib/codecs.py b/contrib/tools/python3/src/Lib/codecs.py
index d2edd148a2..19f7b78d14 100644
--- a/contrib/tools/python3/src/Lib/codecs.py
+++ b/contrib/tools/python3/src/Lib/codecs.py
@@ -386,7 +386,7 @@ class StreamWriter(Codec):
def reset(self):
- """ Resets the codec buffers used for keeping internal state.
+ """ Resets the codec buffers used for keeping internal state.
Calling this method should ensure that the data on the
output is put into a clean state, that allows appending
@@ -620,7 +620,7 @@ class StreamReader(Codec):
def reset(self):
- """ Resets the codec buffers used for keeping internal state.
+ """ Resets the codec buffers used for keeping internal state.
Note that no stream repositioning should take place.
This method is primarily intended to be able to recover
@@ -838,7 +838,7 @@ class StreamRecoder:
def writelines(self, list):
- data = b''.join(list)
+ data = b''.join(list)
data, bytesdecoded = self.decode(data, self.errors)
return self.writer.write(data)
@@ -847,12 +847,12 @@ class StreamRecoder:
self.reader.reset()
self.writer.reset()
- def seek(self, offset, whence=0):
- # Seeks must be propagated to both the readers and writers
- # as they might need to reset their internal buffers.
- self.reader.seek(offset, whence)
- self.writer.seek(offset, whence)
-
+ def seek(self, offset, whence=0):
+ # Seeks must be propagated to both the readers and writers
+ # as they might need to reset their internal buffers.
+ self.reader.seek(offset, whence)
+ self.writer.seek(offset, whence)
+
def __getattr__(self, name,
getattr=getattr):
@@ -868,7 +868,7 @@ class StreamRecoder:
### Shortcuts
-def open(filename, mode='r', encoding=None, errors='strict', buffering=-1):
+def open(filename, mode='r', encoding=None, errors='strict', buffering=-1):
""" Open an encoded file using the given mode and return
a wrapped version providing transparent encoding/decoding.
@@ -889,8 +889,8 @@ def open(filename, mode='r', encoding=None, errors='strict', buffering=-1):
encoding error occurs.
buffering has the same meaning as for the builtin open() API.
- It defaults to -1 which means that the default buffer size will
- be used.
+ It defaults to -1 which means that the default buffer size will
+ be used.
The returned wrapped file object provides an extra attribute
.encoding which allows querying the used encoding. This
@@ -906,16 +906,16 @@ def open(filename, mode='r', encoding=None, errors='strict', buffering=-1):
if encoding is None:
return file
- try:
- info = lookup(encoding)
- srw = StreamReaderWriter(file, info.streamreader, info.streamwriter, errors)
- # Add attributes to simplify introspection
- srw.encoding = encoding
- return srw
- except:
- file.close()
- raise
-
+ try:
+ info = lookup(encoding)
+ srw = StreamReaderWriter(file, info.streamreader, info.streamwriter, errors)
+ # Add attributes to simplify introspection
+ srw.encoding = encoding
+ return srw
+ except:
+ file.close()
+ raise
+
def EncodedFile(file, data_encoding, file_encoding=None, errors='strict'):
""" Return a wrapped version of file which provides transparent