File: testing

package info (click to toggle)
pyqi 0.3.2%2Bdfsg-3
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 504 kB
  • sloc: python: 2,716; makefile: 133
file content (113 lines) | stat: -rw-r--r-- 6,496 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
#!/usr/bin/env python

from pyqi.core.interfaces.optparse import (OptparseOption,
                                           OptparseUsageExample,
                                           OptparseOption, OptparseResult)
from pyqi.commands.make_command import CommandConstructor

# If you need access to input or output handlers provided by pyqi, consider
# importing from the following modules:
# pyqi.core.interfaces.optparse.input_handler
# pyqi.core.interfaces.optparse.output_handler
# pyqi.interfaces.optparse.input_handler
# pyqi.interfaces.optparse.output_handler

# Examples of how the command can be used from the command line using an
# optparse interface.
usage_examples = [
    OptparseUsageExample(ShortDesc="A short single sentence description of the example",
                         LongDesc="A longer, more detailed description",
                         Ex="%prog --foo --bar some_file")
]

# inputs map command line arguments and values onto Parameters. It is possible
# to define options here that do not exist as parameters, e.g., an output file.
inputs = [
    # An example option that has a direct relationship with a Parameter.
    # OptparseOption(Parameter=CommandConstructor.Parameters['name_of_a_parameter'],
    #                InputType='existing_filepath', # the optparse type of input
    #                InputHandler=None, # Apply a function to the input value to convert it into the type expected by Parameter.DataType
    #                ShortName='n', # a parameter short name, can be None
    #                # Name='foo', # implied by Parameter. Can be overwritten here if desired
    #                # Required=True, # implied by Parameter. Can be promoted by setting True
    #                # Help, # implied by Parameter.Description. Can be overwritten here if desired
    #                convert_to_dashed_name=True), # whether the Name (either implied by Parameter or defined above) should have underscores converted to dashes when displayed to the user
    #
    # An example option that does not have an associated Parameter.
    # OptparseOption(Parameter=None,
    #                InputType='new_filepath',
    #                InputHandler=None, # we don't need an InputHandler because this option isn't being converted into a format that a Parameter expects
    #                ShortName='o',
    #                Name='output-fp',
    #                Required=True,
    #                Help='output filepath')
    OptparseOption(Parameter=CommandConstructor.Parameters['license'],
                   InputType=<type 'str'>,
                   InputHandler=None, # must be defined if desired
                   ShortName=None), # must be defined if desired
                   # Name='license', # implied by Parameter
                   # Required=True, # implied by Parameter
                   # Help='the license for the Command', # implied by Parameter
    OptparseOption(Parameter=CommandConstructor.Parameters['name'],
                   InputType=<type 'str'>,
                   InputHandler=None, # must be defined if desired
                   ShortName=None), # must be defined if desired
                   # Name='name', # implied by Parameter
                   # Required=True, # implied by Parameter
                   # Help='the name of the Command', # implied by Parameter
    OptparseOption(Parameter=CommandConstructor.Parameters['copyright'],
                   InputType=<type 'str'>,
                   InputHandler=None, # must be defined if desired
                   ShortName=None), # must be defined if desired
                   # Name='copyright', # implied by Parameter
                   # Required=True, # implied by Parameter
                   # Help='the Command copyright', # implied by Parameter
    OptparseOption(Parameter=CommandConstructor.Parameters['author'],
                   InputType=<type 'str'>,
                   InputHandler=None, # must be defined if desired
                   ShortName=None), # must be defined if desired
                   # Name='author', # implied by Parameter
                   # Required=True, # implied by Parameter
                   # Help='the Command author', # implied by Parameter
    OptparseOption(Parameter=CommandConstructor.Parameters['credits'],
                   InputType=<type 'str'>,
                   InputHandler=None, # must be defined if desired
                   ShortName=None), # must be defined if desired
                   # Name='credits', # implied by Parameter
                   # Required=False, # implied by Parameter
                   # Help='comma-separated list of other authors', # implied by Parameter
    OptparseOption(Parameter=CommandConstructor.Parameters['command_version'],
                   InputType=<type 'str'>,
                   InputHandler=None, # must be defined if desired
                   ShortName=None), # must be defined if desired
                   # Name='command_version', # implied by Parameter
                   # Required=True, # implied by Parameter
                   # Help='the Command version', # implied by Parameter
    OptparseOption(Parameter=CommandConstructor.Parameters['email'],
                   InputType=<type 'str'>,
                   InputHandler=None, # must be defined if desired
                   ShortName=None), # must be defined if desired
                   # Name='email', # implied by Parameter
                   # Required=True, # implied by Parameter
                   # Help='maintainer email address', # implied by Parameter

]

# outputs map result keys to output options and handlers. It is not necessary
# to supply an associated option, but if you do, it must be an option from the
# inputs list (above).
outputs = [
    # An example option that maps to a result key.
    # OptparseResult(ResultKey='some_result',
    #                OutputHandler=write_string, # a function applied to the value at ResultKey
    #
    #                # the name of the option (defined in inputs, above), whose
    #                # value will be made available to OutputHandler. This name
    #                # can be either an underscored or dashed version of the
    #                # option name (e.g., 'output_fp' or 'output-fp')
    #                OptionName='output-fp'), 
    #
    # An example option that does not map to a result key.
    # OptparseResult(ResultKey='some_other_result',
    #                OutputHandler=print_string)
]