bundle.docs.copyright¶
Attributes¶
Functions¶
|
Render a copyright + license header for the given file type. |
|
Scan a directory tree and classify files by copyright header presence. |
|
Update the copyright year in a file's header. |
|
Prepend a copyright + license header to a file that lacks one. |
Module Contents¶
- bundle.docs.copyright.log¶
- bundle.docs.copyright.render_header(year: int, owner: str, suffix: str) str[source]¶
Render a copyright + license header for the given file type.
- Parameters:
year – Copyright year.
owner – Copyright holder name.
suffix – File extension (e.g. “.py”, “.cpp”).
- Returns:
The formatted header string, or empty string for unsupported types.
- bundle.docs.copyright.scan_copyright(root: pathlib.Path, extensions: tuple[str, Ellipsis] = ('.py', '.cpp', '.c', '.h', '.hpp'), exclude_patterns: tuple[str, Ellipsis] = ('__pycache__', '_version.py', 'vendor', 'node_modules')) tuple[list[pathlib.Path], list[pathlib.Path]][source]¶
Scan a directory tree and classify files by copyright header presence.
- Parameters:
root – Directory to scan recursively.
extensions – File extensions to check.
exclude_patterns – Path substrings to skip.
- Returns:
Tuple of (files_with_copyright, files_without_copyright).
- bundle.docs.copyright.update_copyright_year(path: pathlib.Path, new_year: int) bool[source]¶
Update the copyright year in a file’s header.
- Parameters:
path – File to update.
new_year – Year to set.
- Returns:
True if the file was modified, False if no copyright line was found.
- bundle.docs.copyright.add_copyright_header(path: pathlib.Path, year: int, owner: str) bool[source]¶
Prepend a copyright + license header to a file that lacks one.
- Parameters:
path – File to prepend the header to.
year – Copyright year.
owner – Copyright holder name.
- Returns:
True if the header was added, False if unsupported extension or already present.