reuse package¶
Submodules¶
- reuse.comment module
AppleScriptCommentStyleAspxCommentStyleBatchFileCommentStyleBibTexCommentStyleCCommentStyleCSingleCommentStyleCommentCreateErrorCommentParseErrorCommentStyleCommentStyle.INDENT_AFTER_MIDDLECommentStyle.INDENT_AFTER_SINGLECommentStyle.INDENT_BEFORE_ENDCommentStyle.INDENT_BEFORE_MIDDLECommentStyle.MULTI_LINECommentStyle.SHEBANGSCommentStyle.SHORTHANDCommentStyle.SINGLE_LINECommentStyle.SINGLE_LINE_REGEXPCommentStyle.can_handle_multi()CommentStyle.can_handle_single()CommentStyle.comment_at_first_character()CommentStyle.create_comment()CommentStyle.parse_comment()
CssCommentStyleEXTENSION_COMMENT_STYLE_MAPEmptyCommentStyleFortranCommentStyleFtlCommentStyleHandlebarsCommentStyleHaskellCommentStyleHtmlCommentStyleJinjaCommentStyleJuliaCommentStyleLispCommentStyleM4CommentStyleMlCommentStyleModernFortranCommentStyleMultiLineSegmentsNAME_STYLE_MAPPlantUmlCommentStylePythonCommentStyleReStructedTextCommentStyleSemicolonCommentStyleTexCommentStyleUncommentableCommentStyleVelocityCommentStyleVimCommentStyleXQueryCommentStyle
- reuse.download module
- reuse.header module
- reuse.init 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.
- exception reuse.IdentifierNotFound[source]¶
Bases:
ReuseExceptionCould not find SPDX identifier for license file.
- 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:
objectSimple dataclass holding licensing and copyright information
- contains_copyright_or_licensing() bool[source]¶
Either spdx_expressions or copyright_lines is non-empty.
- contributor_lines: Set[str]¶
- copy(**kwargs: Any) ReuseInfo[source]¶
Return a copy of ReuseInfo, replacing the values of attributes with the values from kwargs.
- copyright_lines: Set[str]¶
- path: str | None = None¶
- source_path: str | None = None¶
- source_type: SourceType | None = None¶
- spdx_expressions: Set[Expression]¶
- 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
- class reuse.SourceType(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)[source]¶
Bases:
EnumAn enumeration representing the types of sources for license information.
- DEP5 = 'dep5'¶
A .reuse/dep5 file containing license information.
- DOT_LICENSE = 'dot-license'¶
A .license file containing license information.
- FILE_HEADER = 'file-header'¶
A file header containing license information.