Exemplo n.º 1
0
    def __init__(self, project, environment=None, script_path=None):
        if environment is None:
            environment = project.get_environment()
        self.environment = environment
        self.script_path = script_path
        self.compiled_subprocess = environment.get_evaluator_subprocess(self)
        self.grammar = environment.get_grammar()

        self.latest_grammar = parso.load_grammar(version='3.7')
        self.memoize_cache = {}  # for memoize decorators
        self.module_cache = imports.ModuleCache(
        )  # does the job of `sys.modules`.
        self.stub_module_cache = {
        }  # Dict[Tuple[str, ...], Optional[ModuleContext]]
        self.compiled_cache = {}  # see `evaluate.compiled.create()`
        self.inferred_element_counts = {}
        self.mixed_cache = {}  # see `evaluate.compiled.mixed._create()`
        self.analysis = []
        self.dynamic_params_depth = 0
        self.is_analysis = False
        self.project = project
        self.access_cache = {}

        self.reset_recursion_limitations()
        self.allow_different_encoding = True

        # Plugin API
        from jedi.plugins import plugin_manager
        plugin_callbacks = plugin_manager.get_callbacks(self)
        self.execute = plugin_callbacks.decorate('execute', callback=_execute)
        self._import_module = partial(
            plugin_callbacks.decorate('import_module',
                                      callback=imports.import_module),
            self,
        )
Exemplo n.º 2
0
    def __init__(self, project, environment=None, script_path=None):
        if environment is None:
            environment = project.get_environment()
        self.environment = environment
        self.script_path = script_path
        self.compiled_subprocess = environment.get_evaluator_subprocess(self)
        self.grammar = environment.get_grammar()

        self.latest_grammar = parso.load_grammar(version='3.6')
        self.memoize_cache = {}  # for memoize decorators
        self.module_cache = imports.ModuleCache(
        )  # does the job of `sys.modules`.
        self.compiled_cache = {}  # see `evaluate.compiled.create()`
        self.inferred_element_counts = {}
        self.mixed_cache = {}  # see `evaluate.compiled.mixed._create()`
        self.analysis = []
        self.dynamic_params_depth = 0
        self.is_analysis = False
        self.project = project
        self.access_cache = {}
        # This setting is only temporary to limit the work we have to do with
        # tensorflow and others.
        self.infer_enabled = True

        self.reset_recursion_limitations()
        self.allow_different_encoding = True