Пример #1
0
    def __init__(self, listener):
        """

        :type self: StringIO
        """
        StringIO.__init__(self)
        self.listener = listener
Пример #2
0
 def __init__(self, buffer=b'', cc=None):
     """
     If ``cc`` is given and is a file-like object or an iterable of same,
     it/they will be written to whenever this instance is written to.
     """
     IO.__init__(self, buffer)
     if cc is None:
         cc = []
     elif hasattr(cc, 'write'):
         cc = [cc]
     self.cc = cc
Пример #3
0
 def __init__(self, buffer=b'', cc=None):
     """
     If ``cc`` is given and is a file-like object or an iterable of same,
     it/they will be written to whenever this instance is written to.
     """
     IO.__init__(self, buffer)
     if cc is None:
         cc = []
     elif hasattr(cc, 'write'):
         cc = [cc]
     self.cc = cc
Пример #4
0
    def __init__(self, msg, color="white"):
        StringIO.__init__(self)

        self.color = color
        self._banner_separator = colored("==================== \n", color)
        self._banner_msg = colored("= %s\n" % msg, color)
        self._section_separator = "-------\n"
        # p = pprint.PrettyPrinter(indent=2, width=140)

        self.write("\n")
        self.write(self._banner_separator)
        self.write(self._banner_msg)
Пример #5
0
    def __init__(self, cache_location, url, set_cache_header=True):
        self.cache_location = cache_location
        hpath, bpath = calculate_cache_path(cache_location, url)

        StringIO.__init__(self, open(bpath, "rb").read())

        self.url = url
        self.code = 200
        self.msg = "OK"
        headerbuf = open(hpath, "rb").read()
        if set_cache_header:
            headerbuf += "x-local-cache: %s\r\n" % (bpath)
        self.headers = httplib.HTTPMessage(StringIO(headerbuf))
Пример #6
0
    def __init__(self, windows):
        StringIO.__init__(self)
        self.windows = windows
        self.autoscroll = {}
        self.pos = {}
        self.lines = {}
        self.maxsize = {}
        self.stdout = None
        self.logfile = None
        self.wrapper = TextWrapper(width=80, initial_indent="",
                                   subsequent_indent="         ",
                                   replace_whitespace=False)

        if NCURSES:
            for windex in windows:
                h, w = windows[windex][0].getmaxyx()
                self.maxsize[windex] = (h, w)
                self.pos[windex] = [0, 0]
                self.autoscroll[windex] = True
                self.lines[windex] = 0
Пример #7
0
    def __init__(self, windows):
        StringIO.__init__(self)
        self.windows = windows
        self.autoscroll = {}
        self.pos = {}
        self.lines = {}
        self.maxsize = {}
        self.stdout = None
        self.logfile = None
        self.wrapper = TextWrapper(width=80,
                                   initial_indent="",
                                   subsequent_indent="         ",
                                   replace_whitespace=False)

        if NCURSES:
            for windex in windows:
                h, w = windows[windex][0].getmaxyx()
                self.maxsize[windex] = (h, w)
                self.pos[windex] = [0, 0]
                self.autoscroll[windex] = True
                self.lines[windex] = 0
Пример #8
0
 def __init__(self, value=None, path=None):
     init = lambda x: StringIO.__init__(self, x)
     if value is None:
         init("")
         ftype = 'dir'
         size = 4096
     else:
         init(value)
         ftype = 'file'
         size = len(value)
     attr = ssh.SFTPAttributes()
     attr.st_mode = {'file': stat.S_IFREG, 'dir': stat.S_IFDIR}[ftype]
     attr.st_size = size
     attr.filename = os.path.basename(path)
     self.attributes = attr
Пример #9
0
 def __init__(self):
     # Chage to super() for Py3
     StringIO.__init__(self)
Пример #10
0
 def __init__(self, filename, data):
     # pylint: disable=W0233
     StringIO.__init__(self, data)
     self.mode = 'r'
     self.name = filename
Пример #11
0
 def __init__(self, data=""):
     StringIO.__init__(self, data)
Пример #12
0
 def __init__(self, queue, prefix=None):
     StringIO.__init__(self)
     self.queue = queue
     self.prefix = prefix
Пример #13
0
 def __init__(self, data=''):
     StringIO.__init__(self, data)
Пример #14
0
 def __init__(self,stdout):
     self.__stdout = stdout
     StringIO.__init__(self)
Пример #15
0
 def __init__(self, stdout):
     self.__stdout = stdout
     StringIO.__init__(self)
Пример #16
0
    def __init__(self, namespace, key, buf=''):
        self.namespace = namespace
        self.key = key

        self.namespace[self.key] = self
        StringIO.__init__(self, buf)