rope.base.utils

Submodules

Attributes

cacheit

Functions

saveit(func)

A decorator that caches the return value of a function

prevent_recursion(default)

A decorator that returns the return value of default in recursions

ignore_exception(exception_class)

A decorator that ignores exception_class exceptions

deprecated([message])

A decorator for deprecated functions

cached(size)

A caching decorator based on parameter objects

resolve(str_or_obj)

Returns object from string

guess_def_lineno(module, node)

Find the line number for a function or class definition.

Package Contents

rope.base.utils.saveit(func)

A decorator that caches the return value of a function

rope.base.utils.cacheit
rope.base.utils.prevent_recursion(default)

A decorator that returns the return value of default in recursions

rope.base.utils.ignore_exception(exception_class)

A decorator that ignores exception_class exceptions

rope.base.utils.deprecated(message=None)

A decorator for deprecated functions

rope.base.utils.cached(size)

A caching decorator based on parameter objects

rope.base.utils.resolve(str_or_obj)

Returns object from string

rope.base.utils.guess_def_lineno(module, node)

Find the line number for a function or class definition.

node may be either an ast.FunctionDef, ast.AsyncFunctionDef, or ast.ClassDef

Python 3.8 simply provides this to us, but in earlier versions the ast node.lineno points to the first decorator rather than the actual definition, so we try our best to find where the definitions are.

This is to workaround bpo-33211 (https://bugs.python.org/issue33211)