lino.utils.code

Defines some utilities to inspect the running Python code.

(This module's source code is available here.)

Functions

analyze_rst(*packages)

Example:

codefiles([pattern])

Yield a list of the source files corresponding to the currently imported modules that match the given pattern

codetime(*args, **kw)

Return the modification time of the youngest source code in memory.

is_start_of_docstring(line)

Classes

SourceFile(modulename, filename)

Counts the number of code lines in a given Python source file.

lino.utils.code.codefiles(pattern='*')

Yield a list of the source files corresponding to the currently imported modules that match the given pattern

lino.utils.code.codetime(*args, **kw)

Return the modification time of the youngest source code in memory.

Used by lino.modlib.extjs to avoid generating .js files if not necessary.

Inspired by the code_changed() function in django.utils.autoreload.

class lino.utils.code.SourceFile(modulename, filename)

Bases: object

Counts the number of code lines in a given Python source file.

lino.utils.code.analyze_rst(*packages)

Example:

>>> from lino.utils.code import analyze_rst
>>> print analyze_rst('lino')