Merge branch 'master' of github.com:rtfd/sphinx-autoapi

pull/14/head
Eric Holscher 9 years ago
commit 1eb7f4c6fa

@ -120,15 +120,6 @@ class SphinxMapperBase(object):
'''
# Mapping of {filepath -> raw data}
paths = OrderedDict()
# Mapping of {object id -> Python Object}
objects = OrderedDict()
# Mapping of {namespace id -> Python Object}
namespaces = OrderedDict()
# Mapping of {namespace id -> Python Object}
top_level_objects = OrderedDict()
def __init__(self, app, template_dir=None):
self.app = app
@ -145,6 +136,15 @@ class SphinxMapperBase(object):
# lstrip_blocks=True,
)
# Mapping of {filepath -> raw data}
self.paths = OrderedDict()
# Mapping of {object id -> Python Object}
self.objects = OrderedDict()
# Mapping of {namespace id -> Python Object}
self.namespaces = OrderedDict()
# Mapping of {namespace id -> Python Object}
self.top_level_objects = OrderedDict()
def load(self, pattern, dir, ignore=[]):
'''
Load objects from the filesystem into the ``paths`` dictionary.

@ -3,3 +3,5 @@ epyparse==0.2.5
PyYAML==3.11
wheel==0.24.0
sphinx==1.3.1
sphinxcontrib-golangdomain
sphinxcontrib-dotnetdomain

@ -7,6 +7,8 @@ try:
'epyparse',
'epydoc',
'sphinx',
'sphinxcontrib-golangdomain',
'sphinxcontrib-dotnetdomain',
],
test_suite='nose.collector',
tests_require=['nose', 'mock'],
@ -19,6 +21,8 @@ except ImportError:
'epyparse',
'epydoc',
'sphinx'
'sphinxcontrib-golangdomain',
'sphinxcontrib-dotnetdomain',
],
)

@ -0,0 +1,322 @@
{
"items": [
{
"uid": "Microsoft.AspNet.JsonPatch.Adapters.IObjectAdapter`1",
"parent": "Microsoft.AspNet.JsonPatch.Adapters",
"fullName.vb": "Microsoft.AspNet.JsonPatch.Adapters.IObjectAdapter(Of TModel)",
"assemblies": [
"Microsoft.AspNet.JsonPatch"
],
"namespace": "Microsoft.AspNet.JsonPatch.Adapters",
"summary": "Defines the operations that can be performed on a JSON patch document.",
"source": {
"path": "src/Microsoft.AspNet.JsonPatch/Adapters/IObjectAdapter.cs",
"startLine": 11,
"remote": {
"repo": "https://github.com/aspnet/mvc",
"path": "src/Microsoft.AspNet.JsonPatch/Adapters/IObjectAdapter.cs",
"branch": "dev",
"key": "faaba481"
}
},
"href": "Microsoft.AspNet.JsonPatch.Adapters.IObjectAdapter`1.yml",
"name.vb": "IObjectAdapter(Of TModel)",
"id": "IObjectAdapter`1",
"fullName": "Microsoft.AspNet.JsonPatch.Adapters.IObjectAdapter<TModel>",
"syntax": {
"content": {
"VB": "Public Interface IObjectAdapter(Of TModel As Class)",
"CSharp": "public interface IObjectAdapter<TModel> where TModel : class"
},
"typeParameters": [
{
"id": "TModel",
"description": "The type of the model."
}
]
},
"type": "Interface",
"children": [
"Microsoft.AspNet.JsonPatch.Adapters.IObjectAdapter`1.Add(Microsoft.AspNet.JsonPatch.Operations.Operation{`0},`0)",
"Microsoft.AspNet.JsonPatch.Adapters.IObjectAdapter`1.Copy(Microsoft.AspNet.JsonPatch.Operations.Operation{`0},`0)",
"Microsoft.AspNet.JsonPatch.Adapters.IObjectAdapter`1.Move(Microsoft.AspNet.JsonPatch.Operations.Operation{`0},`0)",
"Microsoft.AspNet.JsonPatch.Adapters.IObjectAdapter`1.Remove(Microsoft.AspNet.JsonPatch.Operations.Operation{`0},`0)",
"Microsoft.AspNet.JsonPatch.Adapters.IObjectAdapter`1.Replace(Microsoft.AspNet.JsonPatch.Operations.Operation{`0},`0)"
],
"name": "IObjectAdapter<TModel>"
},
{
"uid": "Microsoft.AspNet.JsonPatch.Adapters.IObjectAdapter`1.Add(Microsoft.AspNet.JsonPatch.Operations.Operation{`0},`0)",
"parent": "Microsoft.AspNet.JsonPatch.Adapters.IObjectAdapter`1",
"fullName.vb": "Microsoft.AspNet.JsonPatch.Adapters.IObjectAdapter(Of TModel).Add(Microsoft.AspNet.JsonPatch.Operations.Operation(Of TModel), TModel)",
"assemblies": [
"Microsoft.AspNet.JsonPatch"
],
"namespace": "Microsoft.AspNet.JsonPatch.Adapters",
"syntax": {
"content": {
"VB": "Sub Add(operation As Operation(Of TModel), objectToApplyTo As TModel)",
"CSharp": "void Add(Operation<TModel> operation, TModel objectToApplyTo)"
},
"parameters": [
{
"type": "Microsoft.AspNet.JsonPatch.Operations.Operation{{TModel}}",
"id": "operation"
},
{
"type": "TModel",
"id": "objectToApplyTo"
}
]
},
"source": {
"path": "src/Microsoft.AspNet.JsonPatch/Adapters/IObjectAdapter.cs",
"startLine": 13,
"remote": {
"repo": "https://github.com/aspnet/mvc",
"path": "src/Microsoft.AspNet.JsonPatch/Adapters/IObjectAdapter.cs",
"branch": "dev",
"key": "faaba481"
}
},
"href": "Microsoft.AspNet.JsonPatch.Adapters.IObjectAdapter`1.yml",
"name.vb": "Add(Operation(Of TModel), TModel)",
"fullName": "Microsoft.AspNet.JsonPatch.Adapters.IObjectAdapter<TModel>.Add(Microsoft.AspNet.JsonPatch.Operations.Operation<TModel>, TModel)",
"type": "Method",
"id": "Add(Microsoft.AspNet.JsonPatch.Operations.Operation{`0},`0)",
"name": "Add(Operation<TModel>, TModel)"
},
{
"uid": "Microsoft.AspNet.JsonPatch.Adapters.IObjectAdapter`1.Copy(Microsoft.AspNet.JsonPatch.Operations.Operation{`0},`0)",
"parent": "Microsoft.AspNet.JsonPatch.Adapters.IObjectAdapter`1",
"fullName.vb": "Microsoft.AspNet.JsonPatch.Adapters.IObjectAdapter(Of TModel).Copy(Microsoft.AspNet.JsonPatch.Operations.Operation(Of TModel), TModel)",
"assemblies": [
"Microsoft.AspNet.JsonPatch"
],
"namespace": "Microsoft.AspNet.JsonPatch.Adapters",
"syntax": {
"content": {
"VB": "Sub Copy(operation As Operation(Of TModel), objectToApplyTo As TModel)",
"CSharp": "void Copy(Operation<TModel> operation, TModel objectToApplyTo)"
},
"parameters": [
{
"type": "Microsoft.AspNet.JsonPatch.Operations.Operation{{TModel}}",
"id": "operation"
},
{
"type": "TModel",
"id": "objectToApplyTo"
}
]
},
"source": {
"path": "src/Microsoft.AspNet.JsonPatch/Adapters/IObjectAdapter.cs",
"startLine": 14,
"remote": {
"repo": "https://github.com/aspnet/mvc",
"path": "src/Microsoft.AspNet.JsonPatch/Adapters/IObjectAdapter.cs",
"branch": "dev",
"key": "faaba481"
}
},
"href": "Microsoft.AspNet.JsonPatch.Adapters.IObjectAdapter`1.yml",
"name.vb": "Copy(Operation(Of TModel), TModel)",
"fullName": "Microsoft.AspNet.JsonPatch.Adapters.IObjectAdapter<TModel>.Copy(Microsoft.AspNet.JsonPatch.Operations.Operation<TModel>, TModel)",
"type": "Method",
"id": "Copy(Microsoft.AspNet.JsonPatch.Operations.Operation{`0},`0)",
"name": "Copy(Operation<TModel>, TModel)"
},
{
"uid": "Microsoft.AspNet.JsonPatch.Adapters.IObjectAdapter`1.Move(Microsoft.AspNet.JsonPatch.Operations.Operation{`0},`0)",
"parent": "Microsoft.AspNet.JsonPatch.Adapters.IObjectAdapter`1",
"fullName.vb": "Microsoft.AspNet.JsonPatch.Adapters.IObjectAdapter(Of TModel).Move(Microsoft.AspNet.JsonPatch.Operations.Operation(Of TModel), TModel)",
"assemblies": [
"Microsoft.AspNet.JsonPatch"
],
"namespace": "Microsoft.AspNet.JsonPatch.Adapters",
"syntax": {
"content": {
"VB": "Sub Move(operation As Operation(Of TModel), objectToApplyTo As TModel)",
"CSharp": "void Move(Operation<TModel> operation, TModel objectToApplyTo)"
},
"parameters": [
{
"type": "Microsoft.AspNet.JsonPatch.Operations.Operation{{TModel}}",
"id": "operation"
},
{
"type": "TModel",
"id": "objectToApplyTo"
}
]
},
"source": {
"path": "src/Microsoft.AspNet.JsonPatch/Adapters/IObjectAdapter.cs",
"startLine": 15,
"remote": {
"repo": "https://github.com/aspnet/mvc",
"path": "src/Microsoft.AspNet.JsonPatch/Adapters/IObjectAdapter.cs",
"branch": "dev",
"key": "faaba481"
}
},
"href": "Microsoft.AspNet.JsonPatch.Adapters.IObjectAdapter`1.yml",
"name.vb": "Move(Operation(Of TModel), TModel)",
"fullName": "Microsoft.AspNet.JsonPatch.Adapters.IObjectAdapter<TModel>.Move(Microsoft.AspNet.JsonPatch.Operations.Operation<TModel>, TModel)",
"type": "Method",
"id": "Move(Microsoft.AspNet.JsonPatch.Operations.Operation{`0},`0)",
"name": "Move(Operation<TModel>, TModel)"
},
{
"uid": "Microsoft.AspNet.JsonPatch.Adapters.IObjectAdapter`1.Remove(Microsoft.AspNet.JsonPatch.Operations.Operation{`0},`0)",
"parent": "Microsoft.AspNet.JsonPatch.Adapters.IObjectAdapter`1",
"fullName.vb": "Microsoft.AspNet.JsonPatch.Adapters.IObjectAdapter(Of TModel).Remove(Microsoft.AspNet.JsonPatch.Operations.Operation(Of TModel), TModel)",
"assemblies": [
"Microsoft.AspNet.JsonPatch"
],
"namespace": "Microsoft.AspNet.JsonPatch.Adapters",
"syntax": {
"content": {
"VB": "Sub Remove(operation As Operation(Of TModel), objectToApplyTo As TModel)",
"CSharp": "void Remove(Operation<TModel> operation, TModel objectToApplyTo)"
},
"parameters": [
{
"type": "Microsoft.AspNet.JsonPatch.Operations.Operation{{TModel}}",
"id": "operation"
},
{
"type": "TModel",
"id": "objectToApplyTo"
}
]
},
"source": {
"path": "src/Microsoft.AspNet.JsonPatch/Adapters/IObjectAdapter.cs",
"startLine": 16,
"remote": {
"repo": "https://github.com/aspnet/mvc",
"path": "src/Microsoft.AspNet.JsonPatch/Adapters/IObjectAdapter.cs",
"branch": "dev",
"key": "faaba481"
}
},
"href": "Microsoft.AspNet.JsonPatch.Adapters.IObjectAdapter`1.yml",
"name.vb": "Remove(Operation(Of TModel), TModel)",
"fullName": "Microsoft.AspNet.JsonPatch.Adapters.IObjectAdapter<TModel>.Remove(Microsoft.AspNet.JsonPatch.Operations.Operation<TModel>, TModel)",
"type": "Method",
"id": "Remove(Microsoft.AspNet.JsonPatch.Operations.Operation{`0},`0)",
"name": "Remove(Operation<TModel>, TModel)"
},
{
"uid": "Microsoft.AspNet.JsonPatch.Adapters.IObjectAdapter`1.Replace(Microsoft.AspNet.JsonPatch.Operations.Operation{`0},`0)",
"parent": "Microsoft.AspNet.JsonPatch.Adapters.IObjectAdapter`1",
"fullName.vb": "Microsoft.AspNet.JsonPatch.Adapters.IObjectAdapter(Of TModel).Replace(Microsoft.AspNet.JsonPatch.Operations.Operation(Of TModel), TModel)",
"assemblies": [
"Microsoft.AspNet.JsonPatch"
],
"namespace": "Microsoft.AspNet.JsonPatch.Adapters",
"syntax": {
"content": {
"VB": "Sub Replace(operation As Operation(Of TModel), objectToApplyTo As TModel)",
"CSharp": "void Replace(Operation<TModel> operation, TModel objectToApplyTo)"
},
"parameters": [
{
"type": "Microsoft.AspNet.JsonPatch.Operations.Operation{{TModel}}",
"id": "operation"
},
{
"type": "TModel",
"id": "objectToApplyTo"
}
]
},
"source": {
"path": "src/Microsoft.AspNet.JsonPatch/Adapters/IObjectAdapter.cs",
"startLine": 17,
"remote": {
"repo": "https://github.com/aspnet/mvc",
"path": "src/Microsoft.AspNet.JsonPatch/Adapters/IObjectAdapter.cs",
"branch": "dev",
"key": "faaba481"
}
},
"href": "Microsoft.AspNet.JsonPatch.Adapters.IObjectAdapter`1.yml",
"name.vb": "Replace(Operation(Of TModel), TModel)",
"fullName": "Microsoft.AspNet.JsonPatch.Adapters.IObjectAdapter<TModel>.Replace(Microsoft.AspNet.JsonPatch.Operations.Operation<TModel>, TModel)",
"type": "Method",
"id": "Replace(Microsoft.AspNet.JsonPatch.Operations.Operation{`0},`0)",
"name": "Replace(Operation<TModel>, TModel)"
}
],
"references": [
{
"name.csharp": "Microsoft.AspNet.JsonPatch.Adapters",
"uid": "Microsoft.AspNet.JsonPatch.Adapters",
"fullName.csharp": "Microsoft.AspNet.JsonPatch.Adapters",
"fullName.vb": "Microsoft.AspNet.JsonPatch.Adapters",
"type": "Default",
"name.vb": "Microsoft.AspNet.JsonPatch.Adapters",
"isExternal": false
},
{
"name.csharp": "Operation<TModel>",
"uid": "Microsoft.AspNet.JsonPatch.Operations.Operation{{TModel}}",
"fullName.csharp": "Microsoft.AspNet.JsonPatch.Operations.Operation<TModel>",
"fullName.vb": "Microsoft.AspNet.JsonPatch.Operations.Operation(Of TModel)",
"spec.csharp": [
{
"fullName": "Microsoft.AspNet.JsonPatch.Operations.Operation",
"href": "Microsoft.AspNet.JsonPatch.Operations.Operation`1.yml",
"uid": "Microsoft.AspNet.JsonPatch.Operations.Operation`1",
"name": "Operation",
"isExternal": false
},
{
"fullName": "<",
"name": "<"
},
{
"fullName": "TModel",
"name": "TModel"
},
{
"fullName": ">",
"name": ">"
}
],
"name.vb": "Operation(Of TModel)",
"spec.vb": [
{
"fullName": "Microsoft.AspNet.JsonPatch.Operations.Operation",
"href": "Microsoft.AspNet.JsonPatch.Operations.Operation`1.yml",
"uid": "Microsoft.AspNet.JsonPatch.Operations.Operation`1",
"name": "Operation",
"isExternal": false
},
{
"fullName": "(Of ",
"name": "(Of "
},
{
"fullName": "TModel",
"name": "TModel"
},
{
"fullName": ")",
"name": ")"
}
]
},
{
"name.csharp": "TModel",
"uid": "TModel",
"fullName.csharp": "TModel",
"fullName.vb": "TModel",
"name.vb": "TModel",
"isExternal": false
}
]
}

@ -0,0 +1,100 @@
{
"funcs": [
{
"name": "CopyFuncs",
"doc": "CopyFuncs produces a json-annotated array of Func objects from an array of GoDoc Func objects.\n",
"packageName": "main",
"packageImportPath": "example",
"recv": "",
"orig": ""
},
{
"name": "CopyValues",
"doc": "CopyValues produces a json-annotated array of Value objects from an array of GoDoc Value objects.\n",
"packageName": "main",
"packageImportPath": "example",
"recv": "",
"orig": ""
}
],
"name": "main",
"vars": [],
"doc": "",
"notes": {},
"bugs": null,
"filenames": [
"example/godocjson.go"
],
"importPath": "example",
"consts": [],
"imports": [
"encoding/json",
"fmt",
"go/doc",
"go/parser",
"go/token",
"os"
],
"type": "package",
"types": [
{
"funcs": [],
"name": "Func",
"vars": [],
"doc": "Func represents a function declaration.\n",
"packageName": "main",
"packageImportPath": "example",
"consts": [],
"methods": []
},
{
"funcs": [],
"name": "Note",
"vars": [],
"doc": "Note represents a note comment.\n",
"packageName": "main",
"packageImportPath": "example",
"consts": [],
"methods": []
},
{
"funcs": [
{
"name": "CopyPackage",
"doc": "CopyPackage produces a json-annotated Package object from a GoDoc Package object.\n",
"packageName": "main",
"packageImportPath": "example",
"recv": "",
"orig": ""
}
],
"name": "Package",
"vars": [],
"doc": "Package represents a package declaration.\n",
"packageName": "main",
"packageImportPath": "example",
"consts": [],
"methods": []
},
{
"funcs": [],
"name": "Type",
"vars": [],
"doc": "Type represents a type declaration.\n",
"packageName": "main",
"packageImportPath": "example",
"consts": [],
"methods": []
},
{
"funcs": [],
"name": "Value",
"vars": [],
"doc": "Value represents a value declaration.\n",
"packageName": "main",
"packageImportPath": "example",
"consts": [],
"methods": []
}
]
}

@ -0,0 +1,297 @@
[
{
"comment": "/**\n * Creates an instance of Circle.\n *\n * @constructor\n * @this {Circle}\n * @param {number} r The desired radius of the circle.\n */",
"kind": "class",
"description": "Creates an instance of Circle.",
"this": "{Circle}",
"see": [],
"meta": {
"path": "/Users/eric/projects/sphinx-autoapi/tests/jsexample/example",
"range": [
134,
251
],
"code": {
"node": "<Object>",
"paramnames": [
"r"
],
"type": "function",
"id": "astnode194706439",
"name": "Circle"
},
"lineno": 8,
"filename": "jsdoc-example.js"
},
"params": [
{
"description": "The desired radius of the circle.",
"nullable": "undefined",
"type": {
"names": [
"number"
]
},
"defaultvalue": "undefined",
"variable": "undefined",
"optional": "undefined",
"name": "r"
}
],
"longname": "Circle",
"scope": "global",
"name": "Circle"
},
{
"comment": "/** @private */",
"kind": "member",
"name": "radius",
"memberof": "{Circle}",
"access": "private",
"meta": {
"path": "/Users/eric/projects/sphinx-autoapi/tests/jsexample/example",
"range": [
175,
190
],
"code": {
"node": "<Object>",
"type": "NAME",
"id": "astnode1413378318",
"value": "r",
"name": "this.radius"
},
"lineno": 9,
"filename": "jsdoc-example.js"
},
"longname": "{Circle}#radius",
"scope": "instance"
},
{
"comment": "/** @private */",
"kind": "member",
"name": "circumference",
"memberof": "{Circle}",
"access": "private",
"meta": {
"path": "/Users/eric/projects/sphinx-autoapi/tests/jsexample/example",
"range": [
212,
248
],
"code": {
"node": "<Object>",
"type": "MUL",
"id": "astnode1157058691",
"value": "MUL",
"name": "this.circumference"
},
"lineno": 10,
"filename": "jsdoc-example.js"
},
"longname": "{Circle}#circumference",
"scope": "instance"
},
{
"comment": "/**\n * Creates a new Circle from a diameter.\n *\n * @param {number} d The desired diameter of the circle.\n * @return {Circle} The new Circle object.\n */",
"kind": "function",
"description": "Creates a new Circle from a diameter.",
"memberof": "Circle",
"returns": [
{
"description": "The new Circle object.",
"nullable": "undefined",
"type": {
"names": [
"Circle"
]
},
"defaultvalue": "undefined",
"variable": "undefined",
"optional": "undefined"
}
],
"meta": {
"path": "/Users/eric/projects/sphinx-autoapi/tests/jsexample/example",
"range": [
406,
474
],
"code": {
"node": "<Object>",
"paramnames": [
"d"
],
"name": "Circle.fromDiameter",
"value": "FUNCTION",
"type": "FUNCTION",
"id": "astnode398110318"
},
"lineno": 19,
"filename": "jsdoc-example.js"
},
"params": [
{
"description": "The desired diameter of the circle.",
"nullable": "undefined",
"type": {
"names": [
"number"
]
},
"defaultvalue": "undefined",
"variable": "undefined",
"optional": "undefined",
"name": "d"
}
],
"longname": "Circle.fromDiameter",
"scope": "static",
"name": "fromDiameter"
},
{
"comment": "/**\n * Calculates the circumference of the Circle.\n *\n * @deprecated\n * @this {Circle}\n * @return {number} The circumference of the circle.\n */",
"kind": "function",
"description": "Calculates the circumference of the Circle.",
"this": "{Circle}",
"deprecated": true,
"longname": "Circle#calculateCircumference",
"returns": [
{
"description": "The circumference of the circle.",
"nullable": "undefined",
"type": {
"names": [
"number"
]
},
"defaultvalue": "undefined",
"variable": "undefined",
"optional": "undefined"
}
],
"see": [],
"meta": {
"path": "/Users/eric/projects/sphinx-autoapi/tests/jsexample/example",
"range": [
622,
717
],
"code": {
"node": "<Object>",
"paramnames": [],
"name": "Circle.prototype.calculateCircumference",
"value": "FUNCTION",
"type": "FUNCTION",
"id": "astnode1582785598"
},
"lineno": 30,
"filename": "jsdoc-example.js"
},
"memberof": "Circle",
"scope": "instance",
"name": "calculateCircumference"
},
{
"comment": "/**\n * Returns the pre-computed circumference of the Circle.\n *\n * @this {Circle}\n * @return {number} The circumference of the circle.\n */",
"kind": "function",
"description": "Returns the pre-computed circumference of the Circle.",
"this": "{Circle}",
"memberof": "Circle",
"returns": [
{
"description": "The circumference of the circle.",
"nullable": "undefined",
"type": {
"names": [
"number"
]
},
"defaultvalue": "undefined",
"variable": "undefined",
"optional": "undefined"
}
],
"see": [],
"meta": {
"path": "/Users/eric/projects/sphinx-autoapi/tests/jsexample/example",
"range": [
860,
942
],
"code": {
"node": "<Object>",
"paramnames": [],
"name": "Circle.prototype.getCircumference",
"value": "FUNCTION",
"type": "FUNCTION",
"id": "astnode2134991632"
},
"lineno": 40,
"filename": "jsdoc-example.js"
},
"longname": "Circle#getCircumference",
"scope": "instance",
"name": "getCircumference"
},
{
"comment": "/**\n * Find a String representation of the Circle.\n *\n * @override\n * @this {Circle}\n * @return {string} Human-readable representation of this Circle.\n */",
"kind": "function",
"description": "Find a String representation of the Circle.",
"tags": [
{
"originalTitle": "override",
"text": "",
"title": "override"
}
],
"this": "{Circle}",
"memberof": "Circle",
"returns": [
{
"description": "Human-readable representation of this Circle.",
"nullable": "undefined",
"type": {
"names": [
"string"
]
},
"defaultvalue": "undefined",
"variable": "undefined",
"optional": "undefined"
}
],
"see": [],
"meta": {
"path": "/Users/eric/projects/sphinx-autoapi/tests/jsexample/example",
"range": [
1101,
1210
],
"code": {
"node": "<Object>",
"paramnames": [],
"name": "Circle.prototype.toString",
"value": "FUNCTION",
"type": "FUNCTION",
"id": "astnode1822383117"
},
"lineno": 51,
"filename": "jsdoc-example.js"
},
"longname": "Circle#toString",
"scope": "instance",
"name": "toString"
},
{
"files": [
"/Users/eric/projects/sphinx-autoapi/tests/jsexample/example/jsdoc-example.js"
],
"kind": "package",
"description": "undefined",
"version": "undefined",
"longname": "package:undefined",
"licenses": "undefined",
"name": "undefined"
}
]

@ -1,127 +0,0 @@
{
"type": "package",
"doc": "This is the golang UUID module",
"name": "go.uuid",
"import_path": "uuid.go",
"imports": [
"something",
"foo",
"bar"
],
"filenames": [
"something.go",
"foo.go",
"bar.go"
],
"notes": {
"TODO": [
{
"pos": 27,
"end": 42,
"uid": "someone",
"body": "This is a code TODO note, we probably shouldn't show it."
}
],
"BUG": [
{
"pos": 43,
"end": 44,
"uid": "someone",
"body": "This is a bug admonition"
}
]
},
"bugs": [
"Bug notes here"
],
"consts": [
{
"name": "awesome",
"type": "const",
"doc": "This is the documentation for the const",
"names": [
"not",
"sure",
"what",
"goes",
"here"
]
}
],
"types": [
{
"type": "type",
"doc": "This is the documentation for the type",
"name": "uuid.foobar",
"consts": [
{
"type": "const",
"doc": "This is the documentation for a const nested in a type",
"names": [
"shit"
]
}
],
"vars": [
{
"type": "variable",
"doc": "This is the documentation for a variable nested in a type",
"names": [
"more"
]
}
],
"funcs": [
{
"type": "func",
"doc": "This is documentation for a function",
"name": "uuid.some_func",
"recv": "",
"orig": "",
"level": 0
}
],
"methods": [
{
"type": "method",
"doc": "This is documentation for a method",
"name": "uuid.some_method",
"recv": "T",
"orig": "T",
"level": 0
}
]
}
],
"vars": [
{
"type": "var",
"doc": "This is the documentation for the variable",
"names": [
"not",
"sure",
"what",
"goes",
"here"
]
}
],
"funcs": [
{
"type": "func",
"doc": "This is documentation for a function",
"name": "uuid.some_func",
"recv": "",
"orig": "",
"level": 0
},
{
"type": "method",
"doc": "This is documentation for a method",
"name": "uuid.some_method",
"recv": "T",
"orig": "T",
"level": 0
}
]
}

@ -82,6 +82,7 @@ class DomainTests(unittest.TestCase):
with nested(
patch('autoapi.mappers.dotnet.DotNetSphinxMapper.find_files', _mock_find),
patch('autoapi.mappers.dotnet.DotNetSphinxMapper.read_file', _mock_read),
patch('subprocess.check_output', lambda foo: foo),
):
dom = dotnet.DotNetSphinxMapper(self.application)
dom.load('', '', '')

@ -1,93 +1,97 @@
import json
import os
import shutil
import subprocess as sp
import unittest
__author__ = 'swenson'
from mock import patch
from sphinx.application import Sphinx
class LanguageIntegrationTests(unittest.TestCase):
def test_full_py(self):
os.chdir('tests/pyexample')
def _run_test(self, test_dir, test_file, test_string):
os.chdir('tests/{0}'.format(test_dir))
try:
if os.path.exists('_build'):
shutil.rmtree('_build')
os.mkdir('_build')
sp.check_call('sphinx-build -b text -d _build/doctrees . _build/text', shell=True)
with open('_build/text/autoapi/example/index.txt') as fin:
app = Sphinx(
srcdir='.',
confdir='.',
outdir='_build/text',
doctreedir='_build/.doctrees',
buildername='text',
)
app.build(force_all=True)
with open(test_file) as fin:
text = fin.read().strip()
self.assertIn('Compute the square root of x and return it.', text)
self.assertIn(test_string, text)
finally:
shutil.rmtree('_build')
os.chdir('../..')
def test_full_js(self):
os.chdir('tests/jsexample')
try:
if os.path.exists('_build'):
shutil.rmtree('_build')
os.mkdir('_build')
sp.check_call('sphinx-build -b text -d _build/doctrees . _build/text', shell=True)
with open('_build/text/autoapi/Circle/index.txt') as fin:
text = fin.read().strip()
self.assertIn('Creates an instance of Circle', text)
finally:
os.chdir('../..')
class JavaScriptTests(LanguageIntegrationTests):
def test_full_go(self):
os.chdir('tests/goexample')
try:
if os.path.exists('_build'):
shutil.rmtree('_build')
os.mkdir('_build')
sp.check_call('sphinx-build -b text -d _build/doctrees . _build/text', shell=True)
def _js_read(self, path):
return json.load(open('../fixtures/javascript.json'))
with open('_build/text/autoapi/main/index.txt') as fin:
text = fin.read().strip()
self.assertIn(
'CopyFuncs produces a json-annotated array of Func objects',
text
)
finally:
os.chdir('../..')
@patch('autoapi.mappers.javascript.JavaScriptSphinxMapper.read_file', _js_read)
def test_integration(self):
self._run_test(
'jsexample',
'_build/text/autoapi/Circle/index.txt',
'Creates an instance of Circle'
)
def test_full_dotnet(self):
os.chdir('tests/dotnetexample')
try:
if os.path.exists('_build'):
shutil.rmtree('_build')
os.mkdir('_build')
sp.check_call('sphinx-build -b text -d _build/doctrees . _build/text', shell=True)
with open('_build/text/autoapi/Microsoft/CodeAnalysis/AdhocWorkspace/index.txt') as fin:
text = fin.read().strip()
self.assertIn(
'A workspace that allows full manipulation of projects and documents',
text
)
finally:
os.chdir('../..')
class GoTests(LanguageIntegrationTests):
def _go_read(self, path):
return json.load(open('../fixtures/go.json'))
class FeatureIntegrationTests(unittest.TestCase):
@patch('autoapi.mappers.go.GoSphinxMapper.read_file', _go_read)
def test_integration(self):
self._run_test(
'goexample',
'_build/text/autoapi/main/index.txt',
'CopyFuncs produces a json-annotated array of Func objects'
)
def test_template_override(self):
"""
Test that we are overriding the template properly.
This uses the ``template_overrides/python/function.rst`` template to override content.
"""
os.chdir('tests/templateexample')
try:
if os.path.exists('_build'):
shutil.rmtree('_build')
os.mkdir('_build')
sp.check_call('sphinx-build -b text -d _build/doctrees . _build/text', shell=True)
class PythonTests(LanguageIntegrationTests):
with open('_build/text/autoapi/example/index.txt') as fin:
text = fin.read().strip()
self.assertIn('This is a fuction template override!', text)
finally:
os.chdir('../..')
def test_integration(self):
self._run_test(
'pyexample',
'_build/text/autoapi/example/index.txt',
'Compute the square root of x and return it'
)
class DotNetTests(LanguageIntegrationTests):
def _dotnet_read(self, path):
return json.load(open('../fixtures/dotnet.json'))
# Mock this because it's slow otherwise
def _dotnet_load(self, pattern, dir, ignore=[]):
data = self.read_file(path='inmem')
self.paths['inmem'] = data
@patch('autoapi.mappers.dotnet.DotNetSphinxMapper.load', _dotnet_load)
@patch('autoapi.mappers.dotnet.DotNetSphinxMapper.read_file', _dotnet_read)
def test_integration(self):
self._run_test(
'dotnetexample',
'_build/text/autoapi/Microsoft/AspNet/JsonPatch/Adapters/IObjectAdapter<TModel>/index.txt',
'Defines the operations that can be performed on a JSON patch document.'
)
class IntegrationTests(LanguageIntegrationTests):
def test_template_overrides(self):
self._run_test(
'templateexample',
'_build/text/autoapi/example/index.txt',
'This is a fuction template override'
)

Loading…
Cancel
Save