INNER CODE UNIT · Python

new_operation

renyuneyun/Easer · utils/new_operation.py:32

def new_operation(cname, identifier):
    pdef = {}
    pdef['package'] = "ryey.easer.skills.operation.{}".format(identifier)
    pdef['skill'] = "{}OperationSkill".format(cname)
    pdef['id'] = identifier
    pdef['data'] = "{}OperationData".format(cname)
    pdef['data_factory'] = "{}OperationDataFactory".format(cname)
    pdef['view_fragment'] = "{}SkillViewFragment".format(cname)
    pdef['loader'] = "{}Loader".format(cname)
    pdef['androidTest$data'] = "{}OperationDataTest".format(cname)
    for t, template_map in template_maps.items():
        dest = "app/src/{}/java/ryey/easer/skills/operation/{}".format(t, identifier)
        if not os.path.isfile(dest):
            os.mkdir(dest)
        for k in template_map:
            class_content = template_map[k].format_map(pdef)
            with open("{}/{}.java".format(dest, pdef[k]), 'w') as fd:
                fd.write(templates.tmpl_copyright)

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…