pyTooling.Sphinx.CondensedSource
A Python module’s source, condensed to what its documentation coverage is about: the headers and doc-strings of its
classes and functions, its variables and fields; a body is elided to ....
CondensedSource holds the condensed lines, each marked by its documentation state; its classmethod
Parse() condenses a module’s source. The pages of pyTooling.Sphinx.DocCoverage show
it as a listing.
See also
- Pages per package and module
→ The pages and the condensed listing, with examples.
Variables
Functions
documentationState(): Return the state a listing marks a line with, for a coverage state of pyEDAA.Reports’ documentation coverage model.
Classes
CondensedSource: A Python module’s source, condensed to what its documentation coverage is about.
Variables
- pyTooling.Sphinx.CondensedSource.DEFINITIONS
The statements expected to have a doc-string: a class and a function or method.
(<class 'ast.ClassDef'>, <class 'ast.FunctionDef'>, <class 'ast.AsyncFunctionDef'>)
- pyTooling.Sphinx.CondensedSource.ASSIGNMENTS
The statements declaring a variable or a class’ field.
(<class 'ast.Assign'>, <class 'ast.AnnAssign'>, <class 'ast.TypeAlias'>)
- pyTooling.Sphinx.CondensedSource.Definition
A statement expected to have a doc-string.
Definition
Functions
- pyTooling.Sphinx.CondensedSource.documentationState(coverageState)[source]
Return the state a listing marks a line with, for a coverage state of pyEDAA.Reports’ documentation coverage model.
The state is chosen as the model counts it: excluded before ignored, then documented - covered - or undocumented. An item with nothing to document (
Empty) isn’t counted, so it gets no state.- Parameters:
coverageState (
CoverageState) – The model’s coverage state.- Return type:
- Returns:
The listing’s state:
documented,undocumented,ignored,excludedor"".
Classes
- class pyTooling.Sphinx.CondensedSource.CondensedSource(lines)[source]
A Python module’s source, condensed to what its documentation coverage is about.
A line is taken as written, at its line number, or replaced by a
...line without a number:The module’s doc-string is taken; its imports and other statements are elided.
A class or function is taken with its decorators, its header up to the
:- a signature spanning lines too - and its doc-string. Its body follows: a class’ members, a function’s nested functions and classes; anything else is elided to one...at the body’s indentation. A definition written in one line is taken as written.A variable of the module and a field of a class is taken as written: with a
#:comment on its line or in the lines above it, and a doc-string literal following it.A statement holding a class or function - e.g. an
ifor atry-, and anifortryassigning a variable or field, is taken with the headers of its clauses as written; each clause’s block is taken like a body.Comments between statements are left out; consecutive blank lines become one.
A class’, function’s, field’s or variable’s lines are marked by the documentation state of its item in pyEDAA.Reports’ model: the item declared in the module’s file, which starts at the definition’s first line or at the assignment. The module’s doc-string is marked by the module’s state. Every other line has no state, e.g. a repeated assignment of a variable, as its item starts at the first one.
Inheritance
- classmethod GetMethodsWithAttributes(predicate=None)
Return the class’ methods that carry at least one matching attribute.
- Parameters:
predicate (
type[TAttr] |Iterable[type[TAttr]] |None) – Optional, an attribute class, an iterable of attribute classes, orNoneto accept every attribute.- Return type:
- Returns:
Dictionary of methods and the matching attributes attached to them.
- Raises:
ValueError – If an element of parameter ‘predicate’ is not a sub-class of
Attribute.ValueError – If parameter ‘predicate’ is neither an attribute class nor an iterable of those.
- __getstate__()
Return the object’s state for pickling, collecting every slot of the class hierarchy.
- __setstate__(state)
Restore the object’s state from unpickling, requiring exactly the slots of the class hierarchy.