mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-28 16:06:50 +08:00
Raise a proper exception instead of assert in case only_stubs and prefer_stubs are given
This commit is contained in:
@@ -369,7 +369,6 @@ class BaseDefinition(object):
|
|||||||
return self.goto(**kwargs)
|
return self.goto(**kwargs)
|
||||||
|
|
||||||
def _goto(self, only_stubs=False, prefer_stubs=False):
|
def _goto(self, only_stubs=False, prefer_stubs=False):
|
||||||
assert not (only_stubs and prefer_stubs)
|
|
||||||
|
|
||||||
if not self._name.is_value_name:
|
if not self._name.is_value_name:
|
||||||
return []
|
return []
|
||||||
|
|||||||
@@ -130,7 +130,9 @@ def _python_to_stub_names(names, fallback_to_python=False):
|
|||||||
|
|
||||||
|
|
||||||
def convert_names(names, only_stubs=False, prefer_stubs=False, prefer_stub_to_compiled=True):
|
def convert_names(names, only_stubs=False, prefer_stubs=False, prefer_stub_to_compiled=True):
|
||||||
assert not (only_stubs and prefer_stubs)
|
if only_stubs and prefer_stubs:
|
||||||
|
raise ValueError("You cannot use both of only_stubs and prefer_stubs.")
|
||||||
|
|
||||||
with debug.increase_indent_cm('convert names'):
|
with debug.increase_indent_cm('convert names'):
|
||||||
if only_stubs or prefer_stubs:
|
if only_stubs or prefer_stubs:
|
||||||
return _python_to_stub_names(names, fallback_to_python=prefer_stubs)
|
return _python_to_stub_names(names, fallback_to_python=prefer_stubs)
|
||||||
|
|||||||
Reference in New Issue
Block a user