小编A.V*_*non的帖子

如何避免使用自动摘要和自定义模板继承的成员?

我使用sphinx.ext.autosummary生成了python文档。autodoc和autosummary在conf.py中配置如下:

autodoc_member_order = 'bysource'
## Default flags used by autodoc directives
autodoc_default_flags = ['members','undoc-members']
## Generate autodoc stubs with summaries from code
autosummary_generate = True
Run Code Online (Sandbox Code Playgroud)

我使用模板:

myModuleName
=======

.. autosummary::
   :toctree: _autosummary
   :template: modules.rst

   myModule
Run Code Online (Sandbox Code Playgroud)

模块模板为:

{{ fullname }}
{{ underline }}

.. automodule:: {{ fullname }}

   {% block functions %}
   {% if functions %}
   .. rubric:: Functions

   .. autosummary::
      :toctree: {{ objname }}
   {% for item in functions %}
      {{ item }}
   {%- endfor %}
   {% endif %}
   {% …
Run Code Online (Sandbox Code Playgroud)

python python-3.x python-sphinx

5
推荐指数
1
解决办法
514
查看次数

在 jupyter notebook 中使用 plotly 时验证失败

当我用绘图保存 jupyter 笔记本时,出现以下错误:

[E 13:42:38.458 NotebookApp] Notebook JSON is invalid: {'data': [{'type': 'scatter', 'y': [1, 2, 3]}], 'layout': {}} is not valid under any of the given schemas

Failed validating 'oneOf' in schema['properties']['data']['patternProperties']['^(?!application/json$)[a-zA-Z0-9]+/[a-zA-Z0-9\\-\\+\\.]+$']:
    {'oneOf': [{'type': 'string'},
               {'items': {'type': 'string'}, 'type': 'array'}]}

On instance['data']['application/vnd.plotly.v1+json']:
    {'data': [{'type': 'scatter', 'y': [1, 2, 3]}], 'layout': {}}
Run Code Online (Sandbox Code Playgroud)

我在笔记本中的代码是:

import plotly.offline as py
import plotly.graph_objs as go
py.init_notebook_mode(connected=True)
data = [go.Scatter(y=[1,2,3])]
py.iplot(data)
Run Code Online (Sandbox Code Playgroud)

遵循jupyter 笔记本中的情节图:保存时验证失败,我更新了 nbformat 但仍然无法正常工作(我检查import nbformat nbformat__version__了更新是否有效)

python plotly jupyter-notebook

5
推荐指数
1
解决办法
1490
查看次数