File: io_wrapper.py

package info (click to toggle)
ros-rosinstall 0.7.8-6
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 728 kB
  • sloc: python: 3,399; makefile: 132; xml: 12
file content (20 lines) | stat: -rw-r--r-- 390 bytes parent folder | download | duplicates (8)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
class StringIO:
    """
    StringIO.StringIO does not exist in python3
    io.StringIO cannot cope with unicode
    """

    def __init__(self):
        self.stream = ''

    def write(self, data):
        self.stream += data

    def flush(self):
        pass

    def __getattr__(self, attr):
        return getattr(self.stream, attr)

    def getvalue(self):
        return self.stream