classad2 Members

classad2.lastError() str

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.

classad2.parseAds(input, parser=ParserType.Auto) Iterator[ClassAd]

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 the ParserType.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 the ParserType.Old or ParserType.New format.

classad2.parseNext(input, parser=ParserType.Auto) ClassAd

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 the ParserType.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.

classad2.parseOne(input, parser=ParserType.Auto) ClassAd

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 the ParserType.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 the ParserType.Old or :const:`ParserType.New formats.

classad2.quote(input) str

Quote input so it can be used for building ClassAd expressions.

Parameters

input (str) – The string to quote according the ClassAd syntax.

classad2.unquote(input) str

The inverse of quote().

Parameters

input (str) – The ClassAd string to unquote into its literal value.

classad2.version() str

Returns the version of ClassAd library this module is linked against.