本文整理汇总了Python中configargparse.getArgumentParser方法的典型用法代码示例。如果您正苦于以下问题:Python configargparse.getArgumentParser方法的具体用法?Python configargparse.getArgumentParser怎么用?Python configargparse.getArgumentParser使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类configargparse
的用法示例。
在下文中一共展示了configargparse.getArgumentParser方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: load_config
# 需要导入模块: import configargparse [as 别名]
# 或者: from configargparse import getArgumentParser [as 别名]
def load_config():
base_dir = os.path.abspath(os.path.join(os.path.dirname(__file__), os.pardir))
default_config = os.path.join(base_dir, 'config.ini')
p = configargparse.getArgumentParser(default_config_files=[default_config])
p.add('-c', '--config', required=False, is_config_file=True, help='config file path')
p.add_argument('-d', '--working_directory', type=str, default='.', help='the main working directory - all paths/files are relative to this')
p.add_argument('-s', '--issuer', type=str, help='the name of the institution to (added in certificate metadata)')
p.add_argument('-a', '--issuing_address', type=str, help='the issuing address with enough funds for the transaction; assumed to be imported in local node wallet')
p.add_argument('-x', '--expiry_date', type=str, help='absolute expiry date up until the certificates will be valid')
p.add_argument('-v', '--csv_file', type=str, default='graduates.csv', help='the csv file with the awardees\' data')
p.add_argument('-e', '--certificates_directory', type=str, default='certificates', help='the directory where the new certificates will be copied')
p.add_argument('-g', '--certificates_global_fields', type=str, default='', help='certificates global fields expressed as JSON strings')
p.add_argument('-f', '--cert_names_csv_column', type=str, default='name', help='use this column from csv file for naming the certificates')
p.add_argument('-m', '--cert_metadata_columns', type=str, default='', help='the specified columns from the csv or global fields will be included as json metadata')
p.add_argument('-n', '--full_node_url', type=str, default='127.0.0.1:18332', help='the url of the full node to use')
p.add_argument('-u', '--full_node_rpc_user', type=str, help='the rpc user as specified in the node\'s configuration')
p.add_argument('-w', '--full_node_rpc_password', type=str, help='the rpc password as specified in the node\'s configuration')
p.add_argument('-t', '--testnet', action='store_true', help='specify if testnet or mainnet will be used')
p.add_argument('-f', '--tx_fee_per_byte', type=int, default=100, help='the fee per transaction byte in satoshis')
p.add_argument('-p', '--issuer_identifier', type=str, default=' ', help='optional 8 bytes identifier that represents the issuer intented to go on the blockchain')
p.add_argument('-r', '--verify_issuer', type=str, default='{ "methods": [] }',
help='Which verification methods to use to validate the issuer')
args, _ = p.parse_known_args()
return args
示例2: load_config
# 需要导入模块: import configargparse [as 别名]
# 或者: from configargparse import getArgumentParser [as 别名]
def load_config():
base_dir = os.path.abspath(os.path.join(os.path.dirname(__file__), os.pardir))
default_config = os.path.join(base_dir, 'config.ini')
p = configargparse.getArgumentParser(default_config_files=[default_config])
p.add('-c', '--config', required=False, is_config_file=True, help='config file path')
p.add_argument('-d', '--working_directory', type=str, default='.', help='the main working directory - all paths/files are relative to this')
p.add_argument('-i', '--pdf_cert_template_file', type=str, default='cert_template.pdf', help='the pdf certificate form to populate')
p.add_argument('-s', '--issuer', type=str, help='the name of the institution to (added in certificate metadata)')
p.add_argument('-a', '--issuing_address', type=str, help='the issuing address with enough funds for the transaction; assumed to be imported in local node wallet')
p.add_argument('-x', '--expiry_date', type=str, help='absolute expiry date up until the certificates will be valid')
p.add_argument('-v', '--csv_file', type=str, default='graduates.csv', help='the csv file with the awardees\' data')
p.add_argument('-e', '--certificates_directory', type=str, default='certificates', help='the directory where the new certificates will be copied')
p.add_argument('-g', '--certificates_global_fields', type=str, default='', help='certificates global fields expressed as JSON string')
p.add_argument('-f', '--cert_names_csv_column', type=str, default='name', help='use this column from csv file for naming the certificates')
p.add_argument('-m', '--cert_metadata_columns', type=str, default='name,degree,grade', help='the specified columns from the csv or global fields will be included as json metadata')
p.add_argument('-n', '--full_node_url', type=str, default='127.0.0.1:18332', help='the url of the full node to use')
p.add_argument('-u', '--full_node_rpc_user', type=str, help='the rpc user as specified in the node\'s configuration')
p.add_argument('-w', '--full_node_rpc_password', type=str, help='the rpc password as specified in the node\'s configuration')
p.add_argument('-t', '--testnet', action='store_true', help='specify if testnet or mainnet will be used')
p.add_argument('-f', '--tx_fee_per_byte', type=int, default=100, help='the fee per transaction byte in satoshis')
p.add_argument('-p', '--issuer_identifier', type=str, default=' ', help='optional 8 bytes identifier that represents the issuer intented to go on the blockchain')
p.add_argument('-r', '--verify_issuer', type=str, default='{ "methods": [] }',
help='Which verification methods to use to validate the issuer')
args, _ = p.parse_known_args()
return args
示例3: load_config
# 需要导入模块: import configargparse [as 别名]
# 或者: from configargparse import getArgumentParser [as 别名]
def load_config():
base_dir = os.path.abspath(os.path.join(os.path.dirname(__file__), os.pardir))
default_config = os.path.join(base_dir, 'config.ini')
p = configargparse.getArgumentParser(
description='Allows to revoke certificates or complete batches or '
'even future uses of issuing addresses. All revoked '
'certificates need to be part of the same transaction.',
default_config_files=[default_config])
p.add('-c', '--config', required=False, is_config_file=True, help='config file path')
group = p.add_mutually_exclusive_group(required='True')
group.add_argument('-s', '--address', action='store_true', help='revoke the issuing_address (from config file)')
group.add_argument('-b', '--batch', type=str, help='revoke a whole batch identified by its transaction id')
group.add_argument('-p', nargs='+', help='a list of certificate pdf files to revoke')
p.add_argument('-d', '--working_directory', type=str, default='.', help='the main working directory - all paths/files are relative to this')
p.add_argument('-a', '--issuing_address', type=str, help='the issuing address with enough funds for the transaction; assumed to be imported in local node wallet')
p.add_argument('-n', '--full_node_url', type=str, default='127.0.0.1:18332', help='the url of the full node to use')
p.add_argument('-u', '--full_node_rpc_user', type=str, help='the rpc user as specified in the node\'s configuration')
p.add_argument('-w', '--full_node_rpc_password', type=str, help='the rpc password as specified in the node\'s configuration')
p.add_argument('-t', '--testnet', action='store_true', help='specify if testnet or mainnet will be used')
p.add_argument('-f', '--tx_fee_per_byte', type=int, default=100, help='the fee per transaction byte in satoshis')
args, _ = p.parse_known_args()
return args
示例4: get_config
# 需要导入模块: import configargparse [as 别名]
# 或者: from configargparse import getArgumentParser [as 别名]
def get_config():
cwd = os.getcwd()
p = configargparse.getArgumentParser(default_config_files=[os.path.join(cwd, 'conf.ini')])
p.add('-c', '--my-config', required=True, is_config_file=True, help='config file path')
p.add_argument('--data_dir', type=str, help='where data files are located')
p.add_argument('-k', '--issuer_public_key', type=str, required=True, help='The key(s) an issuer uses to sign Assertions. See https://openbadgespec.org/#Profile for more details')
p.add_argument('-k', '--public_key_created', type=str, help='ISO8601-formatted date the issuer public key should be considered active')
p.add_argument('-r', '--revocation_list_uri', type=str, required=True, help='URI of the Revocation List used for marking revocation. See https://openbadgespec.org/#Profile for more details')
p.add_argument('-d', '--issuer_id', type=str, required=True, help='the issuer\'s publicly accessible identification file; i.e. URL of the file generated by this tool')
p.add_argument('-u', '--issuer_url', type=str, help='the issuer\'s main URL address')
p.add_argument('-n', '--issuer_name', type=str, help='the issuer\'s name')
p.add_argument('-e', '--issuer_email', type=str, help='the issuer\'s email')
p.add_argument('-m', '--issuer_logo_file', type=str, help='the issuer\' logo image')
p.add_argument('-i', '--intro_url', required=False, type=str, help='the issuer\'s introduction URL address')
p.add_argument('-o', '--output_file', type=str, help='the output file to save the issuer\'s identification file')
args, _ = p.parse_known_args()
args.abs_data_dir = os.path.abspath(os.path.join(cwd, args.data_dir))
return args
示例5: get_config
# 需要导入模块: import configargparse [as 别名]
# 或者: from configargparse import getArgumentParser [as 别名]
def get_config():
cwd = os.getcwd()
p = configargparse.getArgumentParser(default_config_files=[os.path.join(cwd, 'conf.ini')])
p.add('-c', '--my-config', required=False, is_config_file=True, help='config file path')
p.add_argument('--data_dir', type=str, help='where data files are located')
p.add_argument('--issuer_certs_url', type=str, help='issuer certificates URL')
p.add_argument('--template_dir', type=str, help='the template output directory')
p.add_argument('--template_file_name', type=str, help='the template file name')
p.add_argument('--hash_emails', action='store_true',
help='whether to hash emails in the certificate')
p.add_argument('--additional_per_recipient_fields', action=helpers.make_action('per_recipient_fields'), help='additional per-recipient fields')
p.add_argument('--unsigned_certificates_dir', type=str, help='output directory for unsigned certificates')
p.add_argument('--roster', type=str, help='roster file name')
args, _ = p.parse_known_args()
args.abs_data_dir = os.path.abspath(os.path.join(cwd, args.data_dir))
return args
示例6: get_config
# 需要导入模块: import configargparse [as 别名]
# 或者: from configargparse import getArgumentParser [as 别名]
def get_config():
cwd = os.getcwd()
p = configargparse.getArgumentParser(default_config_files=[os.path.join(cwd, 'conf.ini')])
p.add('-c', '--my-config', required=False, is_config_file=True, help='config file path')
p.add_argument('--data_dir', type=str, help='where data files are located')
p.add_argument('--template_dir', type=str, help='the template output directory')
p.add_argument('--template_file_name', type=str, help='the template file name')
p.add_argument('--additional_per_recipient_fields', action=helpers.make_action('per_recipient_fields'), help='additional per-recipient fields')
p.add_argument('--unsigned_certificates_dir', type=str, help='output directory for unsigned certificates')
p.add_argument('--roster', type=str, help='roster file name')
p.add_argument('--filename_format', type=str, help='how to format certificate filenames (one of certname_identity or uuid)')
p.add_argument('--no_clobber', action='store_true', help='whether to overwrite existing certificates')
args, _ = p.parse_known_args()
args.abs_data_dir = os.path.abspath(os.path.join(cwd, args.data_dir))
return args
开发者ID:blockchain-certificates,项目名称:cert-tools,代码行数:19,代码来源:instantiate_v3_alpha_certificate_batch.py
示例7: get_config
# 需要导入模块: import configargparse [as 别名]
# 或者: from configargparse import getArgumentParser [as 别名]
def get_config():
base_dir = os.path.abspath(os.path.join(os.path.dirname(__file__), os.pardir))
p = configargparse.getArgumentParser(default_config_files=[os.path.join(base_dir, 'conf.ini')])
p.add('-c', '--my-config', required=True, is_config_file=True, help='config file path')
p.add_argument('-k', '--issuer_address', type=str, required=True, help='the issuer\'s Bitcoin address that will be used to issue the certificates')
p.add_argument('-r', '--revocation_address', type=str, required=True, help='the issuer\'s Bitcoin revocation address that can be used to revocate the certificates')
p.add_argument('-d', '--issuer_id', type=str, required=True, help='the issuer\'s publicly accessible identification file; i.e. URL of the file generated by this tool')
p.add_argument('-u', '--issuer_url', type=str, help='the issuers main URL address')
p.add_argument('-l', '--issuer_certs_url', type=str, help='the issuer\'s URL address of the certificates')
p.add_argument('-n', '--issuer_name', type=str, help='the issuer\'s name')
p.add_argument('-e', '--issuer_email', type=str, help='the issuer\'s email')
p.add_argument('-m', '--issuer_logo_file', type=str, help='the issuer\' logo image')
p.add_argument('-o', '--output_file', type=str, help='the output file to save the issuer\'s identification file')
args, _ = p.parse_known_args()
return args
示例8: get_config
# 需要导入模块: import configargparse [as 别名]
# 或者: from configargparse import getArgumentParser [as 别名]
def get_config():
base_dir = os.path.abspath(os.path.join(os.path.dirname(__file__), os.pardir))
p = configargparse.getArgumentParser(default_config_files=[os.path.join(base_dir, 'conf.ini')])
p.add('-c', '--my-config', required=False, is_config_file=True, help='config file path')
p.add_argument('-k', '--extended_public_key', type=str, required=True,
help='the HD extended public key used to generate the revocation addresses')
p.add_argument('-p', '--key_path', type=str,
help='the key path used to derive the child key under which the addresses will be generated')
p.add_argument('-n', '--number_of_addresses', type=int, default=10,
help='the number of revocation addresses to generate')
p.add_argument('-o', '--output_file', type=str, help='the output file to save the revocation addresses')
p.add_argument('-u', '--use_uncompressed', action='store_true', default=False,
help='whether to use uncompressed bitcoin addresses')
args, _ = p.parse_known_args()
return args
示例9: get_config
# 需要导入模块: import configargparse [as 别名]
# 或者: from configargparse import getArgumentParser [as 别名]
def get_config():
cwd = os.getcwd()
config_file_path = os.path.join(cwd, 'conf.ini')
p = configargparse.getArgumentParser(default_config_files=[config_file_path])
p.add('-c', '--my-config', required=False, is_config_file=True, help='config file path')
p.add_argument('--data_dir', type=str, help='where data files are located')
p.add_argument('--issuer_url', type=str, help='issuer URL')
p.add_argument('--issuer_id', required=True, type=str, help='issuer profile')
p.add_argument('--template_dir', type=str, help='the template output directory')
p.add_argument('--template_file_name', type=str, help='the template file name')
p.add_argument('--additional_global_fields', action=helpers.make_action('global_fields'),
help='additional global fields')
p.add_argument('--additional_per_recipient_fields', action=helpers.make_action('per_recipient_fields'),
help='additional per-recipient fields')
args, _ = p.parse_known_args()
args.abs_data_dir = os.path.abspath(os.path.join(cwd, args.data_dir))
return args
示例10: get_config
# 需要导入模块: import configargparse [as 别名]
# 或者: from configargparse import getArgumentParser [as 别名]
def get_config():
configure_logger()
p = configargparse.getArgumentParser(default_config_files=[os.path.join(PATH, 'conf.ini'),
'/etc/cert-issuer/conf.ini'])
add_arguments(p)
parsed_config, _ = p.parse_known_args()
if not parsed_config.safe_mode:
logging.warning('Your app is configured to skip the wifi check when the USB is plugged in. Read the '
'documentation to ensure this is what you want, since this is less secure')
# overwrite with enum
parsed_config.chain = Chain.parse_from_chain(parsed_config.chain)
# ensure it's a supported chain
if parsed_config.chain.blockchain_type != BlockchainType.bitcoin and \
parsed_config.chain.blockchain_type != BlockchainType.ethereum and \
parsed_config.chain.blockchain_type != BlockchainType.mock:
raise UnknownChainError(parsed_config.chain.name)
logging.info('This run will try to issue on the %s chain', parsed_config.chain.name)
if parsed_config.chain.blockchain_type == BlockchainType.bitcoin:
bitcoin_chain_for_python_bitcoinlib = parsed_config.chain
if parsed_config.chain == Chain.bitcoin_regtest:
bitcoin_chain_for_python_bitcoinlib = Chain.bitcoin_regtest
bitcoin.SelectParams(chain_to_bitcoin_network(bitcoin_chain_for_python_bitcoinlib))
global CONFIG
CONFIG = parsed_config
return parsed_config
示例11: load_config
# 需要导入模块: import configargparse [as 别名]
# 或者: from configargparse import getArgumentParser [as 别名]
def load_config():
base_dir = os.path.abspath(os.path.join(os.path.dirname(__file__), os.pardir))
default_config = os.path.join(base_dir, 'config.ini')
p = configargparse.getArgumentParser(default_config_files=[default_config])
p.add('-c', '--config', required=False, is_config_file=True, help='config file path')
p.add_argument('-d', '--working_directory', type=str, default='.', help='the main working directory - all paths/files are relative to this')
p.add_argument('-a', '--issuing_address', type=str, help='the issuing address with enough funds for the transaction; assumed to be imported in local node wallet')
p.add_argument('-n', '--full_node_url', type=str, default='127.0.0.1:18332', help='the url of the full node to use')
p.add_argument('-u', '--full_node_rpc_user', type=str, help='the rpc user as specified in the node\'s configuration')
p.add_argument('-t', '--testnet', action='store_true', help='specify if testnet or mainnet will be used')
p.add_argument('-f', '--tx_fee_per_byte', type=int, default=100, help='the fee per transaction byte in satoshis')
args, _ = p.parse_known_args()
return args
# used primarily for testing
示例12: load_config
# 需要导入模块: import configargparse [as 别名]
# 或者: from configargparse import getArgumentParser [as 别名]
def load_config():
base_dir = os.path.abspath(os.path.join(os.path.dirname(__file__), os.pardir))
default_config = os.path.join(base_dir, 'config.ini')
p = configargparse.getArgumentParser(default_config_files=[default_config])
p.add_argument('-c', '--config', required=False, is_config_file=True, help='config file path')
p.add_argument('-t', '--testnet', action='store_true', help='specify if testnet or mainnet will be used')
p.add_argument('-u', '--full_node_rpc_user', type=str, help='the rpc user as specified in the node\'s configuration')
p.add_argument('-w', '--full_node_rpc_password', type=str, help='the rpc password as specified in the node\'s configuration')
p.add_argument('-p', '--issuer_identifier', type=str, help='optional 8 bytes issuer code to be displayed in the blockchain')
p.add_argument('-b', '--blockchain_services', type=str,
default='{ "services": [ {"blockcypher":{} } ], "required_successes": 1}',
help='Which blockchain services to use and the minimum required successes')
p.add_argument('-f', nargs='+', help='a list of certificate pdf files to validate')
args, _ = p.parse_known_args()
return args
示例13: get_config
# 需要导入模块: import configargparse [as 别名]
# 或者: from configargparse import getArgumentParser [as 别名]
def get_config():
cwd = os.getcwd()
p = configargparse.getArgumentParser(default_config_files=[os.path.join(cwd, 'conf.ini')])
p.add('-c', '--my-config', required=False, is_config_file=True, help='config file path')
p.add_argument('--data_dir', type=str, help='where data files are located')
p.add_argument('--issuer_logo_file', type=str, help='issuer logo image file, png format')
p.add_argument('--issuer_signature_file', type=str, help='issuer signature image file, png format')
p.add_argument('--cert_image_file', type=str, help='issuer logo image file, png format')
p.add_argument('--issuer_url', type=str, help='issuer URL')
p.add_argument('--issuer_certs_url', type=str, help='issuer certificates URL')
p.add_argument('--issuer_email', type=str, help='issuer email')
p.add_argument('--issuer_name', type=str, help='issuer name')
p.add_argument('--issuer_id', type=str, help='path to issuer public keys')
p.add_argument('--certificate_language', type=str, required=False, help='certificate language')
p.add_argument('--certificate_description', type=str, help='the display description of the certificate')
p.add_argument('--certificate_title', type=str, help='the title of the certificate')
p.add_argument('--template_dir', type=str, help='the template output directory')
p.add_argument('--template_file_name', type=str, help='the template file name')
p.add_argument('--hash_emails', action='store_true',
help='whether to hash emails in the certificate')
p.add_argument('--additional_global_fields', action=helpers.make_action('global_fields'),
help='additional global fields')
p.add_argument('--additional_per_recipient_fields', action=helpers.make_action('per_recipient_fields'),
help='additional per-recipient fields')
args, _ = p.parse_known_args()
args.abs_data_dir = os.path.abspath(os.path.join(cwd, args.data_dir))
return args
示例14: get_config
# 需要导入模块: import configargparse [as 别名]
# 或者: from configargparse import getArgumentParser [as 别名]
def get_config():
base_dir = os.path.abspath(os.path.join(os.path.dirname(__file__), os.pardir))
p = configargparse.getArgumentParser(default_config_files=[os.path.join(base_dir, 'conf.ini')])
p.add('-c', '--my-config', required=False, is_config_file=True, help='config file path')
p.add_argument('-p', '--cert_path', type=str, required=True,
help='Path to certificates')
p.add_argument('-u', '--url_prefix', type=str,
help='URL prefix')
p.add_argument('-o', '--output_path', type=str,
help='Path to output file')
args, _ = p.parse_known_args()
return args
示例15: get_config
# 需要导入模块: import configargparse [as 别名]
# 或者: from configargparse import getArgumentParser [as 别名]
def get_config():
cwd = os.getcwd()
config_file_path = os.path.join(cwd, 'conf.ini')
p = configargparse.getArgumentParser(default_config_files=[config_file_path])
p.add('-c', '--my-config', required=False, is_config_file=True, help='config file path')
p.add_argument('--data_dir', type=str, help='where data files are located')
p.add_argument('--issuer_logo_file', type=str, help='issuer logo image file, png format')
p.add_argument('--cert_image_file', type=str, help='issuer logo image file, png format')
p.add_argument('--issuer_url', type=str, help='issuer URL')
p.add_argument('--issuer_certs_url', type=str, help='issuer certificates URL')
p.add_argument('--issuer_email', required=True, type=str, help='issuer email')
p.add_argument('--issuer_name', required=True, type=str, help='issuer name')
p.add_argument('--issuer_id', required=True, type=str, help='issuer profile')
p.add_argument('--issuer_key', type=str, help='issuer issuing key')
p.add_argument('--certificate_description', type=str, help='the display description of the certificate')
p.add_argument('--certificate_title', required=True, type=str, help='the title of the certificate')
p.add_argument('--criteria_narrative', required=True, type=str, help='criteria narrative')
p.add_argument('--template_dir', type=str, help='the template output directory')
p.add_argument('--template_file_name', type=str, help='the template file name')
p.add_argument('--hash_emails', action='store_true',
help='whether to hash emails in the certificate')
p.add_argument('--revocation_list', type=str, help='issuer revocation list')
p.add_argument('--issuer_public_key', type=str, help='issuer public key')
p.add_argument('--badge_id', required=True, type=str, help='badge id')
p.add_argument('--issuer_signature_lines', action=helpers.make_action('issuer_signature_lines'),
help='issuer signature lines')
p.add_argument('--additional_global_fields', action=helpers.make_action('global_fields'),
help='additional global fields')
p.add_argument('--additional_per_recipient_fields', action=helpers.make_action('per_recipient_fields'),
help='additional per-recipient fields')
p.add_argument('--display_html', type=str, help='html content to display')
args, _ = p.parse_known_args()
args.abs_data_dir = os.path.abspath(os.path.join(cwd, args.data_dir))
return args