Skip to content
This repository has been archived by the owner on Jan 8, 2025. It is now read-only.

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

Open
afrancht opened this issue Jan 14, 2020 · 2 comments
Open

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

afrancht opened this issue Jan 14, 2020 · 2 comments

Comments

@afrancht
Copy link

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!

@erikrose
Copy link
Contributor

Confirmed. (For my own notes:) I can repro it by pasting your function into Fathom, sticking the autofunction call anywhere in my docs, and running make doc.

@erikrose
Copy link
Contributor

Still true as of 3.1.

hoodmane added a commit to hoodmane/sphinx-js that referenced this issue May 2, 2024
We take the inner reflection type and use it as our property reflection. The
reflection type has name `__type` and so do its signatures. We renamed the
reflection type to the name of the property but missed the signatures. This
meant that these properties got rendered as `__type`.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants