rope.refactor.importutils.importinfo

Classes

ImportStatement

Represent an import in a module

ImportInfo

Helper class that provides a standard way to create an ABC using

NormalImport

Helper class that provides a standard way to create an ABC using

FromImport

Helper class that provides a standard way to create an ABC using

EmptyImport

Helper class that provides a standard way to create an ABC using

ImportContext

Module Contents

class rope.refactor.importutils.importinfo.ImportStatement(import_info, start_line, end_line, main_statement=None, blank_lines=0)

Represent an import in a module

readonly attribute controls whether this import can be changed by import actions or not.

start_line
end_line
readonly = False
main_statement = None
import_info
new_start = None
blank_lines = 0
get_import_statement()
empty_import()
move(lineno, blank_lines=0)
get_old_location()
get_new_start()
is_changed()
accept(visitor)
class rope.refactor.importutils.importinfo.ImportInfo

Bases: abc.ABC

Helper class that provides a standard way to create an ABC using inheritance.

names_and_aliases: List[Tuple[str, str | None]]
abstractmethod get_imported_primaries(context) → List[str]
get_imported_names(context)
abstractmethod get_import_statement() → str
is_empty()
static get_empty_import()
class rope.refactor.importutils.importinfo.NormalImport(names_and_aliases: List[Tuple[str, str | None]])

Bases: ImportInfo

Helper class that provides a standard way to create an ABC using inheritance.

names_and_aliases
get_imported_primaries(context) → List[str]
get_import_statement() → str
is_empty()
get_imported_names(context)
static get_empty_import()
class rope.refactor.importutils.importinfo.FromImport(module_name: str, level: int, names_and_aliases: List[Tuple[str, str | None]])

Bases: ImportInfo

Helper class that provides a standard way to create an ABC using inheritance.

module_name: str
level: int
names_and_aliases
get_imported_primaries(context) → List[str]
get_imported_resource(context)

Get the imported resource

Returns None if module was not found.

get_imported_module(context)

Get the imported PyModule

Raises rope.base.exceptions.ModuleNotFoundError if module could not be found.

get_import_statement() → str
is_empty()
is_star_import()
get_imported_names(context)
static get_empty_import()
class rope.refactor.importutils.importinfo.EmptyImport

Bases: ImportInfo

Helper class that provides a standard way to create an ABC using inheritance.

names_and_aliases = []
is_empty()
get_imported_primaries(context) → List[str]
abstractmethod get_import_statement() → str
get_imported_names(context)
static get_empty_import()
class rope.refactor.importutils.importinfo.ImportContext(project, folder)
project
folder