예제 #1
0
def main(args=None):  # pragma: no cover
    parser = ArgumentParserWithLogging('pyclts')
    parser.add_argument(
        "--repos",
        default=CLTS(repos=Path(__file__).parent.parent.parent),
        type=CLTS,
        help="Path to clts repos.")
    parser.add_argument("--format",
                        default="pipe",
                        help="Format of tabular output.")
    parser.add_argument('--nonames',
                        help="do not report the sound names in the output",
                        action='store_true')
    parser.add_argument('--filter',
                        help="only list generated sounds",
                        default='')
    parser.add_argument('--data',
                        help="specify the transcription data you want to load",
                        default="phoible")
    parser.add_argument(
        '--system',
        help="specify the transcription system you want to load",
        default="bipa")

    res = parser.main(args=args)
    if args is None:  # pragma: no cover
        sys.exit(res)
예제 #2
0
def main():  # pragma: no cover
    parser = ArgumentParserWithLogging('pyamsd')
    parser.add_argument('--repos',
                        help="path to amsd-data repository",
                        type=Path,
                        default=Path(__file__).resolve().parent.parent.parent)
    sys.exit(parser.main())
예제 #3
0
파일: cli.py 프로젝트: clld/tsammalex-data
def main():
    parser = ArgumentParserWithLogging('pytsammalex')
    parser.add_argument(
        '--tsammalex-data',
        help="path to tsammalex-data repository",
        default=Path(pytsammalex.__file__).parent.parent)
    sys.exit(parser.main())
예제 #4
0
def main():  # pragma: no cover
    parser = ArgumentParserWithLogging('pyglottolog')
    parser.add_argument('--repos',
                        help="path to glottolog data repository",
                        type=Glottolog,
                        default=Glottolog())
    sys.exit(parser.main())
예제 #5
0
def main():  # pragma: no cover
    parser = ArgumentParserWithLogging('clldmpg')
    parser.add_argument("--project",
                        help='clld app project dir',
                        default=".",
                        type=Path)
    parser.add_argument("--version", help='data version', default="1.0")
    sys.exit(parser.main())
예제 #6
0
def main():  # pragma: no cover
    parser = ArgumentParserWithLogging(phlorest.__name__)
    parser.add_argument(
        '--repos',
        type=phlorest.Repos,
        default=phlorest.Repos(PHLOREST),
        help='Location of clone of phlorest data (defaults to ./phlorest)')
    sys.exit(parser.main())
예제 #7
0
def main():  # pragma: no cover
    cfg = configure()
    parser = ArgumentParserWithLogging(pylexibank.__name__)
    parser.add_argument('--cfg', help=argparse.SUPPRESS, default=cfg)
    parser.add_argument('--db',
                        help='path to SQLite db file',
                        default=os.path.join(os.getcwd(), 'lexibank.sqlite'))
    sys.exit(parser.main())
예제 #8
0
def main():  # pragma: no cover
    parser = ArgumentParserWithLogging(__name__, stats, add, cleanup, create, delete, update)
    for arg in ['catalog', 'url', 'user', 'pwd']:
        envvar = 'CDSTAR_{0}'.format(arg.upper())
        parser.add_argument(
            '--' + arg,
            help="defaults to ${0}".format(envvar),
            default=os.environ.get(envvar))
    sys.exit(parser.main())
예제 #9
0
def main():  # pragma: no cover
    try:
        drepos = Repos(Path(pydplace.__file__).parent.parent)
    except:
        drepos = None

    parser = ArgumentParserWithLogging(pydplace.__name__)
    parser.add_argument('--repos', help=argparse.SUPPRESS, type=Repos, default=drepos)
    sys.exit(parser.main())
예제 #10
0
파일: __main__.py 프로젝트: clld/glottolog3
def main():  # pragma: no cover
    pkg_dir = Path(glottolog3.__file__).parent
    parser = ArgumentParserWithLogging('glottolog3')
    parser.add_argument(
        '--repos',
        help="path to glottolog data repository",
        type=Glottolog,
        default=Glottolog(
            Path(glottolog3.__file__).parent.parent.parent.joinpath('glottolog')))
    parser.add_argument('--pkg-dir', help=argparse.SUPPRESS, default=pkg_dir)
    sys.exit(parser.main())
예제 #11
0
def main():  # pragma: no cover
    pkg_dir = Path(glottolog3.__file__).parent
    parser = ArgumentParserWithLogging('glottolog3')
    parser.add_argument(
        '--repos',
        help="path to glottolog data repository",
        type=Glottolog,
        default=Glottolog(
            Path(glottolog3.__file__).parent.parent.parent.joinpath(
                'glottolog')))
    parser.add_argument('--pkg-dir', help=argparse.SUPPRESS, default=pkg_dir)
    sys.exit(parser.main())
예제 #12
0
def main():  # pragma: no cover
    def glottolog(p):
        try:
            return Glottolog(p)
        except:  # noqa: E722
            return None

    parser = ArgumentParserWithLogging('pyglottolog')
    parser.add_argument('--repos',
                        help="path to glottolog data repository",
                        type=glottolog,
                        default=glottolog('.'))
    sys.exit(parser.main())
예제 #13
0
def main():  # pragma: no cover
    parser = ArgumentParserWithLogging(pyclics.__name__)
    parser.add_argument('-t', '--threshold', type=int, default=None)
    parser.add_argument('-f', '--edgefilter', default='families')
    parser.add_argument('-n', '--normalize', action='store_true')
    parser.add_argument('-g', '--graphname', default=None)
    parser.add_argument('-w', '--weight', default='FamilyWeight')
    parser.add_argument('--unloaded', action='store_true', default=False)
    parser.add_argument('-v', '--verbose', default=False, action='store_true')
    parser.add_argument('-o', '--output', default=None, help='output directory')
    parser.add_argument('--api', help=argparse.SUPPRESS, default=Clics(Path('.')))
    args = parser.parse_args()
    if args.output:
        args.api.repos = Path(args.output)
    sys.exit(parser.main(parsed_args=args))
예제 #14
0
def main():  # pragma: no cover
    parser = ArgumentParserWithLogging('pysoundcomparisons')
    parser.add_argument(
        '--repos',
        help="path to soundcomparisons-data repository",
        type=Path,
        default=Path(__file__).resolve().parent.parent.parent)
    parser.add_argument('--db-host', default='localhost')
    parser.add_argument('--db-name', default='soundcomparisons')
    parser.add_argument('--db-user', default='soundcomparisons')
    parser.add_argument('--db-password', default='pwd')
    parser.add_argument('--sc-host', default='localhost')
    parser.add_argument('--sc-repo',
                        type=Path,
                        default=Path(__file__).resolve().parent.parent.parent / 'Sound-Comparisons')
    sys.exit(parser.main())
예제 #15
0
def main():  # pragma: no cover
    parser = ArgumentParserWithLogging(__name__)
    parser.add_argument('--repos',
                        help="path to concepticon-data",
                        default=Path('.'))
    parser.add_argument('--skip_multimatch',
                        help="",
                        default=False,
                        action='store_true')
    parser.add_argument(
        '--full_search',
        help="select between approximate search (default) and full search",
        default=False,
        action='store_true')
    parser.add_argument('--output', help="specify output file", default=None)
    parser.add_argument('--similarity',
                        help="specify level of similarity for concept mapping",
                        default=5,
                        type=int)
    parser.add_argument('--language',
                        help="specify your desired language for mapping",
                        default='en',
                        type=str)
    sys.exit(parser.main())
예제 #16
0
def main():  # pragma: no cover
    parser = ArgumentParserWithLogging('clldlucl')
    parser.add_argument("--project", help='clld app project dir', default=".", type=Path)
    parser.add_argument("--version", help='data version', default="1.0")
    sys.exit(parser.main())
예제 #17
0
def main():  # pragma: no cover
    parser = ArgumentParserWithLogging('pycldf', stats, validate, createdb)
    sys.exit(parser.main())
예제 #18
0
파일: cli.py 프로젝트: tsammalex/tsammalex
def main():
    parser = ArgumentParserWithLogging('pytsammalex')
    parser.add_argument('--tsammalex-data',
                        help="path to tsammalex-data repository",
                        default=Path(pytsammalex.__file__).parent.parent)
    sys.exit(parser.main())
예제 #19
0
def test_ArgumentParser(capsys):
    from clldutils.clilib import ArgumentParserWithLogging, ParserError, command

    def cmd(args):
        """
        docstring
        """
        if len(args.args) < 1:
            raise ParserError('not enough arguments')
        print(args.args[0])

    parser = ArgumentParserWithLogging('pkg', cmd)

    parser.main(args=['help', 'cmd'])
    out, err = capsys.readouterr()
    assert 'docstring' in out

    parser.main(args=['cmd', 'arg'])
    out, err = capsys.readouterr()
    assert 'arg' in out

    assert parser.main(args=['cmd', 'arg']) == 0

    parser.main(args=['cmd'])
    out, err = capsys.readouterr()
    assert 'not enough arguments' in out

    assert parser.main(args=['x']) != 0
    out, err = capsys.readouterr()
    assert out.startswith('invalid')

    @command()
    def ls(args):
        """
        my name is ls
        """
        return

    @command(name='list')
    def f(args):
        """
        my name is list
        """
        return

    parser = ArgumentParserWithLogging('pkg')
    parser.main(args=['help', 'ls'])
    out, err = capsys.readouterr()
    assert 'my name is ls' in out

    parser.main(args=['help', 'list'])
    out, err = capsys.readouterr()
    assert 'my name is list' in out

    assert parser.main(args=['ls', 'arg']) == 0
    assert parser.main(args=['list', 'arg']) == 0
예제 #20
0
파일: __main__.py 프로젝트: Anaphory/pycldf
def main():  # pragma: no cover
    parser = ArgumentParserWithLogging('pycldf', stats, validate, createdb)
    sys.exit(parser.main())