ocebuild.parsers.plist#

Parser for converting property list to a Python dictionary.

Module Contents#

Functions#

parse_plist(→ dict)

Parses a native dictionary from a plist.

write_plist(→ str)

Writes a native dictionary to a plist.

Attributes#

PLIST_FORMATS

Mapping of format names to plistlib PlistFormat enum values.

ocebuild.parsers.plist.PLIST_FORMATS[source]#

Mapping of format names to plistlib PlistFormat enum values.

ocebuild.parsers.plist.parse_plist(lines: str | bytes | io.BufferedReader | io.TextIOWrapper, fmt: None | ocebuild.third_party.cpython.plistlib.PlistFormat = None, dict_type=dict) dict[source]#

Parses a native dictionary from a plist.

Parameters:
  • lines – Property list (plist) lines.

  • fmt – Format of the plist file.

  • dict_type – Type of dictionary to return.

Returns:

A dictionary containing the parsed plist.

ocebuild.parsers.plist.write_plist(config: dict, fmt: ocebuild.third_party.cpython.plistlib.PlistFormat = FMT_XML, sort_keys: bool = False) str[source]#

Writes a native dictionary to a plist.

Parameters:
  • config – Dictionary to be written.

  • fmt – Format of the plist file.

  • sort_keys – Whether to sort the keys in the output.

Returns:

A string containing the written plist.