def _retrieve_options() -> List[click.option]: return [ click.option( "--results/--no-results", "include_results", default=False, help="Whether to also pull down any available results.", show_default=True, ), optgroup.group("Job submission", help="Options for generating job submission scripts."), optgroup.option( "--conda-environment", default="forcebalance", type=click.STRING, help="The conda environment to run within.", show_default=True, ), optgroup.option( "--max-time", default="168:00", type=click.STRING, help="The maximum wall-clock time for submissions.", show_default=True, ), optgroup.group( "Evaluator configuration", help="Configuration options for the OpenFF Evaluator.", ), optgroup.option( "--preset", "evaluator_preset", default="lilac-dask", type=click.Choice(["lilac-dask", "lilac-local"], case_sensitive=True), help="The present evaluator compute settings to use.", show_default=True, ), optgroup.option( "--port", "evaluator_port", default=8000, type=click.INT, help="The port to run the evaluator server on.", show_default=True, ), optgroup.option( "--workers", "n_evaluator_workers", default=1, type=click.INT, help="The target number of evaluator compute workers to spawn.\n" "\n" "The actual number may be less than this if the specified compute backend " "supports elastic scaling of workers depending on the amount of available " "work.", show_default=True, ), ]
def _run_options(): return [ click.option( "--restart", default=False, type=click.BOOL, help= "Whether to restart the optimization from where it left off.\nIf " "false any existing results will be removed / overwritten.", show_default=True, ), optgroup.group( "Evaluator configuration", help="Configuration options for the OpenFF Evaluator.", ), optgroup.option( "--config", "server_config", default="server-config.json", type=click.Path(exists=False, dir_okay=False), help="The path to the OpenFF Evaluator server configuration file.", show_default=True, ), ]
def __init__(self, name: Optional[str] = None, *, help: Optional[str] = None, cls: Optional[Type[OptionGroup]] = None, **kwargs): super().__init__() self._cls = cls self._callbacks.append( lambda: optgroup.group(name, help=help, cls=cls, **kwargs))
def _analyse_options() -> List[click.option]: return [ optgroup.group( "Backwards compatibility", help="Options to allow for backwards compatibility with previous results.", ), optgroup.option( "--reindex", is_flag=True, default=False, help="Attempt to determine matching reference and estimated data points " "based on the state at which the property was measured, rather than by its " "unique id. This option is only to allow backwards compatibility with " "optimizations ran not using this framework, and should not be used in " "general.", ), ]
def wrapper(command): command = ( click.option( "-b", "--backend", type=click.Choice(backend_names), required=True, help="Backend", ) )(command) for backend_name in backend_names: backend_class = get_class_from_name(backend_name, backends) for parameter in signature(backend_class.__init__).parameters.values(): if parameter.name == "self": continue option = f"--{backend_class.name}-{parameter.name}".replace("_", "-") envvar = ( f"{ENVVAR_PREFIX}_{backend_class.name}_{parameter.name}".upper() ) option_kwargs = {} # If the parameter is a boolean, convert it to a flag option if parameter.annotation is bool: option = ( f"{option}/--no-{backend_class.name}-{parameter.name}".replace( "_", "-" ) ) option_kwargs["is_flag"] = True elif parameter.annotation is dict: option_kwargs["type"] = CommaSeparatedKeyValueParamType() command = ( optgroup.option( option, envvar=envvar, default=parameter.default, **option_kwargs, ) )(command) command = (optgroup.group(f"{backend_class.name} backend"))(command) command = (cli.command(name=name or command.__name__))(command) return command
def _plot_options() -> List[click.option]: return [ click.argument( "directories", nargs=-1, type=click.Path(exists=True), ), optgroup.group( "Output", help="Options for saving the plots.", ), optgroup.option( "--file-type", type=click.Choice(["pdf", "png"]), default="pdf", show_default=True, help="The file type to save the plots as.", ), ]
def _run_options(): return [ click.option( "--restart", default=True, type=click.BOOL, help= "Whether to restart the optimization from where it left off.\nIf " "false any existing results will be removed / overwritten.", show_default=True, ), optgroup.group( "Evaluator configuration", help="Configuration options for the OpenFF Evaluator.", ), optgroup.option( "--config", "server_config", default="server-config.json", type=click.Path(exists=True, dir_okay=False), help="The path to the OpenFF Evaluator server configuration file.", show_default=True, ), optgroup.option( "--options", "request_options", default="estimation-options.json", type=click.Path(exists=True, dir_okay=False), help="The path to the OpenFF Evaluator request options.", show_default=True, ), optgroup.option( "--polling-interval", default=600, type=click.INT, help= "The interval with which to check the progress of the benchmark (s).", show_default=True, ), ]
help='Set verbosity to info and show execution timings', envvar=defaults.MB_TIMINGS, default=defaults.DEFAULT_TIMINGS, is_flag=True, show_default=True, ) quiet_option = optgroup.option( '--quiet', '-q', help='Disable progress bars', envvar=defaults.MB_QUIET, default=defaults.DEFAULT_QUIET, is_flag=True, show_default=True, ) options = [ optgroup.group('Global options'), config_option, log_option, quiet_option, timings_option, optgroup('Verbosity', cls=MutuallyExclusiveOptionGroup), debug_option, info_option, warning_option, error_option, critical_option, ]
def custom_pipeline_options(name: str, *args, **kwargs): return optgroup.group(name=name, *args, **kwargs)
from click_option_group import optgroup option = optgroup.option pipeline_specific_options = optgroup.group( "Pipeline-specific options", help="Options specific to the pipeline being run") common_pipelines_options = optgroup.group( "Common pipelines options", help="Options common to all Clinica pipelines") advanced_pipeline_options = optgroup.group("Advanced pipeline options", help="For experts only") def custom_pipeline_options(name: str, *args, **kwargs): return optgroup.group(name=name, *args, **kwargs)
# Those options won't be passed to tipocket case. IGNORE_OPTION_LIST = [ 'image', 'subscriber', 'feature', 'cron', 'cron_schedule', 'description', ] # Those options would be passed to tipocket case, # except those in IGNORE_OPTION_LIST. COMMON_OPTIONS = ( # !!! remember to update params.IGNORE_OPTION_LIST when # a parameter is modified optgroup.group('Test case deploy options'), optgroup.option('--subscriber', multiple=True), optgroup.option('--feature', default='universal'), optgroup.option('--image', default="pingcap/tipocket"), optgroup.option('--description', default=''), optgroup.option('--cron/--not-cron', default=False), optgroup.option('--cron-schedule', default='30 17 * * *'), optgroup.group('Test case common options'), optgroup.option('--round', default='1'), optgroup.option('--client', default='5'), optgroup.option('--run-time', default='10m'), optgroup.option('--wait-duration', default='10m'), optgroup.option('--nemesis', default=''), optgroup.option('--purge/--no-purge', default=True), optgroup.option('--delns/--no-delns', 'delNS', default=True), optgroup.group('TiDB cluster options'),
import os from typing import Any, Optional, List, Dict, Iterable, Iterator import click import acoustid # type: ignore import mutagen # type: ignore from slugify import slugify from pydub import AudioSegment # type: ignore from click_option_group import optgroup # type: ignore from click_skeleton.helpers import mysplit from musicbot import defaults from musicbot.music.helpers import ensure logger = logging.getLogger(__name__) music_options_group = optgroup.group('Music options') keywords_option = optgroup.option('--keywords', help='Keywords', multiple=True) artist_option = optgroup.option('--artist', help='Artist') album_option = optgroup.option('--album', help='Album') title_option = optgroup.option('--title', help='Title') genre_option = optgroup.option('--genre', help='Genre') number_option = optgroup.option('--number', help='Track number') rating_option = optgroup.option('--rating', help='Rating') STOPWORDS = ['the', 'remaster', 'remastered', 'cut', 'part', 'version', 'mix', 'deluxe', 'edit', 'album', 'lp'] + list(map(str, range(1900, 2020))) REPLACEMENTS = [['praxis', 'buckethead'], ['lawson-rollins', 'buckethead']] keywords_argument = click.argument( 'keywords', nargs=-1, )
limit=limit, extensions=extensions, ) ctx.params[param.name] = folders return folders folder_argument = click.argument('folder', type=click.Path( path_type=Path, exists=True, file_okay=False, )) folders_argument = add_options( dry_option, optgroup.group("Folders options"), optgroup.option( '--limit', help="Limit number of music files", type=int, is_eager=True, ), optgroup.option( '--extension', 'extensions', help='Supported formats', default=sorted(DEFAULT_EXTENSIONS), multiple=True, callback=split_arguments, show_default=True, is_eager=True,
graphql_admin_option = optgroup.option( '--graphql-admin', help='GraphQL endpoint', default=defaults.DEFAULT_GRAPHQL_ADMIN, callback=config_string, show_default=True, ) graphql_admin_user_option = optgroup.option( '--graphql-admin-user', help='GraphQL admin user (basic auth)', default=defaults.DEFAULT_GRAPHQL_ADMIN_USER, callback=config_string, ) graphql_admin_password_option = optgroup.option( '--graphql-admin-password', help='GraphQL admin password (basic auth)', default=defaults.DEFAULT_GRAPHQL_ADMIN_PASSWORD, callback=config_string, ) options = [ optgroup.group('Admin options'), graphql_admin_option, optgroup.group('Basic auth', cls=AllOptionGroup), graphql_admin_user_option, graphql_admin_password_option, ]
import click from click_option_group import optgroup # type: ignore from click_skeleton import add_options from musicbot.cli.options import sane_list from musicbot.defaults import (DEFAULT_MAX_RATING, DEFAULT_MIN_RATING, DEFAULT_RATINGS) bests_options = add_options( optgroup.group("Bests options"), optgroup.option('--min-playlist-size', help="Minimum size of playlist to write", default=1), optgroup.option( '--rating', 'ratings', help="Generate bests for those ratings", default=DEFAULT_RATINGS, type=click.FloatRange(DEFAULT_MIN_RATING, DEFAULT_MAX_RATING, clamp=True), multiple=True, ), optgroup.option('--types', help="Type of bests playlists", default=["genre", "keyword", "rating", "artist"], multiple=True, callback=sane_list), )
shuffle_option = optgroup.option( '--shuffle', help='Randomize selection', default=defaults.DEFAULT_SHUFFLE, is_flag=True, is_eager=True, ) interleave_option = optgroup.option( '--interleave', help='Interleave tracks by artist', is_flag=True, ) ordering_options = [ optgroup.group('Ordering options'), shuffle_option, interleave_option, ] options = [ optgroup.group('Filter options'), optgroup.option( '--music-filter', help='Music Filter', expose_value=False, callback=sane_music_filter, hidden=True, ), optgroup.option( '--name',
pt = PrettyTable( ["Email", "Firstname", "Lastname", "Created at", "Updated at"]) for u in users: pt.add_row([ u["email"], u["user"]["firstName"], u["user"]["lastName"], u["user"]["createdAt"], u["user"]["updatedAt"] ]) print(pt) elif output == 'json': print(json.dumps(users)) @cli.command(aliases=['new', 'add', 'create'], help='Register a new user') @add_options( helpers.save_option, optgroup.group('Register options'), user_options.graphql_option, user_options.email_option, user_options.password_option, user_options.first_name_option, user_options.last_name_option, ) def register(save, email, password, **kwargs): user = User.register(email=email, password=password, **kwargs) if not user.token: logger.error('register failed') return if save: logger.info("saving user infos") Conf.config.configfile['musicbot']['email'] = email Conf.config.configfile['musicbot']['password'] = password
is_eager=True, callback=config_string, show_default=True, ) last_name_option = optgroup.option( '--last-name', help='User last name', default=defaults.DEFAULT_FIRST_NAME, is_eager=True, callback=config_string, show_default=True, ) graphql_option = optgroup.option( '--graphql', '-g', help='GraphQL endpoint', default=defaults.DEFAULT_GRAPHQL, is_eager=True, callback=config_string, show_default=True, ) options = [ optgroup.group('Auth options'), graphql_option, token_option, email_option, password_option, ]