A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://arrow.apache.org/docs/python/generated/pyarrow.fs.FileSelector.html below:

pyarrow.fs.FileSelector — Apache Arrow v21.0.0

pyarrow.fs.FileSelector#
class pyarrow.fs.FileSelector(base_dir, bool allow_not_found=False, bool recursive=False)#

Bases: _Weakrefable

File and directory selector.

It contains a set of options that describes how to search for files and directories.

Parameters:
base_dirstr

The directory in which to select files. Relative paths also work, use ‘.’ for the current directory and ‘..’ for the parent.

allow_not_foundbool, default False

The behavior if base_dir doesn’t exist in the filesystem. If false, an error is returned. If true, an empty selection is returned.

recursivebool, default False

Whether to recurse into subdirectories.

Examples

List the contents of a directory and subdirectories:

>>> selector_1 = fs.FileSelector(local_path, recursive=True)
>>> local.get_file_info(selector_1) 
[<FileInfo for 'tmp/alphabet/example.dat': type=FileType.File, size=4>,
<FileInfo for 'tmp/alphabet/subdir': type=FileType.Directory>,
<FileInfo for 'tmp/alphabet/subdir/example_copy.dat': type=FileType.File, size=4>]

List only the contents of the base directory:

>>> selector_2 = fs.FileSelector(local_path)
>>> local.get_file_info(selector_2) 
[<FileInfo for 'tmp/alphabet/example.dat': type=FileType.File, size=4>,
<FileInfo for 'tmp/alphabet/subdir': type=FileType.Directory>]

Return empty selection if the directory doesn’t exist:

>>> selector_not_found = fs.FileSelector(local_path + '/missing',
...                                      recursive=True,
...                                      allow_not_found=True)
>>> local.get_file_info(selector_not_found)
[]
__init__(*args, **kwargs)#

Methods

Attributes

allow_not_found#
base_dir#
recursive#

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4