Python click.STRING Examples
The following are 17
code examples of click.STRING().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
click
, or try the search function
.
Example #1
Source File: _options.py From dcos-e2e with Apache License 2.0 | 6 votes |
def vagrant_box_version_option(command: Callable[..., None], ) -> Callable[..., None]: """ An option decorator for the Vagrant Box version to use. """ backend = Vagrant() version_constraint_url = ( 'https://www.vagrantup.com/docs/boxes/versioning.html' '#version-constraints' ) function = click.option( '--vagrant-box-version', type=click.STRING, default=backend.vagrant_box_version, show_default=True, help=( 'The version of the Vagrant box to use. ' 'See {version_constraint_url} for details.' ).format(version_constraint_url=version_constraint_url), )(command) # type: Callable[..., None] return function
Example #2
Source File: quick.py From quick with GNU General Public License v3.0 | 6 votes |
def data(self, index, role=QtCore.Qt.DisplayRole): if role == QtCore.Qt.DisplayRole: dstr = QtGui.QStandardItemModel.data(self, index, role) if dstr == "" or dstr is None: if isinstance(self.type, click.types.Tuple): row = index.row() if 0 <= row < len(self.type.types): tp = self.type.types[row] dstr = tp.name else: dstr = self.type.name return dstr if role == _GTypeRole: tp = click.STRING if isinstance(self.type, click.types.Tuple): row = index.row() if 0 <= row < len(self.type.types): tp = self.type.types[row] elif isinstance(self.type, click.types.ParamType): tp = self.type return tp return QtGui.QStandardItemModel.data(self, index, role)
Example #3
Source File: token_ops.py From raiden-contracts with MIT License | 6 votes |
def common_options(func: Callable) -> Callable: """A decorator that combines commonly appearing @click.option decorators.""" @click.option( "--private-key", required=True, help="Path to a private key store.", type=click.STRING ) @click.option("--password", help="password file for the keystore json file", type=click.STRING) @click.option( "--rpc-url", default="http://127.0.0.1:8545", help="Address of the Ethereum RPC provider", type=click.STRING, ) @click.option( "--token-address", required=True, help="Address of the token contract", type=click.STRING ) @click.option( "--amount", required=True, help="Amount to mint/deposit/transfer", type=click.INT ) @click.option("--wait", default=300, help="Max tx wait time in s.", type=click.INT) @functools.wraps(func) def wrapper(*args: List, **kwargs: Dict) -> Any: return func(*args, **kwargs) return wrapper
Example #4
Source File: test_click2cwl.py From argparse2tool with Apache License 2.0 | 5 votes |
def prepare_argument_parser(): @click.command() @click.argument('keyword', type=click.STRING) @click.option('--choices', type=click.Choice(['md5', 'sha1'])) @click.option('--double-type', type=(str, int), default=(None, None)) def function(): pass return function
Example #5
Source File: cli.py From android_universal with MIT License | 5 votes |
def convert(self, value, param, ctx): try: return self.path_type(value, param, ctx) except click.BadParameter: value = click.STRING(value, param, ctx).lower() if value == 'adhoc': try: import OpenSSL except ImportError: raise click.BadParameter( 'Using ad-hoc certificates requires pyOpenSSL.', ctx, param) return value obj = import_string(value, silent=True) if sys.version_info < (2, 7): if obj: return obj else: if isinstance(obj, ssl.SSLContext): return obj raise
Example #6
Source File: main.py From fbchat-archive-parser with MIT License | 5 votes |
def common_options(f): f = click.option('-z', '--timezones', callback=validate_timezones, type=click.STRING, help='Timezone disambiguators (TZ=OFFSET,[TZ=OFFSET[...]])')(f) f = click.option('-u', '--utc', is_flag=True, help='Use UTC timestamps in the output')(f) f = click.option('-n', '--nocolor', is_flag=True, help='Do not colorize output')(f) f = click.option('-p', '--noprogress', is_flag=True, help='Do not show progress output')(f) f = click.option('-r', '--resolve', callback=collect_facebook_credentials, is_flag=True, help='[BETA] Resolve profile IDs to names by connecting to Facebook')(f) f = click.argument('path', type=click.File('rt', encoding='utf8'))(f) return f
Example #7
Source File: main.py From fbchat-archive-parser with MIT License | 5 votes |
def collect_facebook_credentials(ctx, param, value): if not value: return email = click.prompt(u"Facebook username/email", type=click.STRING) password = click.prompt( u"Facebook password", type=click.STRING, hide_input=True, confirmation_prompt=True) return FacebookNameResolver(email, password)
Example #8
Source File: _options.py From dcos-e2e with Apache License 2.0 | 5 votes |
def vagrant_box_url_option(command: Callable[..., None], ) -> Callable[..., None]: """ An option decorator for the Vagrant Box URL to use. """ backend = Vagrant() function = click.option( '--vagrant-box-url', type=click.STRING, default=backend.vagrant_box_url, show_default=True, help='The URL of the Vagrant box to use.', )(command) # type: Callable[..., None] return function
Example #9
Source File: quick.py From quick with GNU General Public License v3.0 | 5 votes |
def __init__(self, n, parent=None, opt_type=click.STRING, default=None): super(QtGui.QStandardItemModel, self).__init__(0, 1, parent) self.type = opt_type for row in range(n): if hasattr(default, "__len__"): self.insertRow(row, default[row]) else: self.insertRow(row, default)
Example #10
Source File: cli.py From fossor with BSD 2-Clause "Simplified" License | 5 votes |
def fossor_cli_flags(f): '''Add default Fossor CLI flags''' # Flags will appear in reverse order of how they are listed here: f = add_dynamic_args(f) # Must be applied after all other click options since this requires click's context object to be passed # Add normal flags csv_list = CsvList() f = click.option('--black-list', 'blacklist', type=csv_list, help='Do not run these plugins.')(f) f = click.option('--white-list', 'whitelist', type=csv_list, help='Only run these plugins.')(f) f = click.option('--truncate/--no-truncate', 'truncate', show_default=True, default=True, is_flag=True)(f) f = click.option('-v', '--verbose', is_flag=True)(f) f = click.option('-d', '--debug', is_flag=True, callback=setup_logging)(f) f = click.option('-t', '--time-out', 'timeout', show_default=True, default=600, help='Default timeout for plugins.')(f) f = click.option('--end-time', callback=set_end_time, help='Plugins may optionally implement and use this. Defaults to now.')(f) f = click.option('--start-time', callback=set_start_time, help='Plugins may optionally implement and use this.')(f) f = click.option('-r', '--report', type=click.STRING, show_default=True, default='StdOut', help='Report Plugin to run.')(f) f = click.option('--hours', type=click.INT, default=24, show_default=True, callback=set_relative_start_time, help='Sets start-time to X hours ago. Plugins may optionally implement and use this.')(f) f = click.option('--plugin-dir', default=default_plugin_dir, show_default=True, help=f'Import all plugins from this directory.')(f) f = click.option('-p', '--pid', type=click.INT, help='Pid to investigate.')(f) # Required for parsing dynamics arguments f = click.pass_context(f) f = click.command(context_settings=dict(ignore_unknown_options=True, allow_extra_args=True, help_option_names=['-h', '--help']))(f) return f
Example #11
Source File: cli.py From scylla with Apache License 2.0 | 5 votes |
def convert(self, value, param, ctx): try: return self.path_type(value, param, ctx) except click.BadParameter: value = click.STRING(value, param, ctx).lower() if value == 'adhoc': try: import OpenSSL except ImportError: raise click.BadParameter( 'Using ad-hoc certificates requires pyOpenSSL.', ctx, param) return value obj = import_string(value, silent=True) if sys.version_info < (2, 7, 9): if obj: return obj else: if isinstance(obj, ssl.SSLContext): return obj raise
Example #12
Source File: cli.py From Building-Recommendation-Systems-with-Python with MIT License | 5 votes |
def convert(self, value, param, ctx): try: return self.path_type(value, param, ctx) except click.BadParameter: value = click.STRING(value, param, ctx).lower() if value == 'adhoc': try: import OpenSSL except ImportError: raise click.BadParameter( 'Using ad-hoc certificates requires pyOpenSSL.', ctx, param) return value obj = import_string(value, silent=True) if sys.version_info < (2, 7, 9): if obj: return obj else: if isinstance(obj, ssl.SSLContext): return obj raise
Example #13
Source File: cli.py From Building-Recommendation-Systems-with-Python with MIT License | 5 votes |
def convert(self, value, param, ctx): try: return self.path_type(value, param, ctx) except click.BadParameter: value = click.STRING(value, param, ctx).lower() if value == 'adhoc': try: import OpenSSL except ImportError: raise click.BadParameter( 'Using ad-hoc certificates requires pyOpenSSL.', ctx, param) return value obj = import_string(value, silent=True) if sys.version_info < (2, 7, 9): if obj: return obj else: if isinstance(obj, ssl.SSLContext): return obj raise
Example #14
Source File: cli.py From wakadump with BSD 3-Clause "New" or "Revised" License | 5 votes |
def check_output(ctx, param, value): if value == 'keen.io': ctx.params['project_id'] = click.prompt('keen.io Project ID', type=click.STRING) ctx.params['write_key'] = click.prompt('keen.io project Write Key', type=click.STRING, hide_input=True) elif value == 'csv': ctx.params['output_file'] = click.prompt('Output csv file', type=click.Path()) return value
Example #15
Source File: manage.py From zerodb-server with GNU Affero General Public License v3.0 | 5 votes |
def _auth_options(f, confirm_passphrase=True): """Decorator to enable username, passphrase and sock options to command""" @click.option( "--username", prompt="Username", default="root", type=click.STRING, help="Admin username") @click.option( "--passphrase", prompt="Passphrase", hide_input=True, confirmation_prompt=confirm_passphrase, type=click.STRING, help="Admin passphrase or hex private key") @click.option( "--sock", prompt="Sock", default="localhost:8001", type=click.STRING, help="Storage server socket (TCP or UNIX)") @click.option("--realm", default="ZERO", type=click.STRING, help="Authentication realm") @click.pass_context def auth_func(ctx, username, passphrase, sock, realm, *args, **kw): global _username global _passphrase global _sock global _realm _realm = str(realm) _username = str(username) _passphrase = str(passphrase) if sock.startswith("/"): _sock = sock else: sock = sock.split(":") _sock = (str(sock[0]), int(sock[1])) ctx.invoke(f, *args, **kw) return update_wrapper(auth_func, f)
Example #16
Source File: cli.py From recruit with Apache License 2.0 | 4 votes |
def convert(self, value, param, ctx): try: return self.path_type(value, param, ctx) except click.BadParameter: value = click.STRING(value, param, ctx).lower() if value == 'adhoc': try: import OpenSSL except ImportError: raise click.BadParameter( 'Using ad-hoc certificates requires pyOpenSSL.', ctx, param) return value obj = import_string(value, silent=True) if sys.version_info < (2, 7): if obj: return obj else: if isinstance(obj, ssl.SSLContext): return obj raise
Example #17
Source File: yatai_service.py From BentoML with Apache License 2.0 | 4 votes |
def add_yatai_service_sub_command(cli): # pylint: disable=unused-variable @cli.command(help='Start BentoML YataiService for model management and deployment') @click.option( '--db-url', type=click.STRING, help='Database URL following RFC-1738, and usually can include username, ' 'password, hostname, database name as well as optional keyword arguments ' 'for additional configuration', envvar='BENTOML_DB_URL', ) @click.option( '--repo-base-url', type=click.STRING, help='Base URL for storing BentoML saved bundle files, this can be a filesystem' 'path(POSIX/Windows), or a S3 URL, usually starting with "s3://"', envvar='BENTOML_REPO_BASE_URL', ) @click.option( '--grpc-port', type=click.INT, default=50051, help='Port to run YataiService gRPC server', envvar='BENTOML_GRPC_PORT', ) @click.option( '--ui-port', type=click.INT, default=3000, help='Port to run YataiService Web UI server', envvar='BENTOML_WEB_UI_PORT', ) @click.option( '--ui/--no-ui', default=True, help='Run YataiService with or without Web UI, when running with --no-ui, it ' 'will only run the gRPC server', envvar='BENTOML_ENABLE_WEB_UI', ) @click.option( '--s3-endpoint-url', type=click.STRING, help='S3 Endpoint URL is used for deploying with storage services that are ' 'compatible with Amazon S3, such as MinIO', envvar='BENTOML_S3_ENDPOINT_URL', ) def yatai_service_start( db_url, repo_base_url, grpc_port, ui_port, ui, s3_endpoint_url ): start_yatai_service_grpc_server( db_url, repo_base_url, grpc_port, ui_port, ui, s3_endpoint_url )