MCPcopy Create free account
hub / github.com/apache/arrow / get_file_info_selector

Method get_file_info_selector

python/pyarrow/fs.py:326–353  ·  view source on GitHub ↗
(self, selector)

Source from the content-addressed store, hash-verified

324 return infos
325
326 def get_file_info_selector(self, selector):
327 if not self.fs.isdir(selector.base_dir):
328 if self.fs.exists(selector.base_dir):
329 raise NotADirectoryError(selector.base_dir)
330 else:
331 if selector.allow_not_found:
332 return []
333 else:
334 raise FileNotFoundError(selector.base_dir)
335
336 if selector.recursive:
337 maxdepth = None
338 else:
339 maxdepth = 1
340
341 infos = []
342 selected_files = self.fs.find(
343 selector.base_dir, maxdepth=maxdepth, withdirs=True, detail=True
344 )
345 for path, info in selected_files.items():
346 _path = path.strip("/")
347 base_dir = selector.base_dir.strip("/")
348 # Need to exclude base directory from selected files if present
349 # (fsspec filesystems, see GH-37555)
350 if _path != base_dir:
351 infos.append(self._create_file_info(path, info))
352
353 return infos
354
355 def create_dir(self, path, recursive):
356 # mkdir also raises FileNotFoundError when base directory is not found

Callers

nothing calls this directly

Calls 3

_create_file_infoMethod · 0.95
findMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected