1
0
forked from VimPlug/jedi

Annotate these attributes

This commit is contained in:
Peter Law
2020-07-24 15:08:44 +01:00
parent 7d9205d4ae
commit b1f95b4bf9
3 changed files with 8 additions and 6 deletions

View File

@@ -3,7 +3,7 @@ Filters are objects that you can use to filter names in different scopes. They
are needed for name resolution.
"""
from abc import abstractmethod
from typing import List, MutableMapping
from typing import List, Optional, MutableMapping, Type
import weakref
from parso.tree import search_ancestor
@@ -15,7 +15,7 @@ from jedi.inference.base_value import ValueSet, ValueWrapper, \
from jedi.parser_utils import get_cached_parent_scope
from jedi.inference.utils import to_list
from jedi.inference.names import TreeNameDefinition, ParamName, \
AnonymousParamName, AbstractNameDefinition
AnonymousParamName, AbstractNameDefinition, NameWrapper
_definition_name_cache: MutableMapping[UsedNamesMapping, List[Name]]
_definition_name_cache = weakref.WeakKeyDictionary()
@@ -39,7 +39,7 @@ class AbstractFilter(object):
class FilterWrapper(object):
name_wrapper_class = None
name_wrapper_class: Optional[Type[NameWrapper]] = None
def __init__(self, wrapped_filter):
self._wrapped_filter = wrapped_filter

View File

@@ -1,5 +1,6 @@
from abc import abstractmethod
from inspect import Parameter
from typing import Optional, Tuple
from parso.tree import search_ancestor
@@ -24,8 +25,8 @@ def _merge_name_docs(names):
class AbstractNameDefinition(object):
start_pos = None
string_name = None
start_pos: Optional[Tuple[int, int]] = None
string_name: Optional[str] = None
parent_context = None
tree_name = None
is_value_name = True

View File

@@ -1,5 +1,6 @@
import os
from pathlib import Path
from typing import Optional
from jedi.inference.cache import inference_state_method_cache
from jedi.inference.names import AbstractNameDefinition, ModuleName
@@ -145,7 +146,7 @@ class ModuleValue(ModuleMixin, TreeValue):
)
self.file_io = file_io
if file_io is None:
self._path = None
self._path: Optional[Path] = None
else:
self._path = Path(file_io.path)
self.string_names = string_names # Optional[Tuple[str, ...]]