예제 #1
0
#!/usr/bin/env python3
# Author:Hanzone Hao

import fun

print("hello, test world!")

if __name__ == '__main__':
    fun.main()
예제 #2
0
# import fun

# print(fun.fetch_words())

# or:
from fun import main

print(main())
""" if __name__ at fun is = __fun__,
 so you are running the code from script or using import,
 not from here"""
예제 #3
0
파일: __init__.py 프로젝트: xshi/dhad
def main(opts, args):
    if args[0] == 'backgrounds':
        import backgrounds
        backgrounds.main(opts, args[1:])
        return

    if args[0] == 'brs':
        import brs
        brs.main(opts, args[1:])
        return

    if args[0] == 'compare':
        import compare
        compare.main(opts, args[1:])
        return

    if args[0] == 'cbx':
        import cbx
        cbx.main(opts, args[1:])
        return

    if args[0] == 'crossfeeds':
        import crossfeeds
        crossfeeds.main(opts, args[1:])
        return

    if args[0] == 'evt':
        import evt
        evt.main(opts, args[1:])
        return

    if args[0] == 'fun':
        import fun
        fun.main(opts, args[1:])
        return

    if args[0] == 'kkmass':
        import kkmass
        kkmass.main(opts, args[1:])
        return

    if args[0] == 'kpimass':
        import kpimass
        kpimass.main(opts, args[1:])
        return

    if args[0] == 'trim':
        import trim
        trim.main(opts, args[1:])
        return

    if args[0] == 'trkmtm':
        import trkmtm
        trkmtm.main(opts, args[1:])
        return

    if args[0] == 'trkmtm1':
        import trkmtm1
        trkmtm1.main(opts, args[1:])
        return

    if args[0] == 'trkmtm2':
        import trkmtm2
        trkmtm2.main(opts, args[1:])
        return

    if args[0] == 'var':
        import var
        var.main(opts, args[1:])
        return


    figname = '_'.join(args).replace('/', '_')

    parsed = parse_args(args)
    dt_type  = parsed[0]
    tag = parsed[1]
    modes = parsed[2]
    label = parsed[3]

    sqrt = False
    if opts.set and opts.set == 'sqrt':
        sqrt = True

    linr = False
    if opts.set and opts.set == 'linr':
        linr = True


    org = UserFile()
    org.append(attr.fig_web_header)

    for mode in modes:
        if mode == 'double_all_d0s' or mode == 'double_all_dps' :
            modekey = mode
        else:
            modekey = get_modekey(mode)
        if sqrt:
            sqrt_fig_mode(tag, dt_type, modekey, label)
        sys.stdout.write('Creating %s ...' % mode)
        sys.stdout.flush()
        msg = create_fig_mode(tag, dt_type, modekey, label)
        sys.stdout.write(' OK.\n')
        org.append(msg)

    org.append(attr.fig_web_footer)
    figlabel = label.split('/')[0]

    figname = figname.replace(figlabel, '')
    figname = figname.replace('__', '_')

    orgname = figname+'.org'
    orgname = orgname.replace('_.org', '.org')
    orgpath = os.path.join(attr.figpath, figlabel)
    orgfile = tools.check_and_join(orgpath, orgname)
    
    verbose = opts.verbose
    if opts.test:
        verbose = 1

    org.output(orgfile, verbose=verbose)
    orglink = '[[./fig/%s/%s][figure]]' %(figlabel, orgname)
    sys.stdout.write('\n%s\n\n' % orglink)

    if opts.test:
        return

    tools.org_export_as_html(orgfile)
예제 #4
0
def main(opts, args):
    if args[0] == 'backgrounds':
        import backgrounds
        backgrounds.main(opts, args[1:])
        return

    if args[0] == 'brs':
        import brs
        brs.main(opts, args[1:])
        return

    if args[0] == 'compare':
        import compare
        compare.main(opts, args[1:])
        return

    if args[0] == 'cbx':
        import cbx
        cbx.main(opts, args[1:])
        return

    if args[0] == 'crossfeeds':
        import crossfeeds
        crossfeeds.main(opts, args[1:])
        return

    if args[0] == 'evt':
        import evt
        evt.main(opts, args[1:])
        return

    if args[0] == 'fun':
        import fun
        fun.main(opts, args[1:])
        return

    if args[0] == 'kkmass':
        import kkmass
        kkmass.main(opts, args[1:])
        return

    if args[0] == 'kpimass':
        import kpimass
        kpimass.main(opts, args[1:])
        return

    if args[0] == 'trim':
        import trim
        trim.main(opts, args[1:])
        return

    if args[0] == 'trkmtm':
        import trkmtm
        trkmtm.main(opts, args[1:])
        return

    if args[0] == 'trkmtm1':
        import trkmtm1
        trkmtm1.main(opts, args[1:])
        return

    if args[0] == 'trkmtm2':
        import trkmtm2
        trkmtm2.main(opts, args[1:])
        return

    if args[0] == 'var':
        import var
        var.main(opts, args[1:])
        return

    figname = '_'.join(args).replace('/', '_')

    parsed = parse_args(args)
    dt_type = parsed[0]
    tag = parsed[1]
    modes = parsed[2]
    label = parsed[3]

    sqrt = False
    if opts.set and opts.set == 'sqrt':
        sqrt = True

    linr = False
    if opts.set and opts.set == 'linr':
        linr = True

    org = UserFile()
    org.append(attr.fig_web_header)

    for mode in modes:
        if mode == 'double_all_d0s' or mode == 'double_all_dps':
            modekey = mode
        else:
            modekey = get_modekey(mode)
        if sqrt:
            sqrt_fig_mode(tag, dt_type, modekey, label)
        sys.stdout.write('Creating %s ...' % mode)
        sys.stdout.flush()
        msg = create_fig_mode(tag, dt_type, modekey, label)
        sys.stdout.write(' OK.\n')
        org.append(msg)

    org.append(attr.fig_web_footer)
    figlabel = label.split('/')[0]

    figname = figname.replace(figlabel, '')
    figname = figname.replace('__', '_')

    orgname = figname + '.org'
    orgname = orgname.replace('_.org', '.org')
    orgpath = os.path.join(attr.figpath, figlabel)
    orgfile = tools.check_and_join(orgpath, orgname)

    verbose = opts.verbose
    if opts.test:
        verbose = 1

    org.output(orgfile, verbose=verbose)
    orglink = '[[./fig/%s/%s][figure]]' % (figlabel, orgname)
    sys.stdout.write('\n%s\n\n' % orglink)

    if opts.test:
        return

    tools.org_export_as_html(orgfile)