pyodide / pyodide/sphinx-js

Exception occurred: line 174, in _formal_params KeyError: 'name'

Open
#129 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
290
Forks
80
PR merge metrics
No merged PRs in 30d

Description

Hello, I'm getting this error when trying to do the following:

Cryptosee
========

Attribute Encryption
--------------------

.. js:autofunction:: encrypt

I've been able to generate documentation before and this is how the function is commented:

/**
 * Function that creates a symmetric key, encapsulates it and uses it to encrypt a ciphertext
 *
 * @param inPK {pem hexString} - PEM Hexadecimal representation of the receipient's public key
 * @param inPlaintext {String} - String of the data we want to safeguard
 * @param inAuthenticatedData {} -
 * @returns {}
 *
 */
const encrypt = (inPK, inPlaintext, inAuthenticatedData) => { ... }

# Sphinx version: 1.8.5
# Python version: 2.7.0 (CPython)
# Docutils version: 0.15.2 release
# Jinja2 version: 2.10.3
# Last messages:
#   loading pickled environment...
#   done
#   building [mo]: targets for 0 po files that are out of date
#   building [html]: targets for 1 source files that are out of date
#   updating environment:
#   []
#   0 added, 1 changed, 0 removed
#   reading sources... [ 14%] index
#   reading sources... [ 28%] front-end/file1
#   reading sources... [ 42%] front-end/file2
# Loaded extensions:
#   sphinx.ext.mathjax (1.8.5) from /Users/username/.pyenv/versions/2.7.0/lib/python2.7/site-packages/sphinx/ext/mathjax.pyc
#   sphinx.ext.coverage (1.8.5) from /Users/username/.pyenv/versions/2.7.0/lib/python2.7/site-packages/sphinx/ext/coverage.pyc
#   alabaster (0.7.12) from /Users/username/.pyenv/versions/2.7.0/lib/python2.7/site-packages/alabaster/__init__.pyc
#   sphinx.ext.githubpages (1.8.5) from /Users/username/.pyenv/versions/2.7.0/lib/python2.7/site-packages/sphinx/ext/githubpages.pyc
#   sphinx_js (unknown version) from /Users/username/.pyenv/versions/2.7.0/lib/python2.7/site-packages/sphinx_js/__init__.pyc
Traceback (most recent call last):
  File "/Users/username/.pyenv/versions/2.7.0/lib/python2.7/site-packages/sphinx/cmd/build.py", line 304, in build_main
    app.build(args.force_all, filenames)
  File "/Users/username/.pyenv/versions/2.7.0/lib/python2.7/site-packages/sphinx/application.py", line 341, in build
    self.builder.build_update()
  File "/Users/username/.pyenv/versions/2.7.0/lib/python2.7/site-packages/sphinx/builders/__init__.py", line 347, in build_update
    len(to_build))
  File "/Users/username/.pyenv/versions/2.7.0/lib/python2.7/site-packages/sphinx/builders/__init__.py", line 360, in build
    updated_docnames = set(self.read())
  File "/Users/username/.pyenv/versions/2.7.0/lib/python2.7/site-packages/sphinx/builders/__init__.py", line 468, in read
    self._read_serial(docnames)
  File "/Users/username/.pyenv/versions/2.7.0/lib/python2.7/site-packages/sphinx/builders/__init__.py", line 490, in _read_serial
    self.read_doc(docname)
  File "/Users/username/.pyenv/versions/2.7.0/lib/python2.7/site-packages/sphinx/builders/__init__.py", line 534, in read_doc
    doctree = read_doc(self.app, self.env, self.env.doc2path(docname))
  File "/Users/username/.pyenv/versions/2.7.0/lib/python2.7/site-packages/sphinx/io.py", line 318, in read_doc
    pub.publish()
  File "/Users/username/.pyenv/versions/2.7.0/lib/python2.7/site-packages/docutils/core.py", line 217, in publish
    self.settings)
  File "/Users/username/.pyenv/versions/2.7.0/lib/python2.7/site-packages/docutils/readers/__init__.py", line 71, in read
    self.parse()
  File "/Users/username/.pyenv/versions/2.7.0/lib/python2.7/site-packages/docutils/readers/__init__.py", line 77, in parse
    self.parser.parse(self.input, document)
  File "/Users/username/.pyenv/versions/2.7.0/lib/python2.7/site-packages/sphinx/parsers.py", line 88, in parse
    self.statemachine.run(inputstring, document, inliner=self.inliner)
  File "/Users/username/.pyenv/versions/2.7.0/lib/python2.7/site-packages/docutils/parsers/rst/states.py", line 171, in run
    input_source=document['source'])
  File "/Users/username/.pyenv/versions/2.7.0/lib/python2.7/site-packages/docutils/statemachine.py", line 239, in run
    context, state, transitions)
  File "/Users/username/.pyenv/versions/2.7.0/lib/python2.7/site-packages/docutils/statemachine.py", line 460, in check_line
    return method(match, context, next_state)
  File "/Users/username/.pyenv/versions/2.7.0/lib/python2.7/site-packages/docutils/parsers/rst/states.py", line 2771, in underline
    self.section(title, source, style, lineno - 1, messages)
  File "/Users/username/.pyenv/versions/2.7.0/lib/python2.7/site-packages/docutils/parsers/rst/states.py", line 327, in section
    self.new_subsection(title, lineno, messages)
  File "/Users/username/.pyenv/versions/2.7.0/lib/python2.7/site-packages/docutils/parsers/rst/states.py", line 395, in new_subsection
    node=section_node, match_titles=True)
  File "/Users/username/.pyenv/versions/2.7.0/lib/python2.7/site-packages/docutils/parsers/rst/states.py", line 282, in nested_parse
    node=node, match_titles=match_titles)
  File "/Users/username/.pyenv/versions/2.7.0/lib/python2.7/site-packages/docutils/parsers/rst/states.py", line 196, in run
    results = StateMachineWS.run(self, input_lines, input_offset)
  File "/Users/username/.pyenv/versions/2.7.0/lib/python2.7/site-packages/docutils/statemachine.py", line 239, in run
    context, state, transitions)
  File "/Users/username/.pyenv/versions/2.7.0/lib/python2.7/site-packages/docutils/statemachine.py", line 460, in check_line
    return method(match, context, next_state)
  File "/Users/username/.pyenv/versions/2.7.0/lib/python2.7/site-packages/docutils/parsers/rst/states.py", line 2771, in underline
    self.section(title, source, style, lineno - 1, messages)
  File "/Users/username/.pyenv/versions/2.7.0/lib/python2.7/site-packages/docutils/parsers/rst/states.py", line 327, in section
    self.new_subsection(title, lineno, messages)
  File "/Users/username/.pyenv/versions/2.7.0/lib/python2.7/site-packages/docutils/parsers/rst/states.py", line 395, in new_subsection
    node=section_node, match_titles=True)
  File "/Users/username/.pyenv/versions/2.7.0/lib/python2.7/site-packages/docutils/parsers/rst/states.py", line 282, in nested_parse
    node=node, match_titles=match_titles)
  File "/Users/username/.pyenv/versions/2.7.0/lib/python2.7/site-packages/docutils/parsers/rst/states.py", line 196, in run
    results = StateMachineWS.run(self, input_lines, input_offset)
  File "/Users/username/.pyenv/versions/2.7.0/lib/python2.7/site-packages/docutils/statemachine.py", line 239, in run
    context, state, transitions)
  File "/Users/username/.pyenv/versions/2.7.0/lib/python2.7/site-packages/docutils/statemachine.py", line 460, in check_line
    return method(match, context, next_state)
  File "/Users/username/.pyenv/versions/2.7.0/lib/python2.7/site-packages/docutils/parsers/rst/states.py", line 2344, in explicit_markup
    nodelist, blank_finish = self.explicit_construct(match)
  File "/Users/username/.pyenv/versions/2.7.0/lib/python2.7/site-packages/docutils/parsers/rst/states.py", line 2356, in explicit_construct
    return method(self, expmatch)
  File "/Users/username/.pyenv/versions/2.7.0/lib/python2.7/site-packages/docutils/parsers/rst/states.py", line 2099, in directive
    directive_class, match, type_name, option_presets)
  File "/Users/username/.pyenv/versions/2.7.0/lib/python2.7/site-packages/docutils/parsers/rst/states.py", line 2148, in run_directive
    result = directive_instance.run()
  File "/Users/username/.pyenv/versions/2.7.0/lib/python2.7/site-packages/sphinx/domains/__init__.py", line 239, in run
    return BaseDirective.run(self)
  File "/Users/username/.pyenv/versions/2.7.0/lib/python2.7/site-packages/sphinx_js/directives.py", line 38, in run
    return AutoFunctionRenderer.from_directive(self, app).rst_nodes()
  File "/Users/username/.pyenv/versions/2.7.0/lib/python2.7/site-packages/sphinx_js/renderers.py", line 80, in rst_nodes
    use_short_name='short-name' in self._options)
  File "/Users/username/.pyenv/versions/2.7.0/lib/python2.7/site-packages/sphinx_js/renderers.py", line 103, in rst
    return template.render(**self._template_vars(dotted_name, full_path, doclet))
  File "/Users/username/.pyenv/versions/2.7.0/lib/python2.7/site-packages/sphinx_js/renderers.py", line 222, in _template_vars
    params=self._formal_params(doclet),
  File "/Users/username/.pyenv/versions/2.7.0/lib/python2.7/site-packages/sphinx_js/renderers.py", line 174, in _formal_params
    name = param['name'].split('.')[0]
KeyError: 'name'

Thank you for your help in advance!

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with sphinx_js/renderers.py at _formal_params, line 174, and reproduce the Sphinx build using the JavaScript encrypt example and its @param annotations. Inspect the doclet passed to AutoFunctionRenderer for the missing field; done means the documented function builds without the reported KeyError and the resulting parameters remain represented correctly.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, python
Domain
documentation
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.