classad2
Members
- classad2.lastError()
Return the string representation of the last error to occur in the ClassAd library.
As the ClassAd language has no concept of an exception, this is the only mechanism to receive detailed error messages from functions.
- Return type
- classad2.parseAds(input, parser=ParserType.Auto)
Returns a generator which will parse each ad in the input.
Ads serialized in the
ParserType.Old
format must be separated by blank lines. Ads serialized in theParserType.New
format may be separated by blank lines.- Parameters
input (
Union
[str
,IO
]) – One or more serialized ClassAds. The serializations must all be in the same format.parser (
ParserType
) – Which parser to use (serialization format to assume). If unspecified, attempt to determine if the serialized ads are in theParserType.Old
orParserType.New
format.
- Return type
- classad2.parseNext(input, parser=ParserType.Auto)
Parses the first ad in the input and returns it.
Ads serialized in the
ParserType.Old
format must be separated by blank lines. Ads serialized in theParserType.New
format may be separated by blank lines.You must specify the parser type if input is not a string and can not be rewound.
- Parameters
input (
Union
[str
,IO
]) – One or more serialized ClassAds. The serializations must all be in the same format.parser (
ParserType
) – Which parser to use (serialization format to assume).
- Raises
ClassAdException – If
input
is not a string and can not be rewound.- Return type
- classad2.parseOne(input, parser=ParserType.Auto)
Parses all of the ads in the input, merges them into one, and returns it.
If input is a single string, ads serialized in the
ParserType.Old
format must be separated by blank lines; ads serialized in theParserType.New
format may be separated by blank lines.If input is an iterator, each serialized ad must be in its own string.
- Parameters
input (
Union
[str
,Iterator
[str
]]) – One or more serialized ClassAds. The serializations must all be in the same format.parser (
ParserType
) – Which parser to use (serialization format to assume). If unspecified, attempt to determine if the serialized ads are in theParserType.Old or :const:`ParserType.New
formats.
- Return type
- classad2.quote(input)
Quote input so it can be used for building ClassAd expressions.