path (8)
expanduser¶
expanduser(path)
Expand ~ and ~user constructions. If user or $HOME is unknown,
DocStrings
Source code in python3.13/posixpath.py
expandvars¶
expandvars(path)
Expand shell variables of form $var and ${var}. Unknown variables
DocStrings
Source code in python3.13/posixpath.py
fnmatch¶
fnmatch(name, pat)
Test whether FILENAME matches PATTERN.
Aliases: fnmatch_fnmatch
DocStrings
Source code in python3.13/fnmatch.py
fnmatch_filter¶
fnmatch_filter(names, pat)
Construct a list from those elements of the iterable NAMES that match PAT.
DocStrings
Source code in python3.13/fnmatch.py
fnmatchcase¶
fnmatchcase(name, pat)
Test whether FILENAME matches PATTERN, including case.
Aliases: fnmatch_fnmatchcase
Example
Jinja call:
Result:True
False
DocStrings
get_directory_tree¶
get_directory_tree(root_path: 'str | os.PathLike[str]', *, show_hidden: 'bool' = False, show_size: 'bool' = True, show_date: 'bool' = False, show_permissions: 'bool' = False, show_icons: 'bool' = True, max_depth: 'int | None' = None, include_pattern: 'Pattern[str] | None' = None, exclude_pattern: 'Pattern[str] | None' = None, allowed_extensions: 'set[str] | None' = None, hide_empty: 'bool' = True, sort_criteria: 'SortCriteria' = <SortCriteria.NAME: 1>, reverse_sort: 'bool' = False, date_format: 'str' = '%Y-%m-%d %H:%M:%S') -> 'str'
Create a DirectoryTree instance with the specified options.
Example
Jinja call:
Result:📂 ``
┣━━ 📂 `docs`
┃ ┣━━ 📝 `extensions.md`
┃ ┗━━ 📝 `jinjafiles.md`
┣━━ 📂 `overrides`
┣━━ 📂 `src`
┃ ┗━━ 📂 `jinjarope`
┃ ┣━━ 📂 `__pycache__`
┃ ┣━━ 📂 `llm`
┃ ┃ ┣━━ 📂 `__pycache__`
┃ ┃ ┗━━ 🐍 `__init__.py`
┃ ┣━━ 📂 `resources`
┃ ┣━━ 🐍 `__init__.py`
┃ ┣━━ 🐍 `cli.py`
┃ ┣━━ 🐍 `codetree.py`
┃ ┣━━ 🐍 `configloaders.py`
┃ ┣━━ 🐍 `decorators.py`
┃ ┣━━ 🐍 `deepmerge.py`
┃ ┣━━ 🐍 `envconfig.py`
┃ ┣━━ 🐍 `envglobals.py`
┃ ┣━━ 🐍 `environment.py`
┃ ┣━━ 🐍 `envtests.py`
┃ ┣━━ 🐍 `filetree.py`
┃ ┣━━ 🐍 `fsspecloaders.py`
┃ ┣━━ 🐍 `htmlfilters.py`
┃ ┣━━ 🐍 `iconfilters.py`
┃ ┣━━ 🐍 `icons.py`
┃ ┣━━ 🐍 `inspectfilters.py`
┃ ┣━━ 🐍 `iterfilters.py`
┃ ┣━━ 🐍 `jinjafile.py`
┃ ┣━━ 🐍 `jinjaloaderfilesystem.py`
┃ ┣━━ 🐍 `loaderregistry.py`
┃ ┣━━ 🐍 `loaders.py`
┃ ┣━━ 🐍 `localization.py`
┃ ┣━━ 🐍 `manual.py`
┃ ┣━━ 🐍 `mdfilters.py`
┃ ┣━━ 🐍 `regexfilters.py`
┃ ┣━━ 🐍 `rewriteloader.py`
┃ ┣━━ 🐍 `serializefilters.py`
┃ ┣━━ 🐍 `tags.py`
┃ ┣━━ 🐍 `textfilters.py`
┃ ┣━━ 🐍 `undefined.py`
┃ ┗━━ 🐍 `utils.py`
┣━━ 📂 `tests`
┃ ┣━━ 📂 `testresources`
┃ ┣━━ 🐍 `__init__.py`
┃ ┣━━ 🐍 `conftest.py`
┃ ┣━━ 🐍 `test_cli.py`
┃ ┣━━ 🐍 `test_decorators.py`
┃ ┣━━ 🐍 `test_environment.py`
┃ ┣━━ 🐍 `test_fsspec_loaders.py`
┃ ┣━━ 🐍 `test_jinjafile.py`
┃ ┣━━ 🐍 `test_jinjaloaderfilesystem.py`
┃ ┣━━ 🐍 `test_loaders.py`
┃ ┣━━ 🐍 `test_misc_filters.py`
┃ ┣━━ 🐍 `test_nested_dict_loader.py`
┃ ┣━━ 🐍 `test_optional_items.py`
┃ ┣━━ 🐍 `test_rewriteloader.py`
┃ ┣━━ 🐍 `test_tags.py`
┃ ┣━━ 🐍 `test_template_file_loader.py`
┃ ┗━━ 🐍 `test_undefined.py`
┣━━ 📝 `AGENTS.md`
┣━━ 🐍 `duties.py`
┗━━ 📝 `README.md`
DocStrings
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
root_path
|
str | PathLike[str]
|
Root path of the directory tree |
required |
show_hidden
|
bool
|
Whether to show hidden files/directories |
False
|
show_size
|
bool
|
Whether to show file sizes |
True
|
show_date
|
bool
|
Whether to show modification dates |
False
|
show_permissions
|
bool
|
Whether to show file permissions |
False
|
show_icons
|
bool
|
Whether to show icons for files/directories |
True
|
max_depth
|
int | None
|
Maximum depth to traverse (None for unlimited) |
None
|
include_pattern
|
Pattern[str] | None
|
Regex pattern for files/directories to include |
None
|
exclude_pattern
|
Pattern[str] | None
|
Regex pattern for files/directories to exclude |
None
|
allowed_extensions
|
set[str] | None
|
Set of allowed file extensions |
None
|
hide_empty
|
bool
|
Whether to hide empty directories |
True
|
sort_criteria
|
SortCriteria
|
Criteria for sorting entries |
NAME
|
reverse_sort
|
bool
|
Whether to reverse the sort order |
False
|
date_format
|
str
|
Format string for dates |
'%Y-%m-%d %H:%M:%S'
|
Returns:
| Name | Type | Description |
|---|---|---|
DirectoryTree |
str
|
Configured DirectoryTree instance |
Source code in src/jinjarope/filetree.py
glob¶
glob(pathname, *, root_dir=None, dir_fd=None, recursive=False, include_hidden=False)
Return a list of paths matching a pathname pattern.
Example
Jinja call:
Result:['.git', '.gitignore', '.venv', '.github', '.pre-commit-config.yaml']
DocStrings
Source code in python3.13/glob.py
path_join¶
path_join(a, *p)
Join two or more pathname components, inserting '/' as needed.