Provides APIs to collect/copy files to destination directory by file name pattern from given directories in script dir
Project description
Intro:
Provides APIs to collect/copy files to destination directory by file name pattern from given directories in script dir
Methods:
Method collect_files
collect_files(patterns: str | list[str], src_dirs: str | list[str] = '.', dest: str | os.PathLike = 'static', exclude_dir: str | list[str] = [], maintain_hierarchy: bool = True, respect_git_ignore: bool = True) -> bool
Args:
patterns (str | list[str]): Pattern to search files.
src_dirs (list[str]): List of source directory relative path
dest (str | os.PathLike): directory where files will be copied to
exclude_dir (str | list[str]): directory/directories to exclude
maintain_hierarchy (bool): If True then copied files will keep directory hierarchy relative to root dir
respect_git_ignore (bool): If True then function will return False if given directory is ignored by git
Returns:
newFiles (list[os.PathLike]): List of new copied file paths in destination directory.
Method get_files
get_files(patterns: str | list[str], src_dirs: str | list[str] = '.', exclude_dir: str | list[str] = 'static', respect_git_ignore: bool = True) -> list[str]
Args:
patterns (str | list[str]): Pattern to search files.
src_dirs (list[str]): List of source directory relative path
exclude_dir (str | list[str]): directory/directories to exclude
respect_git_ignore (bool): If True then function will return False if given directory is ignored by git
Returns:
files (list[os.PathLike]): List of file paths.
Method get_src_dir_path
get_src_dir_path(root_dir: os.PathLike, src_dir: str, respect_git_ignore: bool = True) -> bool | os.PathLike
Args:
root_dir (os.PathLike): base absolute path
src_dir (str): source directory relative path
respect_git_ignore (bool): If True then function will return False if given directory is ignored by git
Returns:
src_dir (bool | os.PathLike): False if path is ignored by git, Full `src_dir` path otherwise.
Method get_src_dirs
get_src_dirs(root_dir: os.PathLike, src_dirs: list[str], respect_git_ignore: bool = True) -> list[None | os.PathLike]
Args:
root_dir (os.PathLike): base absolute path
src_dirs (list[str]): List of source directory relative path
respect_git_ignore (bool): If True then function will return False if given directory is ignored by git
Returns:
src_dirs (list[os.PathLike]): List of Full path from `src_dirs`.
Method is_ignored
is_ignored(file_or_dir: str | os.PathLike) -> bool
Args:
file_or_dir (str): Name or path string of the file/directory to check
Returns:
is_ignored (bool): True if file/directory is ignore, false otherwise
:raises:
CalledProcessError: If return code for command `git check-ignore -q <file_or_dir>` not 0 or 1
Method pop_all
pop_all(li: list) -> list
Returns same emptied list
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file collect_static-0.1.1.tar.gz
.
File metadata
- Download URL: collect_static-0.1.1.tar.gz
- Upload date:
- Size: 3.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.7.1 CPython/3.10.12 Linux/5.15.153.1-microsoft-standard-WSL2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f4dd16d0169c71f8fda5aec27603f97f4531abb523811424d6541905834b20c7 |
|
MD5 | 271da3c79e458d0940c7f7f6b6b70e60 |
|
BLAKE2b-256 | 35ef2f5ec218794e00a5ea90e74c80a8b31c3c36fd4758af6f3df504c05e07cb |
File details
Details for the file collect_static-0.1.1-py3-none-any.whl
.
File metadata
- Download URL: collect_static-0.1.1-py3-none-any.whl
- Upload date:
- Size: 4.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.7.1 CPython/3.10.12 Linux/5.15.153.1-microsoft-standard-WSL2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 50fe51d70c72dc1fa7e1cca4f4eb8c356c74d66a4fd7d26f72f51a34dac4cc49 |
|
MD5 | 29fc9fa9f0b1ae6bbb4bfecad07c66a8 |
|
BLAKE2b-256 | 45409811cefae49488430945f42e0c93ec370a146226b143431674bf16b544b1 |