rope.base.libutils ================== .. py:module:: rope.base.libutils .. autoapi-nested-parse:: A few useful functions for using rope as a library Functions --------- .. autoapisummary:: rope.base.libutils.path_to_resource rope.base.libutils.path_relative_to_project_root rope.base.libutils.relative rope.base.libutils.report_change rope.base.libutils.analyze_module rope.base.libutils.analyze_modules rope.base.libutils.get_string_module rope.base.libutils.get_string_scope rope.base.libutils.is_python_file rope.base.libutils.modname Module Contents --------------- .. py:function:: path_to_resource(project, path, type=None) Get the resource at path You only need to specify `type` if `path` does not exist. It can be either 'file' or 'folder'. If the type is `None` it is assumed that the resource already exists. Note that this function uses `Project.get_resource()`, `Project.get_file()`, and `Project.get_folder()` methods. .. py:function:: path_relative_to_project_root(project, path) .. py:function:: relative(root, path) .. py:function:: report_change(project, path, old_content) Report that the contents of file at `path` was changed The new contents of file is retrieved by reading the file. .. py:function:: analyze_module(project, resource) Perform static object analysis on a python file in the project Note that this might be really time consuming. .. py:function:: analyze_modules(project, task_handle=taskhandle.DEFAULT_TASK_HANDLE) Perform static object analysis on all python files in the project Note that this might be really time consuming. .. py:function:: get_string_module(project, code, resource=None, force_errors=False) Returns a `PyObject` object for the given code If `force_errors` is `True`, `exceptions.ModuleSyntaxError` is raised if module has syntax errors. This overrides ``ignore_syntax_errors`` project config. .. py:function:: get_string_scope(project, code, resource=None) Returns a `Scope` object for the given code .. py:function:: is_python_file(project, resource) .. py:function:: modname(resource)