2016-10-08 48 views

回答

0

简短的回答:动态地创建 分散和布局的对象。因此pycharm找不到它的定义。

详情:

这是第一次在您的PY文件;

from plotly.graph_objs import Scatter, Layout 

之后,它调用plotly/graph_objs/__ init__.py文件;

from plotly.graph_objs.graph_objs import * # this is protected with __all__ 

__all__ = list(graph_reference.CLASSES.keys()) 

这个界定及后在plotly/graph_objs/graph_objs.py文件。 __all__是该模块的公共对象列表。

https://docs.python.org/2/tutorial/modules.html#importing-from-a-package

plotly/graph_referance.py类认定中;

CLASSES = _get_classes() 

在这个函数它itarates命名变量_BACKWARDS_COMPAT_CLASS_NAMES和创建类;

_BACKWARDS_COMPAT_CLASS_NAMES = { 
    ... 
    'Scatter': {'object_name': 'scatter', 'base_type': dict}, 
    ... 
    'Layout': {'object_name': 'layout', 'base_type': dict}, 
    ... 
} 
+0

那么有没有办法让PyCharm不要将其标记为警告? – FuriousGeorge

+0

我在Pycharm 2016.2.3中试用它,问题不会继续。我认为它可以在当前版本中修复。 – umut