1
我有下面的代碼片段,即pylint的無法處理:pylint的在astriod包無限遞歸
from celery import Celery
def create_celery(application):
"""
Configures celery instance from application, using it's config
:param application: Flask application instance
:return: Celery instance
"""
celery = Celery(application.import_name)
celery.conf.update(application.config)
TaskBase = celery.Task
class ContextTask(TaskBase):
abstract = True
def __call__(self, *args, **kwargs):
with application.app_context():
return TaskBase.__call__(self, *args, **kwargs)
celery.Task = ContextTask
return celery
我獲得以下錯誤:
File "/usr/local/lib/python3.4/dist-packages/astroid/context.py", line 49, in cache_generator
for result in generator:
File "/usr/local/lib/python3.4/dist-packages/astroid/bases.py", line 302, in wrapped
for res in _func(node, context, **kwargs):
File "/usr/local/lib/python3.4/dist-packages/astroid/bases.py", line 325, in raise_if_nothing_inferred
for node in func(*args, **kwargs):
File "/usr/local/lib/python3.4/dist-packages/astroid/inference.py", line 156, in infer_attribute
for owner in self.expr.infer(context):
File "/usr/local/lib/python3.4/dist-packages/astroid/context.py", line 49, in cache_generator
for result in generator:
File "/usr/local/lib/python3.4/dist-packages/astroid/bases.py", line 302, in wrapped
for res in _func(node, context, **kwargs):
File "/usr/local/lib/python3.4/dist-packages/astroid/bases.py", line 99, in _infer_stmts
for inferred in stmt.infer(context=context):
File "/usr/local/lib/python3.4/dist-packages/astroid/context.py", line 49, in cache_generator
for result in generator:
File "/usr/local/lib/python3.4/dist-packages/astroid/bases.py", line 302, in wrapped
for res in _func(node, context, **kwargs):
File "/usr/local/lib/python3.4/dist-packages/astroid/bases.py", line 99, in _infer_stmts
for inferred in stmt.infer(context=context):
File "/usr/local/lib/python3.4/dist-packages/astroid/context.py", line 49, in cache_generator
for result in generator:
File "/usr/local/lib/python3.4/dist-packages/astroid/bases.py", line 302, in wrapped
for res in _func(node, context, **kwargs):
File "/usr/local/lib/python3.4/dist-packages/astroid/bases.py", line 325, in raise_if_nothing_inferred
for node in func(*args, **kwargs):
File "/usr/local/lib/python3.4/dist-packages/astroid/inference.py", line 100, in infer_call
for callee in self.func.infer(context):
File "/usr/local/lib/python3.4/dist-packages/astroid/context.py", line 49, in cache_generator
for result in generator:
File "/usr/local/lib/python3.4/dist-packages/astroid/bases.py", line 302, in wrapped
for res in _func(node, context, **kwargs):
File "/usr/local/lib/python3.4/dist-packages/astroid/bases.py", line 99, in _infer_stmts
for inferred in stmt.infer(context=context):
File "/usr/local/lib/python3.4/dist-packages/astroid/context.py", line 49, in cache_generator
for result in generator:
File "/usr/local/lib/python3.4/dist-packages/astroid/bases.py", line 302, in wrapped
for res in _func(node, context, **kwargs):
File "/usr/local/lib/python3.4/dist-packages/astroid/bases.py", line 99, in _infer_stmts
for inferred in stmt.infer(context=context):
File "/usr/local/lib/python3.4/dist-packages/astroid/context.py", line 49, in cache_generator
for result in generator:
File "/usr/local/lib/python3.4/dist-packages/astroid/bases.py", line 302, in wrapped
for res in _func(node, context, **kwargs):
File "/usr/local/lib/python3.4/dist-packages/astroid/inference.py", line 144, in infer_import_from
context = contextmod.copy_context(context)
File "/usr/local/lib/python3.4/dist-packages/astroid/context.py", line 79, in copy_context
return context.clone()
File "/usr/local/lib/python3.4/dist-packages/astroid/context.py", line 42, in clone
clone = InferenceContext(self.path, inferred=self.inferred)
RuntimeError: maximum recursion depth exceeded
我用最新的1.5.5 pylint的和Python 3.4
我試着聯繫logilab問題追蹤器,但似乎他們有一個破損的登錄功能。
我發現這是一個解決方案,使用該文件的--ignore選項,但它並沒有解決問題