reuse.comment module - reuse 6.1.2 documentation

Skip to content
Back to top
View this page

# reuse.comment module

Module for parsing and creating comments. Just enough to deal with comment headers, in any case.

class reuse.comment.MultiLineSegments(start: str, middle: str, end: str)

  Bases: `NamedTuple`

  Components that make up a multi-line comment style, e.g. `'/*'`, `'*'`, and `'*/'`.

  start: str

    Alias for field number 0

  middle: str

    Alias for field number 1

  end: str

    Alias for field number 2

class reuse.comment.CommentStyle

  Bases: `object`

  Base class for comment style.

  SHORTHAND = ''
  SINGLE_LINE = ''
  SINGLE_LINE_REGEXP: Pattern | None = None
  INDENT_AFTER_SINGLE = ''
  MULTI_LINE = ('', '', '')
  INDENT_BEFORE_MIDDLE = ''
  INDENT_AFTER_MIDDLE = ''
  INDENT_BEFORE_END = ''
  SHEBANGS: list[str] = []
  classmethod can_handle_single() → bool

    Whether the `CommentStyle` can handle single-line comments.

  classmethod can_handle_multi() → bool

    Whether the `CommentStyle` can handle multi-line comments.

  classmethod create_comment(text: str, force_multi: bool = False) → str

    Comment all lines in text. Single-line comments are preferred over multi-line comments, unless force_multi is provided.

    Raises:

      CommentCreateError – if text could not be commented.

  classmethod parse_comment(text: str) → str

    Uncomment all lines in text.

    Raises:

      CommentParseError – if text could not be parsed.

  classmethod comment_at_first_character(text: str) → str

    Return the comment block that starts at the first character of text. This is chiefly handy to get the header comment of a file, assuming that the header comment starts at the first character in the file.

    Raises:

      CommentParseError – if text does not start with a parseable comment block.

class reuse.comment.AppleScriptCommentStyle

  Bases: `CommentStyle`

  AppleScript comment style.

  SHORTHAND = 'applescript'
  SINGLE_LINE = '--'
  INDENT_AFTER_SINGLE = ' '
  MULTI_LINE = ('(*', '', '*)')

class reuse.comment.AspxCommentStyle

  Bases: `CommentStyle`

  ASPX comment style.

  SHORTHAND = 'aspx'
  MULTI_LINE = ('<%--', '', '--%>')

class reuse.comment.BatchFileCommentStyle

  Bases: `CommentStyle`

  Windows batch file comment style.

  SHORTHAND = 'bat'
  SINGLE_LINE = 'REM'
  INDENT_AFTER_SINGLE = ' '

class reuse.comment.BibTexCommentStyle

  Bases: `CommentStyle`

  BibTex comment style.

  SHORTHAND = 'bibtex'
  MULTI_LINE = ('@Comment{', '', '}')
  SHEBANGS: list[str] = ['% !BIB', '%!BIB']

class reuse.comment.BladeCommentStyle

  Bases: `CommentStyle`

  Laravel Blade Template comment style.

  MULTI_LINE = ('{{--', '', '--}}')

class reuse.comment.CCommentStyle

  Bases: `CommentStyle`

  C comment style.

  SHORTHAND = 'c'
  MULTI_LINE = ('/*', '*', '*/')
  INDENT_BEFORE_MIDDLE = ' '
  INDENT_AFTER_MIDDLE = ' '
  INDENT_BEFORE_END = ' '

class reuse.comment.CppCommentStyle

  Bases: `CommentStyle`

  C++ comment style.

  SHORTHAND = 'cpp'
  SINGLE_LINE = '//'
  INDENT_AFTER_SINGLE = ' '
  MULTI_LINE = ('/*', '*', '*/')
  INDENT_BEFORE_MIDDLE = ' '
  INDENT_AFTER_MIDDLE = ' '
  INDENT_BEFORE_END = ' '
  SHEBANGS: list[str] = ['#!', '<?php']

class reuse.comment.CppSingleCommentStyle

  Bases: `CommentStyle`

  C++ single-only comment style.

  SHORTHAND = 'cppsingle'
  SINGLE_LINE = '//'
  INDENT_AFTER_SINGLE = ' '
  SHEBANGS: list[str] = ['#!']

class reuse.comment.EmptyCommentStyle

  Bases: `CommentStyle`

  Hacky comment style for files that have no comments.

  classmethod create_comment(text: str, force_multi: bool = False) → str

    Comment all lines in text. Single-line comments are preferred over multi-line comments, unless force_multi is provided.

    Raises:

      CommentCreateError – if text could not be commented.

  classmethod parse_comment(text: str) → str

    Uncomment all lines in text.

    Raises:

      CommentParseError – if text could not be parsed.

  classmethod comment_at_first_character(text: str) → str

    Return the comment block that starts at the first character of text. This is chiefly handy to get the header comment of a file, assuming that the header comment starts at the first character in the file.

    Raises:

      CommentParseError – if text does not start with a parseable comment block.

class reuse.comment.FortranCommentStyle

  Bases: `CommentStyle`

  Fortran (fixed form) comment style.

  SHORTHAND = 'f'
  SINGLE_LINE = 'c'
  INDENT_AFTER_SINGLE = ' '

class reuse.comment.ModernFortranCommentStyle

  Bases: `CommentStyle`

  Fortran (free form) comment style.

  SHORTHAND = 'f90'
  SINGLE_LINE = '!'
  INDENT_AFTER_SINGLE = ' '

class reuse.comment.FtlCommentStyle

  Bases: `CommentStyle`

  FreeMarker Template Language comment style.

  SHORTHAND = 'ftl'
  MULTI_LINE = ('<#--', '', '-->')

class reuse.comment.HandlebarsCommentStyle

  Bases: `CommentStyle`

  Handlebars comment style.

  SHORTHAND = 'handlebars'
  MULTI_LINE = ('{{!--', '', '--}}')

class reuse.comment.HaskellCommentStyle

  Bases: `CommentStyle`

  Haskell comment style.

  SHORTHAND = 'haskell'
  SINGLE_LINE = '--'
  INDENT_AFTER_SINGLE = ' '
  SHEBANGS: list[str] = ['cabal-version:']

class reuse.comment.HtmlCommentStyle

  Bases: `CommentStyle`

  HTML comment style.

  SHORTHAND = 'html'
  MULTI_LINE = ('<!--', '', '-->')
  SHEBANGS: list[str] = ['<?xml']

class reuse.comment.JinjaCommentStyle

  Bases: `CommentStyle`

  Jinja2 comment style.

  SHORTHAND = 'jinja'
  MULTI_LINE = ('{#', '', '#}')

class reuse.comment.JuliaCommentStyle

  Bases: `CommentStyle`

  Julia comment style.

  SHORTHAND = 'julia'
  SINGLE_LINE = '#'
  INDENT_AFTER_SINGLE = ' '
  MULTI_LINE = ('#=', '', '=#')
  SHEBANGS: list[str] = ['#!']

class reuse.comment.LeanCommentStyle

  Bases: `CommentStyle`

  Lean comment style.

  SHORTHAND = 'lean'
  SINGLE_LINE = '--'
  INDENT_AFTER_SINGLE = ' '
  MULTI_LINE = ('/-', '-', '-/')
  INDENT_BEFORE_MIDDLE = ' '
  INDENT_AFTER_MIDDLE = ' '
  INDENT_BEFORE_END = ' '

class reuse.comment.LispCommentStyle

  Bases: `CommentStyle`

  Lisp comment style.

  SHORTHAND = 'lisp'
  SINGLE_LINE = ';;;'
  SINGLE_LINE_REGEXP: Pattern | None = re.compile('^;+\\s*')
  INDENT_AFTER_SINGLE = ' '

class reuse.comment.M4CommentStyle

  Bases: `CommentStyle`

  M4 (autoconf) comment style.

  SHORTHAND = 'm4'
  SINGLE_LINE = 'dnl'
  INDENT_AFTER_SINGLE = ' '

class reuse.comment.MlCommentStyle

  Bases: `CommentStyle`

  ML comment style.

  SHORTHAND = 'ml'
  MULTI_LINE = ('(*', '*', '*)')
  INDENT_BEFORE_MIDDLE = ' '
  INDENT_AFTER_MIDDLE = ' '
  INDENT_BEFORE_END = ' '

class reuse.comment.PlantUmlCommentStyle

  Bases: `CommentStyle`

  PlantUML comment style.

  SHORTHAND = 'plantuml'
  SINGLE_LINE = "'"
  INDENT_AFTER_SINGLE = ' '
  MULTI_LINE = ("/'", "'", "'/")
  INDENT_BEFORE_MIDDLE = ' '
  INDENT_AFTER_MIDDLE = ' '
  INDENT_BEFORE_END = ' '

class reuse.comment.PythonCommentStyle

  Bases: `CommentStyle`

  Python comment style.

  SHORTHAND = 'python'
  SINGLE_LINE = '#'
  INDENT_AFTER_SINGLE = ' '
  SHEBANGS: list[str] = ['#!']

class reuse.comment.ReStructedTextCommentStyle

  Bases: `CommentStyle`

  reStructuredText comment style.

  SHORTHAND = 'rst'
  SINGLE_LINE = '..'
  INDENT_AFTER_SINGLE = ' '

class reuse.comment.SemicolonCommentStyle

  Bases: `CommentStyle`

  Semicolon comment style.

  SHORTHAND = 'semicolon'
  SINGLE_LINE = ';'
  INDENT_AFTER_SINGLE = ' '

class reuse.comment.TexCommentStyle

  Bases: `CommentStyle`

  TeX comment style.

  SHORTHAND = 'tex'
  SINGLE_LINE = '%'
  INDENT_AFTER_SINGLE = ' '
  SHEBANGS: list[str] = ['% !TEX', '%!TEX', '#!']

class reuse.comment.UncommentableCommentStyle

  Bases: `EmptyCommentStyle`

  A pseudo comment style to indicate that this file is uncommentable. This results in an external .license file for binaries and –force-dot-license.

class reuse.comment.UnixManCommentStyle

  Bases: `CommentStyle`

  UNIX manual page comment style.

  SHORTHAND = 'man'
  SINGLE_LINE = '.\\"'
  INDENT_AFTER_SINGLE = ' '

class reuse.comment.VelocityCommentStyle

  Bases: `CommentStyle`

  Apache Velocity Template Language comment style.

  SHORTHAND = 'vst'
  MULTI_LINE = ('#*', ' ', '*#')

class reuse.comment.VimCommentStyle

  Bases: `CommentStyle`

  Vim(Script|Config) style.

  SHORTHAND = 'vim'
  SINGLE_LINE = '"'
  INDENT_AFTER_SINGLE = ' '

class reuse.comment.XQueryCommentStyle

  Bases: `CommentStyle`

  XQuery comment style.

  SHORTHAND = 'xquery'
  MULTI_LINE = ('(:', ':', ':)')
  INDENT_BEFORE_MIDDLE = ' '
  INDENT_AFTER_MIDDLE = ' '
  INDENT_BEFORE_END = ' '

reuse.comment.EXTENSION_COMMENT_STYLE_MAP = {'.R': <class 'reuse.comment.PythonCommentStyle'>, '.Rmd': <class 'reuse.comment.HtmlCommentStyle'>, '.adb': <class 'reuse.comment.HaskellCommentStyle'>, '.adoc': <class 'reuse.comment.CppCommentStyle'>, '.ads': <class 'reuse.comment.HaskellCommentStyle'>, '.aes': <class 'reuse.comment.UncommentableCommentStyle'>, '.ahk': <class 'reuse.comment.SemicolonCommentStyle'>, '.ahkl': <class 'reuse.comment.SemicolonCommentStyle'>, '.aidl': <class 'reuse.comment.CppCommentStyle'>, '.applescript': <class 'reuse.comment.AppleScriptCommentStyle'>, '.arb': <class 'reuse.comment.UncommentableCommentStyle'>, '.asax': <class 'reuse.comment.AspxCommentStyle'>, '.asc': <class 'reuse.comment.CppCommentStyle'>, '.asciidoc': <class 'reuse.comment.CppCommentStyle'>, '.ashx': <class 'reuse.comment.AspxCommentStyle'>, '.asm': <class 'reuse.comment.LispCommentStyle'>, '.asmx': <class 'reuse.comment.AspxCommentStyle'>, '.aspx': <class 'reuse.comment.AspxCommentStyle'>, '.aux': <class 'reuse.comment.TexCommentStyle'>, '.awk': <class 'reuse.comment.PythonCommentStyle'>, '.axd': <class 'reuse.comment.AspxCommentStyle'>, '.bash': <class 'reuse.comment.PythonCommentStyle'>, '.bat': <class 'reuse.comment.BatchFileCommentStyle'>, '.bats': <class 'reuse.comment.PythonCommentStyle'>, '.bb': <class 'reuse.comment.PythonCommentStyle'>, '.bbappend': <class 'reuse.comment.PythonCommentStyle'>, '.bbclass': <class 'reuse.comment.PythonCommentStyle'>, '.bib': <class 'reuse.comment.BibTexCommentStyle'>, '.blade.php': <class 'reuse.comment.BladeCommentStyle'>, '.bzl': <class 'reuse.comment.PythonCommentStyle'>, '.c': <class 'reuse.comment.CCommentStyle'>, '.cabal': <class 'reuse.comment.HaskellCommentStyle'>, '.cc': <class 'reuse.comment.CppCommentStyle'>, '.cjs': <class 'reuse.comment.CppCommentStyle'>, '.cl': <class 'reuse.comment.LispCommentStyle'>, '.clj': <class 'reuse.comment.LispCommentStyle'>, '.cljc': <class 'reuse.comment.LispCommentStyle'>, '.cljs': <class 'reuse.comment.LispCommentStyle'>, '.cls': <class 'reuse.comment.TexCommentStyle'>, '.cmake': <class 'reuse.comment.PythonCommentStyle'>, '.code-workspace': <class 'reuse.comment.CppCommentStyle'>, '.coffee': <class 'reuse.comment.PythonCommentStyle'>, '.cpp': <class 'reuse.comment.CppCommentStyle'>, '.cs': <class 'reuse.comment.CppCommentStyle'>, '.csl': <class 'reuse.comment.HtmlCommentStyle'>, '.cson': <class 'reuse.comment.PythonCommentStyle'>, '.csproj': <class 'reuse.comment.HtmlCommentStyle'>, '.css': <class 'reuse.comment.CCommentStyle'>, '.csv': <class 'reuse.comment.UncommentableCommentStyle'>, '.cu': <class 'reuse.comment.CppCommentStyle'>, '.cuh': <class 'reuse.comment.CppCommentStyle'>, '.cxx': <class 'reuse.comment.CppCommentStyle'>, '.d': <class 'reuse.comment.CppCommentStyle'>, '.dart': <class 'reuse.comment.CppCommentStyle'>, '.di': <class 'reuse.comment.CppCommentStyle'>, '.doc': <class 'reuse.comment.UncommentableCommentStyle'>, '.docx': <class 'reuse.comment.UncommentableCommentStyle'>, '.dotx': <class 'reuse.comment.UncommentableCommentStyle'>, '.dtd': <class 'reuse.comment.HtmlCommentStyle'>, '.dts': <class 'reuse.comment.CppCommentStyle'>, '.dtsi': <class 'reuse.comment.CppCommentStyle'>, '.el': <class 'reuse.comment.LispCommentStyle'>, '.erl': <class 'reuse.comment.TexCommentStyle'>, '.es': <class 'reuse.comment.TexCommentStyle'>, '.escript': <class 'reuse.comment.TexCommentStyle'>, '.ex': <class 'reuse.comment.PythonCommentStyle'>, '.exs': <class 'reuse.comment.PythonCommentStyle'>, '.f': <class 'reuse.comment.FortranCommentStyle'>, '.f03': <class 'reuse.comment.ModernFortranCommentStyle'>, '.f08': <class 'reuse.comment.ModernFortranCommentStyle'>, '.f90': <class 'reuse.comment.ModernFortranCommentStyle'>, '.f95': <class 'reuse.comment.ModernFortranCommentStyle'>, '.fish': <class 'reuse.comment.PythonCommentStyle'>, '.fnl': <class 'reuse.comment.LispCommentStyle'>, '.fodp': <class 'reuse.comment.UncommentableCommentStyle'>, '.fods': <class 'reuse.comment.UncommentableCommentStyle'>, '.fodt': <class 'reuse.comment.UncommentableCommentStyle'>, '.for': <class 'reuse.comment.FortranCommentStyle'>, '.fpp': <class 'reuse.comment.FortranCommentStyle'>, '.fs': <class 'reuse.comment.CppCommentStyle'>, '.fsproj': <class 'reuse.comment.HtmlCommentStyle'>, '.fsx': <class 'reuse.comment.CppCommentStyle'>, '.ftl': <class 'reuse.comment.FtlCommentStyle'>, '.ftn': <class 'reuse.comment.FortranCommentStyle'>, '.gemspec': <class 'reuse.comment.PythonCommentStyle'>, '.gleam': <class 'reuse.comment.CppSingleCommentStyle'>, '.go': <class 'reuse.comment.CppCommentStyle'>, '.gperf': <class 'reuse.comment.CppCommentStyle'>, '.gqls': <class 'reuse.comment.PythonCommentStyle'>, '.gradle': <class 'reuse.comment.CppCommentStyle'>, '.graphql': <class 'reuse.comment.PythonCommentStyle'>, '.graphqls': <class 'reuse.comment.PythonCommentStyle'>, '.groovy': <class 'reuse.comment.CppCommentStyle'>, '.h': <class 'reuse.comment.CCommentStyle'>, '.ha': <class 'reuse.comment.CppSingleCommentStyle'>, '.hbs': <class 'reuse.comment.HandlebarsCommentStyle'>, '.hcl': <class 'reuse.comment.PythonCommentStyle'>, '.hh': <class 'reuse.comment.CppCommentStyle'>, '.hjson': <class 'reuse.comment.CppCommentStyle'>, '.hpp': <class 'reuse.comment.CppCommentStyle'>, '.hrl': <class 'reuse.comment.TexCommentStyle'>, '.hs': <class 'reuse.comment.HaskellCommentStyle'>, '.html': <class 'reuse.comment.HtmlCommentStyle'>, '.hx': <class 'reuse.comment.CppCommentStyle'>, '.hxsl': <class 'reuse.comment.CppCommentStyle'>, '.ilean': <class 'reuse.comment.UncommentableCommentStyle'>, '.ini': <class 'reuse.comment.SemicolonCommentStyle'>, '.ino': <class 'reuse.comment.CppCommentStyle'>, '.ipynb': <class 'reuse.comment.UncommentableCommentStyle'>, '.iuml': <class 'reuse.comment.PlantUmlCommentStyle'>, '.j2': <class 'reuse.comment.JinjaCommentStyle'>, '.java': <class 'reuse.comment.CppCommentStyle'>, '.jinja': <class 'reuse.comment.JinjaCommentStyle'>, '.jinja2': <class 'reuse.comment.JinjaCommentStyle'>, '.jl': <class 'reuse.comment.JuliaCommentStyle'>, '.jpeg': <class 'reuse.comment.UncommentableCommentStyle'>, '.jpg': <class 'reuse.comment.UncommentableCommentStyle'>, '.js': <class 'reuse.comment.CppCommentStyle'>, '.json': <class 'reuse.comment.UncommentableCommentStyle'>, '.json5': <class 'reuse.comment.CppCommentStyle'>, '.jsonc': <class 'reuse.comment.CppCommentStyle'>, '.jsp': <class 'reuse.comment.AspxCommentStyle'>, '.jsx': <class 'reuse.comment.CppCommentStyle'>, '.jy': <class 'reuse.comment.PythonCommentStyle'>, '.ksh': <class 'reuse.comment.PythonCommentStyle'>, '.kt': <class 'reuse.comment.CppCommentStyle'>, '.kts': <class 'reuse.comment.CppCommentStyle'>, '.l': <class 'reuse.comment.LispCommentStyle'>, '.latex': <class 'reuse.comment.TexCommentStyle'>, '.ld': <class 'reuse.comment.CCommentStyle'>, '.lean': <class 'reuse.comment.LeanCommentStyle'>, '.less': <class 'reuse.comment.CCommentStyle'>, '.license': <class 'reuse.comment.EmptyCommentStyle'>, '.lisp': <class 'reuse.comment.LispCommentStyle'>, '.lsp': <class 'reuse.comment.LispCommentStyle'>, '.lua': <class 'reuse.comment.HaskellCommentStyle'>, '.m': <class 'reuse.comment.TexCommentStyle'>, '.m4': <class 'reuse.comment.M4CommentStyle'>, '.man': <class 'reuse.comment.UnixManCommentStyle'>, '.markdown': <class 'reuse.comment.HtmlCommentStyle'>, '.md': <class 'reuse.comment.HtmlCommentStyle'>, '.mjs': <class 'reuse.comment.CppCommentStyle'>, '.mk': <class 'reuse.comment.PythonCommentStyle'>, '.ml': <class 'reuse.comment.MlCommentStyle'>, '.mli': <class 'reuse.comment.MlCommentStyle'>, '.nim': <class 'reuse.comment.PythonCommentStyle'>, '.nim.cfg': <class 'reuse.comment.PythonCommentStyle'>, '.nimble': <class 'reuse.comment.PythonCommentStyle'>, '.nimrod': <class 'reuse.comment.PythonCommentStyle'>, '.nix': <class 'reuse.comment.PythonCommentStyle'>, '.odb': <class 'reuse.comment.UncommentableCommentStyle'>, '.odf': <class 'reuse.comment.UncommentableCommentStyle'>, '.odg': <class 'reuse.comment.UncommentableCommentStyle'>, '.odm': <class 'reuse.comment.UncommentableCommentStyle'>, '.odp': <class 'reuse.comment.UncommentableCommentStyle'>, '.ods': <class 'reuse.comment.UncommentableCommentStyle'>, '.odt': <class 'reuse.comment.UncommentableCommentStyle'>, '.olean': <class 'reuse.comment.UncommentableCommentStyle'>, '.org': <class 'reuse.comment.PythonCommentStyle'>, '.otp': <class 'reuse.comment.UncommentableCommentStyle'>, '.ots': <class 'reuse.comment.UncommentableCommentStyle'>, '.ott': <class 'reuse.comment.UncommentableCommentStyle'>, '.pdf': <class 'reuse.comment.UncommentableCommentStyle'>, '.pem': <class 'reuse.comment.UncommentableCommentStyle'>, '.php': <class 'reuse.comment.CppCommentStyle'>, '.php3': <class 'reuse.comment.CppCommentStyle'>, '.php4': <class 'reuse.comment.CppCommentStyle'>, '.php5': <class 'reuse.comment.CppCommentStyle'>, '.pl': <class 'reuse.comment.PythonCommentStyle'>, '.plantuml': <class 'reuse.comment.PlantUmlCommentStyle'>, '.png': <class 'reuse.comment.UncommentableCommentStyle'>, '.po': <class 'reuse.comment.PythonCommentStyle'>, '.pod': <class 'reuse.comment.PythonCommentStyle'>, '.pot': <class 'reuse.comment.PythonCommentStyle'>, '.ppt': <class 'reuse.comment.UncommentableCommentStyle'>, '.pptx': <class 'reuse.comment.UncommentableCommentStyle'>, '.pri': <class 'reuse.comment.PythonCommentStyle'>, '.pro': <class 'reuse.comment.PythonCommentStyle'>, '.properties': <class 'reuse.comment.PythonCommentStyle'>, '.props': <class 'reuse.comment.HtmlCommentStyle'>, '.proto': <class 'reuse.comment.CppCommentStyle'>, '.ps1': <class 'reuse.comment.PythonCommentStyle'>, '.psm1': <class 'reuse.comment.PythonCommentStyle'>, '.pu': <class 'reuse.comment.PlantUmlCommentStyle'>, '.puml': <class 'reuse.comment.PlantUmlCommentStyle'>, '.pxd': <class 'reuse.comment.PythonCommentStyle'>, '.py': <class 'reuse.comment.PythonCommentStyle'>, '.pyi': <class 'reuse.comment.PythonCommentStyle'>, '.pyw': <class 'reuse.comment.PythonCommentStyle'>, '.pyx': <class 'reuse.comment.PythonCommentStyle'>, '.qbs': <class 'reuse.comment.CppCommentStyle'>, '.qml': <class 'reuse.comment.CppCommentStyle'>, '.qrc': <class 'reuse.comment.HtmlCommentStyle'>, '.qss': <class 'reuse.comment.CCommentStyle'>, '.rake': <class 'reuse.comment.PythonCommentStyle'>, '.rb': <class 'reuse.comment.PythonCommentStyle'>, '.rbw': <class 'reuse.comment.PythonCommentStyle'>, '.rbx': <class 'reuse.comment.PythonCommentStyle'>, '.rkt': <class 'reuse.comment.LispCommentStyle'>, '.rs': <class 'reuse.comment.CppCommentStyle'>, '.rss': <class 'reuse.comment.HtmlCommentStyle'>, '.rst': <class 'reuse.comment.ReStructedTextCommentStyle'>, '.s': <class 'reuse.comment.CCommentStyle'>, '.sass': <class 'reuse.comment.CCommentStyle'>, '.sbt': <class 'reuse.comment.CppCommentStyle'>, '.sc': <class 'reuse.comment.CppCommentStyle'>, '.scad': <class 'reuse.comment.CppCommentStyle'>, '.scala': <class 'reuse.comment.CppCommentStyle'>, '.scm': <class 'reuse.comment.LispCommentStyle'>, '.scpt': <class 'reuse.comment.AppleScriptCommentStyle'>, '.scptd': <class 'reuse.comment.AppleScriptCommentStyle'>, '.scss': <class 'reuse.comment.CCommentStyle'>, '.scsyndef': <class 'reuse.comment.UncommentableCommentStyle'>, '.sh': <class 'reuse.comment.PythonCommentStyle'>, '.sld': <class 'reuse.comment.LispCommentStyle'>, '.sln': <class 'reuse.comment.UncommentableCommentStyle'>, '.sls': <class 'reuse.comment.LispCommentStyle'>, '.sml': <class 'reuse.comment.MlCommentStyle'>, '.soy': <class 'reuse.comment.CppCommentStyle'>, '.sps': <class 'reuse.comment.LispCommentStyle'>, '.sql': <class 'reuse.comment.HaskellCommentStyle'>, '.sty': <class 'reuse.comment.TexCommentStyle'>, '.svelte': <class 'reuse.comment.HtmlCommentStyle'>, '.svg': <class 'reuse.comment.UncommentableCommentStyle'>, '.swift': <class 'reuse.comment.CppCommentStyle'>, '.t': <class 'reuse.comment.PythonCommentStyle'>, '.tcl': <class 'reuse.comment.PythonCommentStyle'>, '.tex': <class 'reuse.comment.TexCommentStyle'>, '.textile': <class 'reuse.comment.HtmlCommentStyle'>, '.tf': <class 'reuse.comment.PythonCommentStyle'>, '.tfvars': <class 'reuse.comment.PythonCommentStyle'>, '.thy': <class 'reuse.comment.MlCommentStyle'>, '.toc': <class 'reuse.comment.TexCommentStyle'>, '.toml': <class 'reuse.comment.PythonCommentStyle'>, '.ts': <class 'reuse.comment.CppCommentStyle'>, '.tsx': <class 'reuse.comment.CppCommentStyle'>, '.ttl': <class 'reuse.comment.PythonCommentStyle'>, '.typ': <class 'reuse.comment.CppCommentStyle'>, '.ui': <class 'reuse.comment.HtmlCommentStyle'>, '.v': <class 'reuse.comment.CppCommentStyle'>, '.vala': <class 'reuse.comment.CppCommentStyle'>, '.vbproj': <class 'reuse.comment.HtmlCommentStyle'>, '.vhdl': <class 'reuse.comment.HaskellCommentStyle'>, '.vim': <class 'reuse.comment.VimCommentStyle'>, '.vm': <class 'reuse.comment.VelocityCommentStyle'>, '.vsh': <class 'reuse.comment.CppCommentStyle'>, '.vtl': <class 'reuse.comment.VelocityCommentStyle'>, '.vue': <class 'reuse.comment.HtmlCommentStyle'>, '.webp': <class 'reuse.comment.UncommentableCommentStyle'>, '.xls': <class 'reuse.comment.UncommentableCommentStyle'>, '.xlsx': <class 'reuse.comment.UncommentableCommentStyle'>, '.xml': <class 'reuse.comment.HtmlCommentStyle'>, '.xq': <class 'reuse.comment.XQueryCommentStyle'>, '.xql': <class 'reuse.comment.XQueryCommentStyle'>, '.xqm': <class 'reuse.comment.XQueryCommentStyle'>, '.xquery': <class 'reuse.comment.XQueryCommentStyle'>, '.xqy': <class 'reuse.comment.XQueryCommentStyle'>, '.xrl': <class 'reuse.comment.TexCommentStyle'>, '.xsd': <class 'reuse.comment.HtmlCommentStyle'>, '.xsh': <class 'reuse.comment.PythonCommentStyle'>, '.xsl': <class 'reuse.comment.HtmlCommentStyle'>, '.yaml': <class 'reuse.comment.PythonCommentStyle'>, '.yml': <class 'reuse.comment.PythonCommentStyle'>, '.yrl': <class 'reuse.comment.TexCommentStyle'>, '.zig': <class 'reuse.comment.CppSingleCommentStyle'>, '.zsh': <class 'reuse.comment.PythonCommentStyle'>}

  A map of (common) file extensions against comment types.

reuse.comment.NAME_STYLE_MAP = {'': <class 'reuse.comment.BladeCommentStyle'>, 'applescript': <class 'reuse.comment.AppleScriptCommentStyle'>, 'aspx': <class 'reuse.comment.AspxCommentStyle'>, 'bat': <class 'reuse.comment.BatchFileCommentStyle'>, 'bibtex': <class 'reuse.comment.BibTexCommentStyle'>, 'c': <class 'reuse.comment.CCommentStyle'>, 'cpp': <class 'reuse.comment.CppCommentStyle'>, 'cppsingle': <class 'reuse.comment.CppSingleCommentStyle'>, 'f': <class 'reuse.comment.FortranCommentStyle'>, 'f90': <class 'reuse.comment.ModernFortranCommentStyle'>, 'ftl': <class 'reuse.comment.FtlCommentStyle'>, 'handlebars': <class 'reuse.comment.HandlebarsCommentStyle'>, 'haskell': <class 'reuse.comment.HaskellCommentStyle'>, 'html': <class 'reuse.comment.HtmlCommentStyle'>, 'jinja': <class 'reuse.comment.JinjaCommentStyle'>, 'julia': <class 'reuse.comment.JuliaCommentStyle'>, 'lean': <class 'reuse.comment.LeanCommentStyle'>, 'lisp': <class 'reuse.comment.LispCommentStyle'>, 'm4': <class 'reuse.comment.M4CommentStyle'>, 'man': <class 'reuse.comment.UnixManCommentStyle'>, 'ml': <class 'reuse.comment.MlCommentStyle'>, 'plantuml': <class 'reuse.comment.PlantUmlCommentStyle'>, 'python': <class 'reuse.comment.PythonCommentStyle'>, 'rst': <class 'reuse.comment.ReStructedTextCommentStyle'>, 'semicolon': <class 'reuse.comment.SemicolonCommentStyle'>, 'tex': <class 'reuse.comment.TexCommentStyle'>, 'vim': <class 'reuse.comment.VimCommentStyle'>, 'vst': <class 'reuse.comment.VelocityCommentStyle'>, 'xquery': <class 'reuse.comment.XQueryCommentStyle'>}

  A map of human-friendly names against style classes.

reuse.comment.get_comment_style(path: str | PathLike[str]) → type[CommentStyle] | None

  Return value of CommentStyle detected for path or None.

reuse.comment.is_uncommentable(path: Path) → bool

  path’s extension has the UncommentableCommentStyle.

reuse.comment.has_style(path: Path) → bool

  path’s extension has a CommentStyle.