Ejemplo n.º 1
0
Archivo: rh_ip.py Proyecto: DaveQB/salt
def _read_temp(data):
    tout = StringIO()
    tout.write(data)
    tout.seek(0)
    output = tout.read().splitlines()  # Discard newlines
    tout.close()
    return output
Ejemplo n.º 2
0
def _read_temp(data):
    tout = StringIO()
    tout.write(data)
    tout.seek(0)
    output = tout.read().splitlines()  # Discard newlines
    tout.close()
    return output
Ejemplo n.º 3
0
    class _DelegateIO(object):
        '''
        This class defines an object that captures whatever is written to
        a stream or file.
        '''
        def __init__(self, delegate):
            self._captured = StringIO()
            self.delegate = delegate

        def write(self, text):
            if six.PY2 and isinstance(text, six.text_type):
                text = text.encode(__salt_system_encoding__)
            self._captured.write(text)
            self.delegate.write(text)

        def __getattr__(self, attr):
            try:
                return getattr(self._captured, attr)
            except AttributeError:
                return getattr(self.delegate, attr)