sphinx-autoapi/autoapi/utils.py

45 lines
1.5 KiB
Python
Raw Normal View History

2015-04-08 05:54:53 +00:00
from .base import UnknownType
from .dotnet import (
DotNetNamespace, DotNetClass, DotNetMethod, DotNetProperty,
DotNetEnum, DotNetConstructor, DotNetStruct, DotNetInterface,
DotNetDelegate, DotNetField, DotNetEvent
)
2015-04-08 05:54:53 +00:00
from .python import PythonModule, PythonClass, PythonFunction
2015-03-27 19:50:56 +00:00
2015-04-08 05:54:53 +00:00
def classify(obj, obj_type):
if 'type' not in obj:
return ''
if obj_type == 'python':
if obj['type'] == 'module':
return PythonModule(obj)
if obj['type'] == 'class':
return PythonClass(obj)
if obj['type'] == 'function':
return PythonFunction(obj)
if obj_type == 'dotnet':
if obj['type'] == 'Class':
return DotNetClass(obj)
if obj['type'] == 'Namespace':
return DotNetNamespace(obj)
if obj['type'] == 'Property':
return DotNetProperty(obj)
if obj['type'] == 'Method':
return DotNetMethod(obj)
if obj['type'] == 'Enum':
return DotNetEnum(obj)
if obj['type'] == 'Constructor':
return DotNetConstructor(obj)
if obj['type'] == 'Struct':
return DotNetStruct(obj)
if obj['type'] == 'Interface':
return DotNetInterface(obj)
if obj['type'] == 'Delegate':
return DotNetDelegate(obj)
if obj['type'] == 'Field':
return DotNetField(obj)
if obj['type'] == 'Event':
return DotNetEvent(obj)
2015-04-08 05:54:53 +00:00
return UnknownType(obj)