diff --git a/src/octoprint/filemanager/util.py b/src/octoprint/filemanager/util.py index 4a247e62b..00f3aa215 100644 --- a/src/octoprint/filemanager/util.py +++ b/src/octoprint/filemanager/util.py @@ -107,7 +107,7 @@ class MultiStream(io.RawIOBase): their contents in the order they are provided to the constructor. Arguments: - *streams (io.IOBase): One or more streams to concatenate. + *streams (io.RawIOBase): One or more streams to concatenate. """ def __init__(self, *streams): io.RawIOBase.__init__(self) @@ -159,10 +159,12 @@ class LineProcessorStream(io.RawIOBase): While reading from this stream the provided `input_stream` is read line by line, calling the (overridable) method :meth:`.process_line` for each read line. - Sub classes can thus modify the contents of the `input_stream` in line, while it is being read. + Sub classes can thus modify the contents of the `input_stream` in line, while it is being read. Keep in mind that + ``process_line`` will receive the line as a byte stream - if underlying code needs to operate on unicode you'll need + to do the decoding yourself. Arguments: - input_stream (io.IOBase): The stream to process on the fly. + input_stream (io.RawIOBase): The stream to process on the fly. """ def __init__(self, input_stream): @@ -220,10 +222,11 @@ class LineProcessorStream(io.RawIOBase): wrapper `input_stream`. Arguments: - line (str): The line as read from `self.input_stream` + line (bytes): The line as read from `self.input_stream` in byte representation (str under Python 2 and + bytes under Python 3) Returns: - str or None: The processed version of the line (might also be multiple lines), or None if the line is to be + bytes or None: The processed version of the line (might also be multiple lines), or None if the line is to be stripped from the processed stream. """ return line