예제 #1
0
def main():
    from .db.manage.db import DB

    db = DB()
    response = db.check()

    from .util.printer import printer

    response and printer.printf('program maintenance', response)

    from .util import log
    from .db.app.config import Config, ConfigError
    from . import const

    config = Config()
    try:
        log.start(expanduser(
            config.eget('client.logfile', default=const.logfile)),
                  loglevel=config.eget('client.loglevel', default=40))
    except ConfigError as e:
        print(str(e) + '\nlog start failed')

    from .subcmd import all
    from .version import __version__

    def update_autocomplete_cb():
        printer.printf('program maintenance', 'autocomplete updated')

    execute_commandline(prog=const.app_name,
                        description=const.app_description,
                        version=__version__,
                        _to_hyphen=True,
                        default_subcommand='source random',
                        moves=True,
                        update_autocomplete_cb=update_autocomplete_cb)
예제 #2
0
    max_m = min(max_n, int((n * (n - 1)) / 2))
    m = randint(0, max_m) if m is None else int(m)

    l = randint(1, max_c) if l is None else int(l)
    r = randint(1, max_c) if r is None else int(r)

    print(n, m, l, r)

    graph = dict((i, []) for i in range(1, n + 1))

    for _ in range(0, m):
        new_road = False

        while not new_road:
            s = randint(1, n)
            d = randint(1, n)

            if s == d:
                continue

            if (d in graph[s]) or (s in graph[d]):
                continue

            new_road = True
            graph[s].append(d)

            print(s, d)


execute_commandline()
예제 #3
0
파일: gen.py 프로젝트: amol9/hackerearth
    m = randint(0, max_m) if m is None else int(m)

    l = randint(1, max_c) if l is None else int(l)
    r = randint(1, max_c) if r is None else int(r)

    print(n, m, l, r)

    graph = dict((i, []) for i in range(1, n + 1))

    for _ in range(0, m):
        new_road = False

        while not new_road:
            s = randint(1, n)
            d = randint(1, n)

            if s == d:
                continue

            if (d in graph[s]) or (s in graph[d]):
                continue

            new_road = True
            graph[s].append(d)

            print(s, d)


execute_commandline()

예제 #4
0
def main():
    execute_commandline()