def _get_output_stream(destination): if destination is None or destination == '-': return binary_stream(sys.stdout) elif destination.endswith('gz'): import gzip return gzip.open(destination, 'wb') else: return open(destination, 'wb')
def _get_source_stream(source): if source == '-' or source is None: import sys from fastimport import helpers stream = helpers.binary_stream(sys.stdin) elif source.endswith('.gz'): import gzip stream = gzip.open(source, "rb") else: stream = open(source, "rb") return stream