# Path: shiji/urldispatch.py
# API_VERSION_HEADER = "X-DigiTar-API-Version"
# def get_version(request):
#     def __init__(self, request, url_matches, call_router=None):
#     def render(self, request):
#         def cb_deferred_finish(result):
#         def eb_failed(failure):
#     def __init__(self, request, api_router):
#     def render_OPTIONS(self, request):
#     def render_GET(self, request):
#     def render_POST(self, request):
#     def render_GET(self, request):
#     def render_POST(self, request):
#     def render_GET(self, request):
#     def render_POST(self, request):
#     def render_GET(self, request):
#     def __init__(self, calls_module, version_router=None, auto_list_versions=False):
#     def _createRouteMap(self, calls_module):
#     def getChild(self, name, request):
#     def __init__(self, version_map, api_router=None):
#     def getChild(self, name, request):
#     def get_version_map(self):
#     def __init__(self, route_map, config={}, cross_origin_domains=None, inhibit_http_caching=True):
#     def getChild(self, name, request):
#     def get_route_map(self):
#     def __init__(self, route_map):
#     def getChild(self, name, request):
# class URLMatchJSONResource(Resource):
# class CORSInterrogation(Resource):
# class UnknownAPI(Resource):
# class UnknownCall(Resource):
# class UnknownVersion(Resource):
# class ListVersionsCall (URLMatchJSONResource):
# class CallRouter(Resource):
# class VersionRouter(Resource):
# class APIRouter(Resource):
# class URLRouter(Resource):
# 
# Path: shiji/webapi.py
# ARG_OPTIONAL = True
# ARG_REQUIRED = False
# def json_arguments(arg_list, content_type="application/json"):
#     def jsonValidateArgWrap(render_func):
#         def jsonWrappedFilet(self, request):
# def paged_results(default_page=0,default_page_len=50,max_page_len=100):
#     def pageValidateWrap(render_func):
#         def wrappedFunction(self, request):
# def url_arguments(arg_list, content_type=""):
#     def urlValidateArgWrap(render_func):
#         def urlWrappedFilet(self, request):
# def auth_http_basic(auth_func, realm="Shiji"):
#     def authValidateCallerWrap(render_func):
#         def authWrappedFilet(self, request):
# def write_json(request, obj):
#     def __init__(self, request_object, error_code=None, exception_class=None, exception_text=None):
#     def obj_err(self):
#     def json_err(self):
#     def __str__(self):
#     def __init__(self, request_object, api_name):
#     def __init__(self, request_object, api_version):
#     def __init__(self, request_object, call_name):
#     def __init__(self, request_object, arg_name, extra_desc):
#     def __init__(self, request_object):
#     def __init__(self, request_object, error_msg):
#     def __init__(self, request_object, name, signature):
#     def __init__(self, request_object, name):
# class APIError(BaseException):
# class UnknownAPIError(APIError):
# class UnknownAPIVersionError(APIError):
# class UnknownAPICallError(APIError):
# class JSONEncodeError(APIError):
# class JSONDecodeError(APIError):
# class RequestNotHashError(APIError):
# class AccessDeniedError(APIError):
# class ValueError(APIError):
# class ContentTypeError(APIError):
# class CharsetNotUTF8Error(APIError):
# class UnexpectedServerError(APIError):
# class InvalidAuthenticationError(APIError):
# class InvalidSecureCookieError(APIError):
# class ExpiredSecureCookieError(APIError):


import sys, os, re, inspect, json
import mako, markdown
from optparse import OptionParser
from datetime import date
from mako.lookup import TemplateLookup
from shiji import urldispatch, webapi
                                                       str(e))
        sys.exit(WRITE_FILE_ERR)
    
    # Generate <api>/<version>/errors.py
    tmpl_new_calls = template_lookup.get_template("new_errors.py.mako")
    try:
        f_calls = open(version_dir + "/errors.py", "w")
        f_calls.write(tmpl_new_calls.render(api=api,
                                            version=version,
                                            version_module=version_module))
    except IOError, e:
        print "Error generating %s/%s/errors.py: %s" % (api,
                                                        version_module,
                                                        str(e))
        sys.exit(WRITE_FILE_ERR)
    
    print "Generated version '%s'" % version

def cmd_docs(docs, template):
    "Generate API documentation."
    doc_tree = {"versions" : {}}
    sys.path.append(curr_dir)
    api_module = __import__(docs)
    
    doc_tree["api_name"] = api_module.api_name
    
    for version in api_module.api_versions.keys():
        doc_tree["versions"][version] = {"calls" : {}, "error_codes" : {}}
        for member in inspect.getmembers(api_module.api_versions[version][1].calls):
            if inspect.isclass(member[1]):

# Path: shiji/urldispatch.py
# API_VERSION_HEADER = "X-DigiTar-API-Version"
# def get_version(request):
#     def __init__(self, request, url_matches, call_router=None):
#     def render(self, request):
#         def cb_deferred_finish(result):
#         def eb_failed(failure):
#     def __init__(self, request, api_router):
#     def render_OPTIONS(self, request):
#     def render_GET(self, request):
#     def render_POST(self, request):
#     def render_GET(self, request):
#     def render_POST(self, request):
#     def render_GET(self, request):
#     def render_POST(self, request):
#     def render_GET(self, request):
#     def __init__(self, calls_module, version_router=None, auto_list_versions=False):
#     def _createRouteMap(self, calls_module):
#     def getChild(self, name, request):
#     def __init__(self, version_map, api_router=None):
#     def getChild(self, name, request):
#     def get_version_map(self):
#     def __init__(self, route_map, config={}, cross_origin_domains=None, inhibit_http_caching=True):
#     def getChild(self, name, request):
#     def get_route_map(self):
#     def __init__(self, route_map):
#     def getChild(self, name, request):
# class URLMatchJSONResource(Resource):
# class CORSInterrogation(Resource):
# class UnknownAPI(Resource):
# class UnknownCall(Resource):
# class UnknownVersion(Resource):
# class ListVersionsCall (URLMatchJSONResource):
# class CallRouter(Resource):
# class VersionRouter(Resource):
# class APIRouter(Resource):
# class URLRouter(Resource):
# 
# Path: shiji/webapi.py
# ARG_OPTIONAL = True
# ARG_REQUIRED = False
# def json_arguments(arg_list, content_type="application/json"):
#     def jsonValidateArgWrap(render_func):
#         def jsonWrappedFilet(self, request):
# def paged_results(default_page=0,default_page_len=50,max_page_len=100):
#     def pageValidateWrap(render_func):
#         def wrappedFunction(self, request):
# def url_arguments(arg_list, content_type=""):
#     def urlValidateArgWrap(render_func):
#         def urlWrappedFilet(self, request):
# def auth_http_basic(auth_func, realm="Shiji"):
#     def authValidateCallerWrap(render_func):
#         def authWrappedFilet(self, request):
# def write_json(request, obj):
#     def __init__(self, request_object, error_code=None, exception_class=None, exception_text=None):
#     def obj_err(self):
#     def json_err(self):
#     def __str__(self):
#     def __init__(self, request_object, api_name):
#     def __init__(self, request_object, api_version):
#     def __init__(self, request_object, call_name):
#     def __init__(self, request_object, arg_name, extra_desc):
#     def __init__(self, request_object):
#     def __init__(self, request_object, error_msg):
#     def __init__(self, request_object, name, signature):
#     def __init__(self, request_object, name):
# class APIError(BaseException):
# class UnknownAPIError(APIError):
# class UnknownAPIVersionError(APIError):
# class UnknownAPICallError(APIError):
# class JSONEncodeError(APIError):
# class JSONDecodeError(APIError):
# class RequestNotHashError(APIError):
# class AccessDeniedError(APIError):
# class ValueError(APIError):
# class ContentTypeError(APIError):
# class CharsetNotUTF8Error(APIError):
# class UnexpectedServerError(APIError):
# class InvalidAuthenticationError(APIError):
# class InvalidSecureCookieError(APIError):
# class ExpiredSecureCookieError(APIError):


# Path: shiji/utilities/shiji_admin.py
import sys, os, re, inspect, json
import mako, markdown
from optparse import OptionParser
from datetime import date
from mako.lookup import TemplateLookup
from shiji import urldispatch, webapi

                                                       str(e))
        sys.exit(WRITE_FILE_ERR)
    
    # Generate <api>/<version>/errors.py
    tmpl_new_calls = template_lookup.get_template("new_errors.py.mako")
    try:
        f_calls = open(version_dir + "/errors.py", "w")
        f_calls.write(tmpl_new_calls.render(api=api,
                                            version=version,
                                            version_module=version_module))
    except IOError, e:
        print "Error generating %s/%s/errors.py: %s" % (api,
                                                        version_module,
                                                        str(e))
        sys.exit(WRITE_FILE_ERR)
    
    print "Generated version '%s'" % version

def cmd_docs(docs, template):
    "Generate API documentation."
    doc_tree = {"versions" : {}}
    sys.path.append(curr_dir)
    api_module = __import__(docs)
    
    doc_tree["api_name"] = api_module.api_name
    
    for version in api_module.api_versions.keys():
        doc_tree["versions"][version] = {"calls" : {}, "error_codes" : {}}
        for member in inspect.getmembers(api_module.api_versions[version][1].calls):
            if inspect.isclass(member[1]):

                if issubclass(member[1], urldispatch.URLMatchJSONResource):