reuse package¶
Submodules¶
- reuse.comment module
CommentParseError
CommentCreateError
MultiLineSegments
CommentStyle
AppleScriptCommentStyle
AspxCommentStyle
BatchFileCommentStyle
BibTexCommentStyle
CCommentStyle
CppCommentStyle
CppSingleCommentStyle
EmptyCommentStyle
FortranCommentStyle
ModernFortranCommentStyle
FtlCommentStyle
HandlebarsCommentStyle
HaskellCommentStyle
HtmlCommentStyle
JinjaCommentStyle
JuliaCommentStyle
LispCommentStyle
M4CommentStyle
MlCommentStyle
PlantUmlCommentStyle
PythonCommentStyle
ReStructedTextCommentStyle
SemicolonCommentStyle
TexCommentStyle
UncommentableCommentStyle
UnixManCommentStyle
VelocityCommentStyle
VimCommentStyle
XQueryCommentStyle
EXTENSION_COMMENT_STYLE_MAP
NAME_STYLE_MAP
- reuse.convert_dep5 module
- reuse.download module
- reuse.global_licensing module
- reuse.header module
- reuse.lint module
- reuse.project module
- reuse.report module
- reuse.spdx module
- reuse.supported_licenses module
- reuse.vcs module
Module contents¶
reuse is a tool for compliance with the REUSE recommendations.
Although the API is documented, it is NOT guaranteed stable between minor or even patch releases. The semantic versioning of this program pertains exclusively to the reuse CLI command. If you want to use reuse as a Python library, you should pin reuse to an exact version.
Having given the above disclaimer, the API has been relatively stable nevertheless, and we (the maintainers) do make some efforts to not needlessly change the public API.
- class reuse.SourceType(value)[source]¶
Bases:
Enum
An enumeration representing the types of sources for license information.
- DOT_LICENSE = 'dot-license'¶
A .license file containing license information.
- FILE_HEADER = 'file-header'¶
A file header containing license information.
- DEP5 = 'dep5'¶
A .reuse/dep5 file containing license information.
- REUSE_TOML = 'reuse-toml'¶
A REUSE.toml file containing license information.
- class reuse.ReuseInfo(spdx_expressions: ~typing.Set[~boolean.boolean.Expression] = <factory>, copyright_lines: ~typing.Set[str] = <factory>, contributor_lines: ~typing.Set[str] = <factory>, path: str | None = None, source_path: str | None = None, source_type: ~reuse.SourceType | None = None)[source]¶
Bases:
object
Simple dataclass holding licensing and copyright information
- source_type: SourceType | None = None¶
- copy(**kwargs: Any) ReuseInfo [source]¶
Return a copy of ReuseInfo, replacing the values of attributes with the values from kwargs.
- union(value: ReuseInfo) ReuseInfo [source]¶
Return a new instance of ReuseInfo where all Set attributes are equal to the union of the set in self and the set in value.
All non-Set attributes are set to their values in self.
>>> one = ReuseInfo(copyright_lines={"Jane Doe"}, source_path="foo.py") >>> two = ReuseInfo(copyright_lines={"John Doe"}, source_path="bar.py") >>> result = one.union(two) >>> print(sorted(result.copyright_lines)) ['Jane Doe', 'John Doe'] >>> print(result.source_path) foo.py
- contains_copyright_or_licensing() bool [source]¶
Either spdx_expressions or copyright_lines is non-empty.
- exception reuse.IdentifierNotFound[source]¶
Bases:
ReuseException
Could not find SPDX identifier for license file.