Filesystem
get_open_file_limit
¶
Get the maximum number of open files allowed for the current process.
Returns:
Type | Description |
---|---|
int
|
The maximum number of open files allowed for the current process. |
multi_glob
¶
Return a list of all files in the given directory that match the patterns in keep_globs and do not match the patterns in drop_globs. The patterns are defined using glob syntax.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
directory
|
str | None
|
The directory to search in. If not provided, the current working directory is used. |
None
|
keep_globs
|
list[str] | None
|
A list of glob patterns to keep. |
None
|
drop_globs
|
list[str] | None
|
A list of glob patterns to drop. |
None
|
Returns:
Type | Description |
---|---|
list[Path]
|
A list of Path objects representing the files that match the given |
list[Path]
|
patterns. |
Raises:
Type | Description |
---|---|
ValueError
|
If the directory does not exist. |
Example
Get all files (except those in the .git directory) in the current directory
from raggy.utilities.filesystem import multi_glob
files = multi_glob() # .git files are excluded by default (unless drop_globs is set)
Get all python files in the current directory
Get all files except those in any __pycache__
directories