parseudev._shared._shared module

parseudev._shared

Some classes that parsers share.

class parseudev._shared._shared.Field(name, regexp='.+', description=None)

Bases: object

A field in a parser regular expression.

exception parseudev._shared._shared.OpaqueValueError(name)

Bases: exceptions.Exception

Exception raised when looking up parser for an opaque value.

exception parseudev._shared._shared.ParseError

Bases: exceptions.Exception

Parse exception.

class parseudev._shared._shared.Parser(format_string, fields)

Bases: object

A generic parser object.

keys

Keys within the regular expression.

Returns:a list of the keys useful for finding portions of a match
Return type:list of str
match(value)

Match value if possible.

Returns:a dict representing the match, or None
Return type:dict or NoneType
prefix

A partially distinguishing prefix.

Some parsers may use the same prefix.

Returns:a prefix that distinguishes the parser from other parsers
Return type:str

Table Of Contents

Previous topic

parseudev._shared package

Next topic

parseudev._shared.parse module

This Page