Skip to content

Commit

Permalink
dvc: some minor optimizations
Browse files Browse the repository at this point in the history
  • Loading branch information
Suor committed Apr 26, 2019
1 parent c0104e2 commit cdba077
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
4 changes: 2 additions & 2 deletions dvc/remote/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -469,10 +469,10 @@ def all(self):
def gc(self, cinfos):
from dvc.remote.local import RemoteLOCAL

used = [info[RemoteLOCAL.PARAM_CHECKSUM] for info in cinfos["local"]]
used = {info[RemoteLOCAL.PARAM_CHECKSUM] for info in cinfos["local"]}

if self.scheme != "":
used += [info[self.PARAM_CHECKSUM] for info in cinfos[self.scheme]]
used |= {info[self.PARAM_CHECKSUM] for info in cinfos[self.scheme]}

removed = False
for checksum in self.all():
Expand Down
14 changes: 8 additions & 6 deletions dvc/repo/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -285,12 +285,14 @@ def used_cache(

for out in stage.outs:
scheme = out.path_info["scheme"]
cache[scheme] += self._collect_used_cache(
out,
branch=branch,
remote=remote,
force=force,
jobs=jobs,
cache[scheme].extend(
self._collect_used_cache(
out,
branch=branch,
remote=remote,
force=force,
jobs=jobs,
)
)

return cache
Expand Down

0 comments on commit cdba077

Please sign in to comment.