rope.base.prefs

Rope preferences.

Attributes

DEFAULT_IMPORT_STYLE

Classes

AutoimportPrefs

ImportPrefs

Prefs

Class to store rope preferences.

ImportStyle

Create a collection of name/value pairs.

Functions

get_config(root, ropefolder) → pytoolconfig.PyToolConfig

get_preferred_import_style(prefs) → ImportStyle

Module Contents

class rope.base.prefs.AutoimportPrefs
aliases: List[Tuple[str, str]]
class rope.base.prefs.ImportPrefs
preferred_import_style: str
class rope.base.prefs.Prefs

Class to store rope preferences.

ignored_resources: List[str]
python_files: List[str]
source_folders: List[str]
python_path: List[str]
save_objectdb: bool
compress_objectdb: bool
automatic_soa: bool
soa_followed_calls: int
perform_doa: bool
validate_objectdb: bool
max_history_items: int
save_history: bool
compress_history: bool
indent_size: int
extension_modules: List[str]
import_dynload_stdmods: bool
ignore_syntax_errors: bool
ignore_bad_imports: bool
prefer_module_from_imports: bool
split_imports: bool
pull_imports_to_top: bool
sort_imports_alphabetically: bool
type_hinting_factory: str
project_opened: Callable | None
py_version: Tuple[int, int] | None
dependencies: List[packaging.requirements.Requirement] | None
callbacks: Dict[str, Callable[[Any], None]]
autoimport: AutoimportPrefs
imports: ImportPrefs
set(key: str, value: Any)

Set the value of key preference to value.

add(key: str, value: Any)

Add an entry to a list preference

Add value to the list of entries for the key preference.

get(key: str, default: Any = None)

Get the value of the key preference

add_callback(key: str, callback: Callable)

Add key preference with callback function

Whenever key is set the callback is called with the given value as parameter.

rope.base.prefs.get_config(root: rope.base.resources.Folder, ropefolder: rope.base.resources.Folder) → pytoolconfig.PyToolConfig
class rope.base.prefs.ImportStyle(*args, **kwds)

Bases: enum.Enum

Create a collection of name/value pairs.

Example enumeration:

>>> class Color(Enum):
...     RED = 1
...     BLUE = 2
...     GREEN = 3

Access them by:

  • attribute access:

>>> Color.RED
<Color.RED: 1>
  • value lookup:

>>> Color(1)
<Color.RED: 1>
  • name lookup:

>>> Color['RED']
<Color.RED: 1>

Enumerations can be iterated over, and know how many members they have:

>>> len(Color)
3
>>> list(Color)
[<Color.RED: 1>, <Color.BLUE: 2>, <Color.GREEN: 3>]

Methods can be added to enumerations, and members can have their own attributes – see the documentation for details.

normal_import = 'normal-import'
from_module = 'from-module'
from_global = 'from-global'
rope.base.prefs.DEFAULT_IMPORT_STYLE
rope.base.prefs.get_preferred_import_style(prefs: Prefs) → ImportStyle