bundle.docs.copyright

Attributes

log

Functions

render_header(→ str)

Render a copyright + license header for the given file type.

scan_copyright(, exclude_patterns, ...)

Scan a directory tree and classify files by copyright header presence.

update_copyright_year(→ bool)

Update the copyright year in a file's header.

add_copyright_header(→ bool)

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.

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).

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.

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.