rope.refactor.importutils.importinfo ==================================== .. py:module:: rope.refactor.importutils.importinfo Classes ------- .. autoapisummary:: rope.refactor.importutils.importinfo.ImportStatement rope.refactor.importutils.importinfo.ImportInfo rope.refactor.importutils.importinfo.NormalImport rope.refactor.importutils.importinfo.FromImport rope.refactor.importutils.importinfo.EmptyImport rope.refactor.importutils.importinfo.ImportContext Module Contents --------------- .. py:class:: 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. .. py:attribute:: start_line .. py:attribute:: end_line .. py:attribute:: readonly :value: False .. py:attribute:: main_statement :value: None .. py:attribute:: import_info .. py:attribute:: new_start :value: None .. py:attribute:: blank_lines :value: 0 .. py:method:: get_import_statement() .. py:method:: empty_import() .. py:method:: move(lineno, blank_lines=0) .. py:method:: get_old_location() .. py:method:: get_new_start() .. py:method:: is_changed() .. py:method:: accept(visitor) .. py:class:: ImportInfo Bases: :py:obj:`abc.ABC` Helper class that provides a standard way to create an ABC using inheritance. .. py:attribute:: names_and_aliases :type: List[Tuple[str, Optional[str]]] .. py:method:: get_imported_primaries(context) -> List[str] :abstractmethod: .. py:method:: get_imported_names(context) .. py:method:: get_import_statement() -> str :abstractmethod: .. py:method:: is_empty() .. py:method:: get_empty_import() :staticmethod: .. py:class:: NormalImport(names_and_aliases: List[Tuple[str, Optional[str]]]) Bases: :py:obj:`ImportInfo` Helper class that provides a standard way to create an ABC using inheritance. .. py:attribute:: names_and_aliases .. py:method:: get_imported_primaries(context) -> List[str] .. py:method:: get_import_statement() -> str .. py:method:: is_empty() .. py:method:: get_imported_names(context) .. py:method:: get_empty_import() :staticmethod: .. py:class:: FromImport(module_name: str, level: int, names_and_aliases: List[Tuple[str, Optional[str]]]) Bases: :py:obj:`ImportInfo` Helper class that provides a standard way to create an ABC using inheritance. .. py:attribute:: module_name :type: str .. py:attribute:: level :type: int .. py:attribute:: names_and_aliases .. py:method:: get_imported_primaries(context) -> List[str] .. py:method:: get_imported_resource(context) Get the imported resource Returns `None` if module was not found. .. py:method:: get_imported_module(context) Get the imported `PyModule` Raises `rope.base.exceptions.ModuleNotFoundError` if module could not be found. .. py:method:: get_import_statement() -> str .. py:method:: is_empty() .. py:method:: is_star_import() .. py:method:: get_imported_names(context) .. py:method:: get_empty_import() :staticmethod: .. py:class:: EmptyImport Bases: :py:obj:`ImportInfo` Helper class that provides a standard way to create an ABC using inheritance. .. py:attribute:: names_and_aliases :value: [] .. py:method:: is_empty() .. py:method:: get_imported_primaries(context) -> List[str] .. py:method:: get_import_statement() -> str :abstractmethod: .. py:method:: get_imported_names(context) .. py:method:: get_empty_import() :staticmethod: .. py:class:: ImportContext(project, folder) .. py:attribute:: project .. py:attribute:: folder