]> crepu.dev Git - config.git/blob - djavu-asus/elpy/rpc-venv/lib/python3.11/site-packages/jedi/api/completion_cache.py
Archivo de configuraciĆ³n de la terminal
[config.git] / djavu-asus / elpy / rpc-venv / lib / python3.11 / site-packages / jedi / api / completion_cache.py
1 from typing import Dict, Tuple, Callable
2
3 CacheValues = Tuple[str, str, str]
4 CacheValuesCallback = Callable[[], CacheValues]
5
6
7 _cache: Dict[str, Dict[str, CacheValues]] = {}
8
9
10 def save_entry(module_name: str, name: str, cache: CacheValues) -> None:
11 try:
12 module_cache = _cache[module_name]
13 except KeyError:
14 module_cache = _cache[module_name] = {}
15 module_cache[name] = cache
16
17
18 def _create_get_from_cache(number: int) -> Callable[[str, str, CacheValuesCallback], str]:
19 def _get_from_cache(module_name: str, name: str, get_cache_values: CacheValuesCallback) -> str:
20 try:
21 return _cache[module_name][name][number]
22 except KeyError:
23 v = get_cache_values()
24 save_entry(module_name, name, v)
25 return v[number]
26 return _get_from_cache
27
28
29 get_type = _create_get_from_cache(0)
30 get_docstring_signature = _create_get_from_cache(1)
31 get_docstring = _create_get_from_cache(2)