mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-10-30 18:13:23 +08:00
pep8 fixes
This commit is contained in:
@@ -2,11 +2,13 @@
|
||||
A simple wrapper for writing tarballs as a stream.
|
||||
"""
|
||||
import os
|
||||
import logging, tarfile
|
||||
import logging
|
||||
import tarfile
|
||||
from galaxy.exceptions import ObjectNotFound
|
||||
|
||||
log = logging.getLogger( __name__ )
|
||||
|
||||
|
||||
class StreamBall( object ):
|
||||
def __init__( self, mode, members=None ):
|
||||
self.members = members
|
||||
@@ -15,16 +17,19 @@ class StreamBall( object ):
|
||||
self.mode = mode
|
||||
self.wsgi_status = None
|
||||
self.wsgi_headeritems = None
|
||||
|
||||
def add( self, file, relpath, check_file=False):
|
||||
if check_file and len(file)>0:
|
||||
if check_file and len(file) > 0:
|
||||
if not os.path.isfile(file):
|
||||
raise ObjectNotFound
|
||||
else:
|
||||
self.members[file] = relpath
|
||||
else:
|
||||
self.members[file] = relpath
|
||||
|
||||
def stream( self, environ, start_response ):
|
||||
response_write = start_response( self.wsgi_status, self.wsgi_headeritems )
|
||||
|
||||
class tarfileobj:
|
||||
def write( self, *args, **kwargs ):
|
||||
response_write( *args, **kwargs )
|
||||
@@ -34,10 +39,12 @@ class StreamBall( object ):
|
||||
tf.close()
|
||||
return []
|
||||
|
||||
|
||||
class ZipBall(object):
|
||||
def __init__(self, tmpf, tmpd):
|
||||
self._tmpf = tmpf
|
||||
self._tmpd = tmpd
|
||||
|
||||
def stream(self, environ, start_response):
|
||||
response_write = start_response( self.wsgi_status, self.wsgi_headeritems )
|
||||
tmpfh = open( self._tmpf )
|
||||
|
||||
Reference in New Issue
Block a user