当前位置: 首页>>代码示例>>Python>>正文


Python completers.FilesCompleter方法代码示例

本文整理汇总了Python中argcomplete.completers.FilesCompleter方法的典型用法代码示例。如果您正苦于以下问题:Python completers.FilesCompleter方法的具体用法?Python completers.FilesCompleter怎么用?Python completers.FilesCompleter使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在argcomplete.completers的用法示例。


在下文中一共展示了completers.FilesCompleter方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: _get_arg_parser

# 需要导入模块: from argcomplete import completers [as 别名]
# 或者: from argcomplete.completers import FilesCompleter [as 别名]
def _get_arg_parser(self, doc_parser=False):
        description = textwrap.dedent(__doc__)

        examples = textwrap.dedent('''
            mdt-info-protocol my_protocol.prtcl
           ''')
        epilog = self._format_examples(doc_parser, examples)

        parser = argparse.ArgumentParser(description=description, epilog=epilog,
                                         formatter_class=argparse.RawTextHelpFormatter)

        parser.add_argument('protocol',
                            action=mdt.lib.shell_utils.get_argparse_extension_checker(['.prtcl']),
                            help='the protocol file').completer = FilesCompleter(['prtcl'], directories=False)

        return parser 
开发者ID:robbert-harms,项目名称:MDT,代码行数:18,代码来源:mdt_info_protocol.py

示例2: _get_arg_parser

# 需要导入模块: from argcomplete import completers [as 别名]
# 或者: from argcomplete.completers import FilesCompleter [as 别名]
def _get_arg_parser(self, doc_parser=False):
        description = textwrap.dedent(__doc__)

        examples = textwrap.dedent('''
            mdt-create-bvec-bval my_protocol.prtcl
            mdt-create-bvec-bval my_protocol.prtcl bvec_name.bvec bval_name.bval
        ''')
        epilog = self._format_examples(doc_parser, examples)

        parser = argparse.ArgumentParser(description=description, epilog=epilog,
                                         formatter_class=argparse.RawTextHelpFormatter)

        parser.add_argument('protocol', help='the protocol file').completer = FilesCompleter()
        parser.add_argument('bvec', help="the output bvec file", nargs='?', default=None).completer = FilesCompleter()
        parser.add_argument('bval', help="the output bvec file", nargs='?', default=None).completer = FilesCompleter()

        return parser 
开发者ID:robbert-harms,项目名称:MDT,代码行数:19,代码来源:mdt_create_bvec_bval.py

示例3: _get_arg_parser

# 需要导入模块: from argcomplete import completers [as 别名]
# 或者: from argcomplete.completers import FilesCompleter [as 别名]
def _get_arg_parser(self, doc_parser=False):
        description = textwrap.dedent(__doc__)

        parser = argparse.ArgumentParser(description=description, formatter_class=argparse.RawTextHelpFormatter)
        parser.add_argument('items', metavar='items', type=str, nargs='*', help='the directory or file(s)',
                            default=None).completer = FilesCompleter()

        parser.add_argument('-c', '--config', type=str,
                            help='Use the given initial configuration').completer = \
            FilesCompleter(['conf'], directories=False)

        parser.add_argument('-m', '--maximize', action='store_true', help="Maximize the shown window")
        parser.add_argument('--to-file', type=str, help="If set, export the figure to the given filename")

        parser.add_argument('--width', type=int, help="The width of the output file when --to-file is set")
        parser.add_argument('--height', type=int, help="The height of the output file when --to-file is set")
        parser.add_argument('--dpi', type=int, help="The dpi of the output file when --to-file is set")

        return parser 
开发者ID:robbert-harms,项目名称:MDT,代码行数:21,代码来源:mdt_view_maps.py

示例4: _get_arg_parser

# 需要导入模块: from argcomplete import completers [as 别名]
# 或者: from argcomplete.completers import FilesCompleter [as 别名]
def _get_arg_parser(self, doc_parser=False):
        description = textwrap.dedent(__doc__)

        parser = argparse.ArgumentParser(description=description, formatter_class=argparse.RawTextHelpFormatter)
        parser.add_argument('-d', '--dir', metavar='dir', type=str, help='the base directory for the file choosers',
                            default=None).completer = FilesCompleter()
        return parser 
开发者ID:robbert-harms,项目名称:MDT,代码行数:9,代码来源:mdt_gui.py

示例5: _get_arg_parser

# 需要导入模块: from argcomplete import completers [as 别名]
# 或者: from argcomplete.completers import FilesCompleter [as 别名]
def _get_arg_parser(self, doc_parser=False):
        description = textwrap.dedent(__doc__)

        examples = textwrap.dedent('''
            mdt-get-example-data
            mdt-get-example-data .
        ''')
        epilog = self._format_examples(doc_parser, examples)

        parser = argparse.ArgumentParser(description=description, epilog=epilog,
                                         formatter_class=argparse.RawTextHelpFormatter)

        parser.add_argument('dir', metavar='dir', type=str, nargs='?', help='the output directory',
                            default=None).completer = FilesCompleter()
        return parser 
开发者ID:robbert-harms,项目名称:MDT,代码行数:17,代码来源:mdt_get_example_data.py

示例6: _get_arg_parser

# 需要导入模块: from argcomplete import completers [as 别名]
# 或者: from argcomplete.completers import FilesCompleter [as 别名]
def _get_arg_parser(self, doc_parser=False):
        description = textwrap.dedent(__doc__)

        examples = textwrap.dedent('''
            mdt-create-roi-slice mask.nii.gz
            mdt-create-roi-slice mask.nii.gz -d 1 -s 50
            mdt-create-roi-slice mask.nii.gz -d 1 -s 50 -o my_roi_1_50.nii.gz
           ''')
        epilog = self._format_examples(doc_parser, examples)

        parser = argparse.ArgumentParser(description=description, epilog=epilog,
                                         formatter_class=argparse.RawTextHelpFormatter)
        parser.add_argument('mask',
                            action=mdt.lib.shell_utils.get_argparse_extension_checker(['.nii', '.nii.gz', '.hdr', '.img']),
                            help='the mask to select a slice from').completer = \
            FilesCompleter(['nii', 'gz', 'hdr', 'img'], directories=False)

        parser.add_argument('-d', '--dimension', type=int, help="The dimension to index (0, 1, 2, ...). Default is 2.")
        parser.add_argument('-s', '--slice', type=int, help="The slice to use in the selected dimension (0, 1, 2, ...)."
                                                            "Defaults to center of chosen dimension.")

        parser.add_argument('-o', '--output-name',
                            action=mdt.lib.shell_utils.get_argparse_extension_checker(['.nii', '.nii.gz', '.hdr', '.img']),
                            help='the filename of the output file. Default is <mask_name>_<dim>_<slice>.nii.gz').\
            completer = FilesCompleter(['nii', 'gz', 'hdr', 'img'], directories=False)

        return parser 
开发者ID:robbert-harms,项目名称:MDT,代码行数:29,代码来源:mdt_create_roi_slice.py

示例7: _get_arg_parser

# 需要导入模块: from argcomplete import completers [as 别名]
# 或者: from argcomplete.completers import FilesCompleter [as 别名]
def _get_arg_parser(self, doc_parser=False):
        description = textwrap.dedent(__doc__)

        examples = textwrap.dedent('''
            mdt-math-protocol protocol.prtcl 'G *= 1e-3' -o new_protocol.prtcl
            mdt-math-protocol p.prtcl 'G *= 1e-3; TR /= 1000; TE /= 1000'
            mdt-math-protocol p.prtcl 'del(G)'
            mdt-math-protocol p.prtcl 'TE  = 50e-3'
            mdt-math-protocol p.prtcl -a Delta.txt 'Delta = files[0]'
           ''')
        epilog = self._format_examples(doc_parser, examples)

        parser = argparse.ArgumentParser(description=description, epilog=epilog,
                                         formatter_class=argparse.RawTextHelpFormatter)

        parser.add_argument('input_protocol', metavar='input_protocol', type=str,
                            help="The input protocol")

        parser.add_argument('expr', metavar='expr', type=str,
                            help="The expression to evaluate.")

        parser.add_argument('-o', '--output_file',
                            help='the output protocol, defaults to the input protocol.').completer = FilesCompleter()

        parser.add_argument('-a', '--additional-file', type=str, action='append', dest='additional_files',
                            help='additional file to load to be used for columns, placed in \'files\' list by index')

        return parser 
开发者ID:robbert-harms,项目名称:MDT,代码行数:30,代码来源:mdt_math_protocol.py

示例8: parser_disk

# 需要导入模块: from argcomplete import completers [as 别名]
# 或者: from argcomplete.completers import FilesCompleter [as 别名]
def parser_disk(self, parser):
        parser.description = "Add a disk to the current parser"
        p = parser.add_argument('path', help='path to the disk image that you want to mount')
        try:
            from argcomplete.completers import FilesCompleter
            p.completer = FilesCompleter([".dd", ".e01", ".aff", ".DD", ".E01", ".AFF"])
        except ImportError:
            pass
        parser.add_argument("--mounter", choices=DISK_MOUNTERS, help="the method to mount with") 
开发者ID:ralphje,项目名称:imagemounter,代码行数:11,代码来源:shell.py

示例9: FilesCompleter

# 需要导入模块: from argcomplete import completers [as 别名]
# 或者: from argcomplete.completers import FilesCompleter [as 别名]
def FilesCompleter(*, allowednames, directories):
        return None 
开发者ID:ros2,项目名称:sros2,代码行数:4,代码来源:generate_artifacts.py

示例10: add_arguments

# 需要导入模块: from argcomplete import completers [as 别名]
# 或者: from argcomplete.completers import FilesCompleter [as 别名]
def add_arguments(self, parser, cli_name):
        arg = parser.add_argument('-k', '--keystore-root-path', help='root path of keystore')
        arg.completer = DirectoriesCompleter()
        parser.add_argument(
            '-e', '--enclaves', nargs='*', default=[],
            help='list of identities, aka ROS security enclave names')
        arg = parser.add_argument(
            '-p', '--policy-files', nargs='*', default=[],
            help='list of policy xml file paths')
        arg.completer = FilesCompleter(
            allowednames=('xml'), directories=False) 
开发者ID:ros2,项目名称:sros2,代码行数:13,代码来源:generate_artifacts.py

示例11: add_arguments

# 需要导入模块: from argcomplete import completers [as 别名]
# 或者: from argcomplete.completers import FilesCompleter [as 别名]
def add_arguments(self, parser, cli_name):
        arg = parser.add_argument(
            'POLICY_FILE_PATH', help='path of the policy xml file')
        arg.completer = FilesCompleter(
            allowednames=('xml'), directories=False)
        add_strategy_node_arguments(parser) 
开发者ID:ros2,项目名称:sros2,代码行数:8,代码来源:generate_policy.py

示例12: load_arguments

# 需要导入模块: from argcomplete import completers [as 别名]
# 或者: from argcomplete.completers import FilesCompleter [as 别名]
def load_arguments(self, _):

    with self.argument_context('portal dashboard list') as c:
        c.argument('resource_group_name', resource_group_name_type,
                   help='The name of the resource group.')

    with self.argument_context('portal dashboard show') as c:
        c.argument('resource_group_name', resource_group_name_type)
        c.argument('name', options_list=[
                   '--name', '-n'], help='The name of the dashboard.')

    with self.argument_context('portal dashboard create') as c:
        c.argument('resource_group_name', resource_group_name_type,
                   help='The name of the resource group.')
        c.argument('name', options_list=[
                   '--name', '-n'], help='The name of the dashboard.')
        c.argument('location', arg_type=get_location_type(self.cli_ctx),
                   validator=get_default_location_from_resource_group)
        c.argument('tags', tags_type)
        c.argument('input_path', type=file_type,
                   help='The path to the dashboard properties JSON file.', completer=FilesCompleter())

    with self.argument_context('portal dashboard update') as c:
        c.argument('resource_group_name', resource_group_name_type,
                   help='The name of the resource group.')
        c.argument('name', options_list=[
                   '--name', '-n'], help='The name of the dashboard.')
        c.argument('input_path', type=file_type,
                   help='The path to the dashboard properties JSON file.', completer=FilesCompleter())

    with self.argument_context('portal dashboard delete') as c:
        c.argument('resource_group_name', resource_group_name_type,
                   help='The name of the resource group.')
        c.argument('name', options_list=[
                   '--name', '-n'], help='The name of the dashboard.')

    with self.argument_context('portal dashboard import') as c:
        c.argument('resource_group_name', resource_group_name_type,
                   help='The name of the resource group.')
        c.argument('name', options_list=[
                   '--name', '-n'], help='The name of the dashboard.')
        c.argument('input_path', type=file_type,
                   help='The path to the dashboard json file.', completer=FilesCompleter()) 
开发者ID:Azure,项目名称:azure-cli-extensions,代码行数:45,代码来源:_params.py

示例13: _get_arg_parser

# 需要导入模块: from argcomplete import completers [as 别名]
# 或者: from argcomplete.completers import FilesCompleter [as 别名]
def _get_arg_parser(self, doc_parser=False):
        description = textwrap.dedent(__doc__)

        examples = textwrap.dedent('''
            mdt-create-protocol data.bvec data.bval
            mdt-create-protocol data.bvec data.bval -o my_protocol.prtcl
            mdt-create-protocol data.bvec data.bval
            mdt-create-protocol data.bvec data.bval --Delta 30 --delta 20
            mdt-create-protocol data.bvec data.bval --sequence-timing-units 's' --Delta 0.03
            mdt-create-protocol data.bvec data.bval --TE ../my_TE_file.txt
           ''')
        epilog = self._format_examples(doc_parser, examples)
        epilog += textwrap.dedent("""

            Additional columns can be specified using the syntax: \"--{column_name} {value}\" structure.
            Please note that these additional values will not be auto-converted from ms to s.
        """)

        parser = argparse.ArgumentParser(description=description, epilog=epilog,
                                         formatter_class=argparse.RawTextHelpFormatter)

        parser.add_argument('bvec', help='the gradient vectors file').completer = FilesCompleter()
        parser.add_argument('bval', help='the gradient b-values').completer = FilesCompleter()
        parser.add_argument('-s', '--bval-scale-factor', type=float,
                            help="We expect the b-values in the output protocol in units of s/m^2. "
                                 "Example use: 1 or 1e6. The default is autodetect.")

        parser.add_argument('-o', '--output_file',
                            help='the output protocol, defaults to "<bvec_name>.prtcl" in the same '
                                 'directory as the bvec file.').completer = FilesCompleter()

        parser.add_argument('--sequence-timing-units', choices=('ms', 's'), default='ms',
                            help="The units of the sequence timings. The default is 'ms' which we will convert to 's'.")

        parser.add_argument('--G',
                            help="The gradient amplitudes in T/m.")

        parser.add_argument('--maxG',
                            help="The maximum gradient amplitude in T/m. This is only useful if we need to guess "
                                 "big Delta and small delta. Default is 0.04 T/m")

        parser.add_argument('--Delta',
                            help="The big Delta to use, either a single number or a file with either a single number "
                                 "or one number per gradient direction.")

        parser.add_argument('--delta',
                            help="The small delta to use, either a single number or a file with either a single number "
                                 "or one number per gradient direction.")

        parser.add_argument('--TE',
                            help="The TE to use, either a single number or a file with either a single number "
                                 "or one number per gradient direction.")

        parser.add_argument('--TR',
                            help="The TR to use, either a single number or a file with either a single number "
                                 "or one number per gradient direction.")

        return parser 
开发者ID:robbert-harms,项目名称:MDT,代码行数:60,代码来源:mdt_create_protocol.py

示例14: _get_arg_parser

# 需要导入模块: from argcomplete import completers [as 别名]
# 或者: from argcomplete.completers import FilesCompleter [as 别名]
def _get_arg_parser(self, doc_parser=False):
        description = textwrap.dedent(__doc__)

        examples = textwrap.dedent('''
            mdt-create-mask data.nii.gz data.prtcl
            mdt-create-mask data.nii.gz data.prtcl -o data_mask.nii.gz
            mdt-create-mask data.nii.gz data.prtcl -o data_mask.nii.gz --median-radius 2
        ''')
        epilog = self._format_examples(doc_parser, examples)

        parser = argparse.ArgumentParser(description=description, epilog=epilog,
                                         formatter_class=argparse.RawTextHelpFormatter)
        parser.add_argument('dwi',
                            action=mdt.lib.shell_utils.get_argparse_extension_checker(['.nii', '.nii.gz', '.hdr', '.img']),
                            help='the diffusion weighted image').completer = FilesCompleter(['nii', 'gz', 'hdr', 'img'],
                                                                                            directories=False)
        parser.add_argument('protocol',
                            action=mdt.lib.shell_utils.get_argparse_extension_checker(['.prtcl']),
                            help='the protocol file, see mdt-create-protocol').\
            completer = FilesCompleter(['prtcl'], directories=False)
        parser.add_argument('-o', '--output-name',
                            action=mdt.lib.shell_utils.get_argparse_extension_checker(['.nii', '.nii.gz', '.hdr', '.img']),
                            help='the filename of the output file. Default is <dwi_name>_mask.nii.gz').completer = \
            FilesCompleter(['nii', 'gz', 'hdr', 'img'], directories=False)

        parser.add_argument('--median-radius', type=int, default=4,
                            help="Radius (in voxels) of the applied median filter (default 4).")

        parser.add_argument('--mask-threshold', type=float, default=0,
                            help="Everything below this b-value threshold is masked away (value in s/m^2, default 0)")

        parser.add_argument('--numpass', type=int, default=4,
                            help="Number of pass of the median filter (default 4).")

        parser.add_argument('--dilate', type=int, default=1,
                            help="Number of iterations for binary dilation (default 1).")

        parser.add_argument('--cl-device-ind', type=int, nargs='*', choices=self.available_devices.keys(),
                            help="The index of the device we would like to use. This follows the indices "
                                 "in mdt-list-devices and defaults to the first GPU.")

        return parser 
开发者ID:robbert-harms,项目名称:MDT,代码行数:44,代码来源:mdt_create_mask.py


注:本文中的argcomplete.completers.FilesCompleter方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。