schrodinger.utils.featureflags.write module¶
Utility functions to read and write features.json files. No dependencies on schrodinger.
- schrodinger.utils.featureflags.write.format_json(json_data)¶
Convert json data into a formatted string.
- Parameters
json_data (list[dict]) – List of features to write to the file.
- Returntype
str
- Returns
String of formatted json, ready for writing to disk
- schrodinger.utils.featureflags.write.write_features_json(json_data, filename)¶
Write the json data to the user state file in UTF-8 encoding.
- Parameters
json_data (list[dict]) – List of features to write to the file.
filename (str) – File to write the features to.
- Raises
IOError – if json data cannot be written to the file.
- schrodinger.utils.featureflags.write.write_site_features_json(json_data: list[dict], filename: str)¶
Write the json data to the site state file in UTF-8 encoding.
This routine ensures appropriate world-readable permissions for created directories and files.
- Parameters
json_data – List of features to write to the file.
filename – File to write the features to.
- Raises
IOError – if json data cannot be written to the file.
- schrodinger.utils.featureflags.write.read_json_data(json_data_file)¶
Read feature flags data from json document.
- Parameters
json_data_file (str) – File name to decode feature flags json document.
- Returntype
dict
- Returns
Dictionary of feature name and its corresponding json item.
- Raises
ValueError – if json document cannot be parsed.
- schrodinger.utils.featureflags.write.main()¶