Example #1
0
def getaction():
    json_data = []
    request_json = json.dumps(request.json)
    print request_json
    request_json = json.loads(request_json)

    request_action = request_json['action']
    print 'action name %s' % request_action

    cfg = readconfig()
    files = cfg['pythonsrcdir']
    print 'pythonsrcdir: ' + files

    driverfile = files + '/ProductDrivers/' + request_action.lower() + '_driver.py'
    print 'driverfile %s' % driverfile
    packagelist = findPackageListNew(driverfile)
    for i in packagelist:
        action_name = i.replace('Actions.', '')
        action_name = action_name.replace('Actions', '')
        action_name = action_name.lstrip()
        print action_name
        sa = fetch_action_file_names(files, 'action', action_name)

        # sa=fetch_action_file_names(files,'action',request_action)

        for k, v in sa.iteritems():
            for i in v:
                pyfile = i
                lines = read_lines(pyfile)
                defs = class_defs(lines, pyfile)
                parse_docs(lines, defs, pyfile)
                json_data.append(defs)
    print json.dumps(json_data, indent=2)
    return json.dumps(json_data, indent=2)
Example #2
0
def fetchdocstrings():
    # fetch_action_file_names('D:/fujitsu_vijay/app/raw/python')
    json_data = []
    cfg = readconfig()
    files = cfg['pythonsrcdir'] + '/python'
    print files
    sa = fetch_action_file_names(files, 'action', 'all')
    for k, v in sa.iteritems():
        for i in v:
            pyfile = i
            lines = read_lines(pyfile)
            defs = class_defs(lines, pyfile)
            parse_docs(lines, defs, pyfile)
            json_data.append(defs)
    return json.dumps(json_data, indent=2)
Example #3
0
def getactionOld():
    json_data = []
    request_json = json.dumps(request.json)
    print request_json
    request_json = json.loads(request_json)

    request_action = request_json['action']
    print 'action name %s' % request_action
    cfg = readconfig()
    files = cfg['pythonsrcdir'] + '/python'
    print files
    sa = fetch_action_file_names(files, 'action', request_action)

    for k, v in sa.iteritems():
        for i in v:
            pyfile = i
            lines = read_lines(pyfile)
            defs = class_defs(lines, pyfile)
            parse_docs(lines, defs, pyfile)
            json_data.append(defs)
    print json.dumps(json_data, indent=2)
    return json.dumps(json_data, indent=2)