Skip to content

Commit

Permalink
fix deepsource issues
Browse files Browse the repository at this point in the history
  • Loading branch information
casperdcl committed Nov 19, 2019
1 parent b811a77 commit b2f7c84
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions dvc/remote/gs.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,17 +63,17 @@ def _upload_to_bucket(
bytes=True,
disable=no_progress_bar,
) as pbar:
with io.open(from_file, mode="rb") as fd:
raw_read = fd.read
with io.open(from_file, mode="rb") as fobj:
raw_read = fobj.read

def read(size=chunk_size):
res = raw_read(size)
if res:
pbar.update(len(res))
return res

fd.read = read
blob.upload_from_file(fd)
fobj.read = read
blob.upload_from_file(fobj)


class RemoteGS(RemoteBASE):
Expand Down Expand Up @@ -167,15 +167,15 @@ def _download(self, from_info, to_file, name=None, no_progress_bar=True):
bytes=True,
disable=no_progress_bar,
) as pbar:
with io.open(to_file, mode="wb") as fd:
raw_write = fd.write
with io.open(to_file, mode="wb") as fobj:
raw_write = fobj.write

def write(bytes):
raw_write(bytes)
pbar.update(len(bytes))
def write(byte_string):
raw_write(byte_string)
pbar.update(len(byte_string))

fd.write = write
blob.download_to_file(fd)
fobj.write = write
blob.download_to_file(fobj)

def _generate_download_url(self, path_info, expires=3600):
expiration = timedelta(seconds=int(expires))
Expand Down

0 comments on commit b2f7c84

Please sign in to comment.