Example #1
0
    def _get_module(self):
        cache.invalidate_star_import_cache(self._path)
        parser = FastParser(self._grammar, self._source, self.path)
        save_parser(self.path, parser, pickling=False)

        module = self._evaluator.wrap(parser.module)
        imports.add_module(self._evaluator, unicode(module.name), module)
        return parser.module
Example #2
0
 def _parser(self):
     cache.invalidate_star_import_cache(self._path)
     if self._use_fast_parser:
         parser = FastParser(self._grammar, self._source, self._path)
         # Don't pickle that module, because the main module is changing quickly
         cache.save_parser(self._path, None, parser, pickling=False)
     else:
         parser = Parser(self._grammar, self._source, self._path)
     return parser
Example #3
0
File: modules.py Project: lvh/jedi
 def parser(self):
     """ get the parser lazy """
     if not self._parser:
         with common.ignored(KeyError):
             parser = cache.parser_cache[self.path].parser
             cache.invalidate_star_import_cache(parser.module)
         # Call the parser already here, because it will be used anyways.
         # Also, the position is here important (which will not be used by
         # default), therefore fill the cache here.
         self._parser = fast_parser.FastParser(self.source, self.path,
                                                     self.position)
         # don't pickle that module, because it's changing fast
         cache.save_module(self.path, self.name, self._parser,
                                                         pickling=False)
     return self._parser
Example #4
0
 def parser(self):
     """ get the parser lazy """
     if not self._parser:
         with common.ignored(KeyError):
             parser = cache.parser_cache[self.path].parser
             cache.invalidate_star_import_cache(parser.module)
         # Call the parser already here, because it will be used anyways.
         # Also, the position is here important (which will not be used by
         # default), therefore fill the cache here.
         self._parser = fast_parser.FastParser(self.source, self.path,
                                               self.position)
         # don't pickle that module, because it's changing fast
         cache.save_module(self.path,
                           self.name,
                           self._parser,
                           pickling=False)
     return self._parser
Example #5
0
    def _get_module_node(self):
        cache.invalidate_star_import_cache(self._path)
        parser = FastParser(self._grammar, self._source, self.path)
        save_parser(self.path, parser, pickling=False)

        return parser.module