Skip to content

Commit 5211d8e

Browse files
committed
Addressing code review
1 parent 8fdfac2 commit 5211d8e

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

azure/datalake/store/multithread.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -205,22 +205,22 @@ def is_glob_path(path):
205205
path = AzureDLPath(path).trim()
206206
prefix = path.globless_prefix
207207
return not path == prefix
208+
is_rpath_glob = is_glob_path(self.rpath)
208209

209-
if is_glob_path(self.rpath):
210+
if is_rpath_glob:
210211
rfiles = self.client._adlfs.glob(self.rpath, details=True, invalidate_cache=True)
211212
else:
212213
rfiles = self.client._adlfs.walk(self.rpath, details=True, invalidate_cache=True)
213214

214-
215-
if len(rfiles) == 0:
215+
if not rfiles:
216216
raise ValueError('No files to download')
217217

218218
# If only one file is returned we are not sure whether user specified a dir or a file to download,
219219
# since walk gives the same result for both i.e walk("DirWithsingleFile") == walk("DirWithSingleFile\SingleFile)
220220
# If user specified a file in rpath,
221221
# then we want to download the file into lpath directly and not create another subdir for that.
222222
# If user specified a dir that happens to contain only one file, we want to create the dir as well under lpath.
223-
if len(rfiles) == 1 and not is_glob_path(self.rpath) and self.client._adlfs.info(self.rpath)['type'] == 'FILE':
223+
if len(rfiles) == 1 and not is_rpath_glob and self.client._adlfs.info(self.rpath)['type'] == 'FILE':
224224
if os.path.exists(self.lpath) and os.path.isdir(self.lpath):
225225
file_pairs = [(os.path.join(self.lpath, os.path.basename(rfiles[0]['name'] + '.inprogress')),
226226
rfiles[0])]

0 commit comments

Comments
 (0)