misc minor style fixes & optimisations

This commit is contained in:
Casper da Costa-Luis
2019-08-17 16:36:59 +01:00
parent 093ad20a84
commit 3098460f56
3 changed files with 10 additions and 9 deletions
+1
View File
@@ -23,6 +23,7 @@ innosetup/config.ini
*.exe
.coverage
.coverage.*
*.swp
+6 -6
View File
@@ -334,7 +334,8 @@ class RemoteLOCAL(RemoteBASE):
return ret
def _fill_statuses(self, checksum_info_dir, local_exists, remote_exists):
@staticmethod
def _fill_statuses(checksum_info_dir, local_exists, remote_exists):
# Using sets because they are way faster for lookups
local = set(local_exists)
remote = set(remote_exists)
@@ -436,7 +437,8 @@ class RemoteLOCAL(RemoteBASE):
download=True,
)
def _log_missing_caches(self, checksum_info_dict):
@staticmethod
def _log_missing_caches(checksum_info_dict):
missing_caches = [
(md5, info)
for md5, info in checksum_info_dict.items()
@@ -444,10 +446,8 @@ class RemoteLOCAL(RemoteBASE):
]
if missing_caches:
missing_desc = "".join(
[
"\nname: {}, md5: {}".format(info["name"], md5)
for md5, info in missing_caches
]
)
msg = (
"Some of the cache files do not exist neither locally "
@@ -479,8 +479,8 @@ class RemoteLOCAL(RemoteBASE):
os.chmod(path, os.stat(path).st_mode | stat.S_IWRITE)
def _unprotect_dir(self, path):
for path in walk_files(path, self.repo.dvcignore):
RemoteLOCAL._unprotect_file(path)
for fname in walk_files(path, self.repo.dvcignore):
RemoteLOCAL._unprotect_file(fname)
def unprotect(self, path_info):
path = path_info.fspath
+1 -1
View File
@@ -93,7 +93,7 @@ class RemoteSSH(RemoteBASE):
@staticmethod
def _load_user_ssh_config(hostname):
user_config_file = RemoteSSH.ssh_config_filename()
user_ssh_config = dict()
user_ssh_config = {}
if hostname and os.path.exists(user_config_file):
ssh_config = paramiko.SSHConfig()
with open(user_config_file) as f: