Processor to convert/parse the function parameters. The syntax is equal to `Processor` except that strings are interpreted as a :class:Parser expression. >>> conv = ParseProcessor('spam {:s} eggs') >>> conv('spam ham eggs') 'ham' >>> conv = ParseProcessor((
| 225 | |
| 226 | |
| 227 | class ParseProcessor(Processor): |
| 228 | """Processor to convert/parse the function parameters. |
| 229 | |
| 230 | The syntax is equal to `Processor` except that strings are interpreted |
| 231 | as a :class:Parser expression. |
| 232 | |
| 233 | >>> conv = ParseProcessor('spam {:s} eggs') |
| 234 | >>> conv('spam ham eggs') |
| 235 | 'ham' |
| 236 | |
| 237 | >>> conv = ParseProcessor(('hi {:d}', 'bye {:s}')) |
| 238 | >>> conv(('hi 42', 'bye Brian')) |
| 239 | (42, 'Brian') |
| 240 | |
| 241 | """ |
| 242 | |
| 243 | @classmethod |
| 244 | def to_callable(cls, obj): |
| 245 | if isinstance(obj, str): |
| 246 | return Parser(obj) |
| 247 | raise TypeError('parse_params argument must be a string or a callable, ' |
| 248 | 'not {}'.format(obj)) |
| 249 | |
| 250 | |
| 251 | class MapProcessor(Processor): |
no outgoing calls
no test coverage detected