swiftly/cli/iomanager.py
def with_debug(self, os_path=None, skip_sub_command=False,
                   disk_closed_callback=None):
        """
        A context manager yielding a debug-output-suitable file-like
        object based on the optional os_path and optionally skipping
        any configured sub-command.

        :param os_path: Optional path to base the file-like object
            on.
        :param skip_sub_command: Set True to skip any configured
            sub-command filter.
        :param disk_closed_callback: If the backing of the file-like
            object is an actual file that will be closed,
            disk_closed_callback (if set) will be called with the
            on-disk path just after closing it.
        """
        sub_command = None if skip_sub_command else self.debug_sub_command
        out, path = self._get_out_and_path(
            self.debug, self.debug_root, sub_command, os_path)
        try:
            if hasattr(out, 'stdin'):
                yield out.stdin
            else:
                yield out
        finally:
            if hasattr(out, 'stdin'):
                self._close(out.stdin)
            self._wait(out, path)
            self._close(out)
            if disk_closed_callback and path:
                disk_closed_callback(path)
def with_debug(self, os_path=None, skip_sub_command=False,
                   disk_closed_callback=None):
        """
        A context manager yielding a debug-output-suitable file-like
        object based on the optional os_path and optionally skipping
        any configured sub-command.

        :param os_path: Optional path to base the file-like object
            on.
        :param skip_sub_command: Set True to skip any configured
            sub-command filter.
        :param disk_closed_callback: If the backing of the file-like
            object is an actual file that will be closed,
            disk_closed_callback (if set) will be called with the
            on-disk path just after closing it.
        """
        sub_command = None if skip_sub_command else self.debug_sub_command
        out, path = self._get_out_and_path(
            self.debug, self.debug_root, sub_command, os_path)
        try:
            if hasattr(out, 'stdin'):
                yield out.stdin
            else:
                yield out
        finally:
            if hasattr(out, 'stdin'):
                self._close(out.stdin)
            self._wait(out, path)
            self._close(out)
            if disk_closed_callback and path:
                disk_closed_callback(path)
def with_debug ( self , os_path = None , skip_sub_command = False , disk_closed_callback = None ) : sub_command = None if skip_sub_command else self . debug_sub_command out , path = self . _get_out_and_path ( self . debug , self . debug_root , sub_command , os_path ) try : if hasattr ( out , 'stdin' ) : yield out . stdin else : yield out finally : if hasattr ( out , 'stdin' ) : self . _close ( out . stdin ) self . _wait ( out , path ) self . _close ( out ) if disk_closed_callback and path : disk_closed_callback ( path )
A context manager yielding a debug-output-suitable file-like
        object based on the optional os_path and optionally skipping
        any configured sub-command.

        :param os_path: Optional path to base the file-like object
            on.
        :param skip_sub_command: Set True to skip any configured
            sub-command filter.
        :param disk_closed_callback: If the backing of the file-like
            object is an actual file that will be closed,
            disk_closed_callback (if set) will be called with the
            on-disk path just after closing it.
A context manager yielding a debug - output - suitable file - like object based on the optional os_path and optionally skipping any configured sub - command .