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

str

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

Return type

Iterator[ClassAd]

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

Return type

ClassAd

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

Return type

ClassAd

classad2.quote(input)

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

Parameters

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

Return type

str

classad2.unquote(input)

The inverse of quote().

Parameters

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

Return type

str

classad2.version()

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

Return type

str