forked from VimPlug/jedi
temporary interfaces subclass. let's see if we need to keep it
This commit is contained in:
3
jedi/evaluate/interfaces.py
Normal file
3
jedi/evaluate/interfaces.py
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
class Iterable():
|
||||||
|
"""Parent class of Generator and Array, exists due to import restrictions."""
|
||||||
|
pass
|
||||||
@@ -11,6 +11,7 @@ from jedi.parser import representation as pr
|
|||||||
from jedi import debug
|
from jedi import debug
|
||||||
from jedi import settings
|
from jedi import settings
|
||||||
from jedi.evaluate import builtin
|
from jedi.evaluate import builtin
|
||||||
|
from jedi.evaluate import interfaces
|
||||||
|
|
||||||
|
|
||||||
class RecursionDecorator(object):
|
class RecursionDecorator(object):
|
||||||
@@ -131,7 +132,7 @@ class ExecutionRecursionDecorator(object):
|
|||||||
if cls.execution_count > settings.max_executions:
|
if cls.execution_count > settings.max_executions:
|
||||||
return True
|
return True
|
||||||
|
|
||||||
if isinstance(execution.base, (er.Generator, er.Array)):
|
if isinstance(execution.base, interfaces.Iterable):
|
||||||
return False
|
return False
|
||||||
module = execution.get_parent_until()
|
module = execution.get_parent_until()
|
||||||
if evaluate_generator or module == builtin.Builtin.scope:
|
if evaluate_generator or module == builtin.Builtin.scope:
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ from jedi.evaluate import builtin
|
|||||||
from jedi.evaluate import recursion
|
from jedi.evaluate import recursion
|
||||||
from jedi import docstrings
|
from jedi import docstrings
|
||||||
from jedi import dynamic
|
from jedi import dynamic
|
||||||
|
from jedi.evaluate.interfaces import Iterable
|
||||||
|
|
||||||
|
|
||||||
class Executable(pr.IsScope):
|
class Executable(pr.IsScope):
|
||||||
@@ -778,7 +779,7 @@ class Execution(Executable):
|
|||||||
(type(self).__name__, self._decorated)
|
(type(self).__name__, self._decorated)
|
||||||
|
|
||||||
|
|
||||||
class Generator(use_metaclass(cache.CachedMetaClass, pr.Base)):
|
class Generator(use_metaclass(cache.CachedMetaClass, pr.Base, Iterable)):
|
||||||
""" Cares for `yield` statements. """
|
""" Cares for `yield` statements. """
|
||||||
def __init__(self, func, var_args):
|
def __init__(self, func, var_args):
|
||||||
super(Generator, self).__init__()
|
super(Generator, self).__init__()
|
||||||
@@ -824,7 +825,7 @@ class Generator(use_metaclass(cache.CachedMetaClass, pr.Base)):
|
|||||||
return "<%s of %s>" % (type(self).__name__, self.func)
|
return "<%s of %s>" % (type(self).__name__, self.func)
|
||||||
|
|
||||||
|
|
||||||
class Array(use_metaclass(cache.CachedMetaClass, pr.Base)):
|
class Array(use_metaclass(cache.CachedMetaClass, pr.Base, Iterable)):
|
||||||
"""
|
"""
|
||||||
Used as a mirror to pr.Array, if needed. It defines some getter
|
Used as a mirror to pr.Array, if needed. It defines some getter
|
||||||
methods which are important in this module.
|
methods which are important in this module.
|
||||||
|
|||||||
Reference in New Issue
Block a user