def main(): if settings.toml is None: sys.exit() if settings.toml['auto_update']: check_for_update() if sys.version_info[0] == 3 and sys.version_info[ 1] >= 7 and sys.platform.startswith('win'): asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy()) parser = ArgParser() if len(sys.argv) > 1: args = parser.parse_args(sys.argv[1:]) if args.date: folder_name = 'dates/' + args.region file_name = args.date.replace('/', '_') races = get_race_urls_date(parser.dates, args.region) else: folder_name = args.region if args.region else course_name( args.course) file_name = args.year races = get_race_urls(parser.tracks, parser.years, args.type) scrape_races(races, folder_name, file_name, args.type) else: if sys.platform == 'linux': import readline completions = Completer() readline.set_completer(completions.complete) readline.parse_and_bind('tab: complete') while True: args = input('[rpscrape]> ').lower().strip() args = parser.parse_args_interactive( [arg.strip() for arg in args.split()]) print(args) if args: if 'dates' in args: races = get_race_urls_date(args['dates'], args['region']) else: races = get_race_urls(args['tracks'], args['years'], args['type']) scrape_races(races, args['folder_name'], args['file_name'], args['type'])
def parse_args(): parser = ArgParser(allow_config=True) parser.add("--pred_path", type=path, required=True) parser.add("--gold_path", type=path, required=True) parser.add("--out_path", type=path, required=True) args = parser.parse_args() return args
# author: Jan Hybs # ---------------------------------------------- from __future__ import absolute_import import pathfix pathfix.init() # ---------------------------------------------- import sys # ---------------------------------------------- from scripts.core.base import Paths from utils.argparser import ArgParser from utils.duration import Duration from utils.timer import Timer from scripts.artifacts.artifacts import ArtifactProcessor # ---------------------------------------------- parser = ArgParser("runtest.py [<parametes>] [<test set>] [-- <test arguments>]") # ---------------------------------------------- parser.add_section('General arguments') parser.add('-a', '--keep-going', type=True, name='keep_going', docs=[ 'Run all tests, do not stop on the first error.', 'In PBS mode this arguments is ignored.', ]) parser.add('-v', '--valgrind', type=[True, str], name='valgrind', placeholder='[<VALGRIND ARGS>]', docs=[ 'Run tests under valgrind, with python suppression with optional argument', ' <valgrind args> passed to the valgrind. (In PBS mode this arguments is ignored.)?', ]) parser.add('-p', '--parallel', type=int, name='parallel', default=1, placeholder='<N>', docs=[ 'Run at most N jobs in parallel.', 'In PBS mode this arguments is ignored.', ]) parser.add('', '--batch', type=True, name='batch', docs=[
def parse_args(): parser = ArgParser(allow_config=True) parser.add("--ckpt_path", type=path, required=True) parser.add("--feats_path", type=path, action="append", required=True) parser.add("--feats_vocab", type=path, action="append", required=True) parser.add("--labels_vocab", type=path, required=True) parser.add("--sent_tags", action="store_true", default=False) parser.add("--save_dir", type=path, required=True) parser.add("--batch_size", type=int, default=32) parser.add("--max_length", type=int, default=1e10) parser.add("--gpu", action="store_true", default=False) group = parser.add_group("Model Parameters") group.add("--word_dim", type=int, action="append", required=True) group.add("--hidden_dim", type=int, required=True) args = parser.parse_args() return args
#!/usr/bin/python # -*- coding: utf-8 -*- # author: Jan Hybs # ---------------------------------------------- from __future__ import absolute_import import pathfix; pathfix.init() # ---------------------------------------------- import sys # ---------------------------------------------- from scripts.core.base import Paths from utils.argparser import ArgParser from utils.duration import Duration parser = ArgParser("exec_with_limit.py [-t <time>] [-m <memory>] -- <executable> <arguments>") # ---------------------------------------------- parser.add('-t', '--limit-time', type=Duration.parse, name='time_limit', placeholder='<time>', docs=[ 'Obligatory wall clock time limit for execution in seconds or in HH:MM:SS format.', 'For precision use float value' ]) parser.add('-m', '--limit-memory', type=float, name='memory_limit', placeholder='<memory>', docs=[ 'Optional memory limit per node in MB', 'For precision use float value' ]) parser.add('', '--batch', type=True, name='batch', docs=[ 'Make output of this script more for an off-line reading', 'In batch mode, stdout and stderr from executed processes will be printed, not saved' ]) # ---------------------------------------------- if __name__ == '__main__':
#!/usr/bin/python # -*- coding: utf-8 -*- # author: Jan Hybs # ---------------------------------------------- from __future__ import absolute_import import pathfix; pathfix.init() # ---------------------------------------------- import sys # ---------------------------------------------- from scripts.core.base import Paths, GlobalResult from utils.argparser import ArgParser from utils.duration import Duration # ---------------------------------------------- parser = ArgParser("exec_parallel.py <parameters> -- <executable> <executable arguments>") # ---------------------------------------------- parser.add_section('General arguments') parser.add('-n', '--cpu', type=list, name='cpu', default=[1], placeholder='<cpu>', docs=[ 'Run executable in <cpu> processes', ]) parser.add('-q', '--queue', type=[True, str], name='queue', placeholder='[<queue>]', docs=[ 'Optional PBS queue name to use. If the parameter is not used, ', 'the application is executed in the same process and without PBS.', '', 'If used without <queue> argument it is executed in the ', 'background preferably under PBS with the queue selected ', 'automatically for the given wall clock time limit and number of processes.' ]) parser.add('', '--host', type=str, name='host', placeholder='<host>', docs=[ 'Name of the running host that is used to select system ',
def parse_args(): parser = ArgParser(allow_config=True) parser.add("--name", type=str, default="main") parser.add("--feats_path", type=path, action="append", required=True) parser.add("--feats_vocab", type=path, action="append", required=True) parser.add("--labels_path", type=path, required=True) parser.add("--labels_vocab", type=path, required=True) parser.add("--save_dir", type=path, required=True) parser.add("--gpu", action="store_true", default=False) parser.add("--n_previews", type=int, default=10) group = parser.add_group("Word Embedding Options") group.add("--wordembed_type", type=str, action="append", choices=["glove", "fasttext", "none"]) group.add("--wordembed_path", type=path, action="append") group.add("--fasttext_path", type=path, default=None) group.add("--wordembed_freeze", type=bool, action="append") group = parser.add_group("Training Options") group.add("--n_epochs", type=int, default=3) group.add("--dropout_prob", type=float, default=0.05) group.add("--batch_size", type=int, default=32) group.add("--max_len", type=int, default=30) group.add("--lr", type=float, default=0.001) group = parser.add_group("Save Options") group.add("--save", action="store_true", default=False) group.add("--save_period", type=int, default=1000) group = parser.add_group("Validation Options") group.add("--val", action="store_true", default=False) group.add("--val_period", type=int, default=100) group.add("--text_preview", action="store_true", default=False) group.add("--val_feats_path", type=path, action="append") group.add("--val_labels_path", type=path, default=None) group = parser.add_group("Visdom Options") group.add("--visdom_host", type=str, default="localhost") group.add("--visdom_port", type=int, default=8097) group.add("--visdom_buffer_size", type=int, default=10) group = parser.add_group("Model Parameters") group.add("--word_dim", type=int, action="append") group.add("--hidden_dim", type=int, required=True) args = parser.parse_args() return args