code_annotations.extensions package

Submodules

code_annotations.extensions.base module

Abstract and base classes to support plugins.

class code_annotations.extensions.base.AnnotationExtension(config, echo)

Bases: object

Abstract base class that annotation extensions will inherit from.

extension_name = None
abstract search(file_handle)

Search for annotations in the given file.

class code_annotations.extensions.base.SimpleRegexAnnotationExtension(config, echo)

Bases: code_annotations.extensions.base.AnnotationExtension

Abstract base class for languages that have comments which can be reasonably searched using regular expressions.

comment_regex_fmt = "\n        {multi_start}           # start of the language-specific multi-line comment (ex. /*)\n        (?P<comment>            # Look for a multiline comment\n            [\\d\\D]*?            # capture all of the characters...\n        )\n        {multi_end}             # until you find the end of the language-specific multi-line comment (ex. */)\n        |                       # If you don't find any of those...\n        (?P<prefixed_comment>   # Look for a group of single-line comments\n            (?:                 # Non-capture mode\n                {single}        # start by finding the single-line comment token (ex. //)\n                .*              # and capture all characters until the end of the line\n                \\n?             # followed by an optional carriage return\n                \\ *             # and some empty space\n            )*                  # multiple times\n        )\n    "
lang_comment_definition = None
search(file_handle)

Search for annotations in the given file.

Parameters

file_handle – Handle for the file to validate

Returns

List of dicts describing found annotations, or an empty list

code_annotations.extensions.javascript module

Stevedore extension for static annotation searching in Javascript files.

class code_annotations.extensions.javascript.JavascriptAnnotationExtension(config, echo)

Bases: code_annotations.extensions.base.SimpleRegexAnnotationExtension

Annotation extension for Javascript source files.

extension_name = 'javascript'
lang_comment_definition = {'multi_end': '\\*/', 'multi_start': '/\\*', 'single': '//'}

code_annotations.extensions.python module

Stevedore extension for static annotation searching in Python files.

class code_annotations.extensions.python.PythonAnnotationExtension(config, echo)

Bases: code_annotations.extensions.base.SimpleRegexAnnotationExtension

Annotation extension for Python source files.

extension_name = 'python'
lang_comment_definition = {'multi_end': '"""', 'multi_start': '"""', 'single': '\\#'}

Module contents

Extensions used in static annotation functionality.