Skip to main content

No project description provided

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_root_dir

get_root_dir() -> os.PathLike Returns script directory path

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

collect_static-0.1.0.tar.gz (2.7 kB view details)

Uploaded Source

Built Distribution

collect_static-0.1.0-py3-none-any.whl (3.6 kB view details)

Uploaded Python 3

File details

Details for the file collect_static-0.1.0.tar.gz.

File metadata

  • Download URL: collect_static-0.1.0.tar.gz
  • Upload date:
  • Size: 2.7 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

Hashes for collect_static-0.1.0.tar.gz
Algorithm Hash digest
SHA256 7b631a3ae7425badbc74edb3648d89a037b5e4b6a3ead55639031c0719780609
MD5 ae6948d2b6ac3dae79ab789280f0685d
BLAKE2b-256 d5b85a9967d3ddcd5dc6a9a0e1a9c9da4c70116e0da5932855bfcb26d90d406c

See more details on using hashes here.

File details

Details for the file collect_static-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: collect_static-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 3.6 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

Hashes for collect_static-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ded3c81466817f0aa76b689af29b884511f3e1570a58e061538ec4d16dbc7cc7
MD5 dedee50289de94e3c3c46c03fd627d43
BLAKE2b-256 bc156dae527e92386cb7ca918b8ca4140c5110017d4940235260726f31a2bf64

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page