forked from VimPlug/jedi
unsafe -> not safe
This commit is contained in:
@@ -306,9 +306,9 @@ class DirectObjectAccess:
|
|||||||
except TypeError:
|
except TypeError:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def is_allowed_getattr(self, name, unsafe=False):
|
def is_allowed_getattr(self, name, safe=True):
|
||||||
# TODO this API is ugly.
|
# TODO this API is ugly.
|
||||||
if unsafe:
|
if not safe:
|
||||||
# Unsafe is mostly used to check for __getattr__/__getattribute__.
|
# Unsafe is mostly used to check for __getattr__/__getattribute__.
|
||||||
# getattr_static works for properties, but the underscore methods
|
# getattr_static works for properties, but the underscore methods
|
||||||
# are just ignored (because it's safer and avoids more code
|
# are just ignored (because it's safer and avoids more code
|
||||||
|
|||||||
@@ -440,7 +440,7 @@ class CompiledValueFilter(AbstractFilter):
|
|||||||
access_handle = self.compiled_value.access_handle
|
access_handle = self.compiled_value.access_handle
|
||||||
return self._get(
|
return self._get(
|
||||||
name,
|
name,
|
||||||
lambda name, unsafe: access_handle.is_allowed_getattr(name, unsafe),
|
lambda name, safe: access_handle.is_allowed_getattr(name, safe=safe),
|
||||||
lambda name: name in access_handle.dir(),
|
lambda name: name in access_handle.dir(),
|
||||||
check_has_attribute=True
|
check_has_attribute=True
|
||||||
)
|
)
|
||||||
@@ -454,7 +454,7 @@ class CompiledValueFilter(AbstractFilter):
|
|||||||
|
|
||||||
has_attribute, is_descriptor = allowed_getattr_callback(
|
has_attribute, is_descriptor = allowed_getattr_callback(
|
||||||
name,
|
name,
|
||||||
unsafe=self._inference_state.allow_descriptor_getattr
|
safe=not self._inference_state.allow_descriptor_getattr
|
||||||
)
|
)
|
||||||
if check_has_attribute and not has_attribute:
|
if check_has_attribute and not has_attribute:
|
||||||
return []
|
return []
|
||||||
@@ -478,7 +478,7 @@ class CompiledValueFilter(AbstractFilter):
|
|||||||
from jedi.inference.compiled import builtin_from_name
|
from jedi.inference.compiled import builtin_from_name
|
||||||
names = []
|
names = []
|
||||||
needs_type_completions, dir_infos = self.compiled_value.access_handle.get_dir_infos()
|
needs_type_completions, dir_infos = self.compiled_value.access_handle.get_dir_infos()
|
||||||
# We could use `unsafe` here as well, especially as a parameter to
|
# We could use `safe=False` here as well, especially as a parameter to
|
||||||
# get_dir_infos. But this would lead to a lot of property executions
|
# get_dir_infos. But this would lead to a lot of property executions
|
||||||
# that are probably not wanted. The drawback for this is that we
|
# that are probably not wanted. The drawback for this is that we
|
||||||
# have a different name for `get` and `values`. For `get` we always
|
# have a different name for `get` and `values`. For `get` we always
|
||||||
@@ -486,7 +486,7 @@ class CompiledValueFilter(AbstractFilter):
|
|||||||
for name in dir_infos:
|
for name in dir_infos:
|
||||||
names += self._get(
|
names += self._get(
|
||||||
name,
|
name,
|
||||||
lambda name, unsafe: dir_infos[name],
|
lambda name, safe: dir_infos[name],
|
||||||
lambda name: name in dir_infos,
|
lambda name: name in dir_infos,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user