Exemple #1
0
    def __init__(self, pipe=None, *args, **kwargs):
        """Construct a TeeIO object.

        :param pipe: a writable stream (default: sys.stdout).
        """
        self.pipe = pipe if pipe is not None else sys.stdout
        BytesIO.__init__(self, *args, **kwargs)
 def __init__(self, stream, status=200, headers=None):
     self.status = status
     self.headers = headers or {}
     self.reason = requests.status_codes._codes.get(
         status, ['']
     )[0].upper().replace('_', ' ')
     BytesIO.__init__(self, stream)
 def result(found):
     self.status, content_type, self._path = found
     self.reason = reason(self.status)
     self.headers = {"Content-Type": content_type or ""}
     BytesIO.__init__(
         self,
         _io_read_file(self.status, self._path)
     )
Exemple #4
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
Exemple #5
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
Exemple #6
0
 def __init__(self, *args, **kwargs):
     """Initialize."""
     self.called = False
     if PY2:
         return BytesIO.__init__(self, *args, **kwargs)
     else:
         return super(BadBytesIO, self).__init__(*args, **kwargs)
 def __init__(self, *args, **kwargs):
     """Initialize."""
     self.called = False
     if PY2:
         return BytesIO.__init__(self, *args, **kwargs)
     else:
         return super(BadBytesIO, self).__init__(*args, **kwargs)
Exemple #8
0
 def __init__(self, level=20, logger=None, *args, **kwargs):
     self._log = logger or get_null_logger()
     self._level = level
     BytesIO.__init__(self, *args, **kwargs)
Exemple #9
0
 def __init__(self, stream, status=200, headers=None):
     self.status = status
     self.headers = headers or {}
     self.reason = requests.status_codes._codes.get(
         status, [''])[0].upper().replace('_', ' ')
     BytesIO.__init__(self, stream)
 def __init__(self, initial=b"", filename="", name=""):
     # BytesIO on py2 is an old-style class (yeah, i know...)
     BytesIO.__init__(self, initial)
     self._name = name
     self._filename = filename
 def __init__(self, *args, **kwargs):
     BytesIO.__init__(self, *args, **kwargs)
     self.headers = self.Headers()
Exemple #12
0
 def __init__(self, *args, **kwargs):
     BytesIO.__init__(self, *args, **kwargs)
     self.headers = self.Headers()
Exemple #13
0
    def __init__(self, namespace, key, buf=b''):
        self.namespace = namespace
        self.key = key

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