Skip to content

Commit

Permalink
nwb_generate_format_docs: Support generating complete documentation
Browse files Browse the repository at this point in the history
This commit fixes the error reported below and ensure the complete
schema documentation including both the core and the extension schema
is generated.

```
Traceback (most recent call last):
  File "/home/jcfr/Projects/pynwb/src/pynwb/form/spec/namespace.py", line 379, in load_namespaces
    inc_ns = self.get_namespace(s['namespace'])
  File "/home/jcfr/Projects/pynwb/src/pynwb/form/utils.py", line 348, in func_call
    return func(self, **parsed['args'])
  File "/home/jcfr/Projects/pynwb/src/pynwb/form/spec/namespace.py", line 240, in get_namespace
    raise KeyError("'%s' not a namespace" % name)
KeyError: "'core' not a namespace"
```

See #3

Co-authored-by: Andrew Tritt <[email protected]>
  • Loading branch information
jcfr and ajtritt committed Apr 7, 2018
1 parent f29296f commit 7a7d598
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions nwb_docutils/generate_format_docs.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
# Python 2/3 compatibility
from __future__ import print_function

import pynwb

from pynwb.form.spec.spec import GroupSpec, DatasetSpec, LinkSpec, AttributeSpec, RefSpec
from pynwb.spec import NWBGroupSpec, NWBDatasetSpec, NWBNamespace
from pynwb.form.spec.namespace import NamespaceCatalog
Expand Down Expand Up @@ -81,11 +83,17 @@ def load_nwb_namespace(namespace_file, default_namespace='core', resolve=spec_re
Load an nwb namespace from file
:return:
"""
namespace = NamespaceCatalog(default_namespace,
group_spec_cls=NWBGroupSpec,
dataset_spec_cls=NWBDatasetSpec,
spec_namespace_cls=NWBNamespace)
namespace.load_namespaces(namespace_file, resolve=resolve)
# namespace = NamespaceCatalog(default_namespace,
# group_spec_cls=NWBGroupSpec,
# dataset_spec_cls=NWBDatasetSpec,
# spec_namespace_cls=NWBNamespace)
# namespace.load_namespaces(namespace_file, resolve=resolve)

# XXX
type_map = pynwb.get_type_map()
type_map.load_namespaces(namespace_file)
namespace = type_map.namespace_catalog

default_spec_catalog = namespace.get_namespace(default_namespace).catalog # TODO check if this should be 'core' or default_namespace?
return namespace, default_spec_catalog

Expand Down

0 comments on commit 7a7d598

Please sign in to comment.