schrodinger.utils.featureflags module

schrodinger.utils.featureflags.get_features()

Get the feature flags from site and user state file based on the existence.

Return type:dict
Returns:Dictionary of feature name and its corresponding json item.
schrodinger.utils.featureflags.write_json_data(json_data)

Write the json data to the user state file in UTF-8 encoding.

Parameters:json_data (list) – Python object to convert to json format and write to the file.
Raises:IOError – if json data cannot be written to the file.
schrodinger.utils.featureflags.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.set_features(features, enable)

Enable or Disable the given features.

This also report the given features which are not present in the default state file.

Parameters:features (list or set) – List of features to enable or disable in the user state file.
Returntype:tuple(int, features)
Returns:(number of features changed, list of unknown features)
Raises:ValueError – if json document cannot be parsed.
schrodinger.utils.featureflags.get_state_string(state)

Convert the feature state from integer to a string.

Parameters:state (int) – Feature state in integer format.
Returntype:string
Returns:0 => Disabled, 1 => Enabled, -1 => None
schrodinger.utils.featureflags.check_env_variable()

Check environment variable

schrodinger.utils.featureflags.list_features(search='*')

Show all available features from site state file or user state file whichever is accessible when search string is not specified. If search string is given, feature matching the search string will be shown. Otherwise feature whose description match the search string is shown only when state file is accessible.

The function will list the output in following format:

<feature_name> : <Enabled|Disabled>
    <Description if available>
    <User State>    : <Enabled|Disabled|None>
    <Default State> : <Enabled|Disabled>
Parameters:search_string (str) – Optional search string.
schrodinger.utils.featureflags.get_user_features()

Return the changes in the user feature flags with respect to the site feature flags, in the format:

+FLAG1 +FLAG2 -FLAG3 ...
schrodinger.utils.featureflags.main(argv)

Setup code for argument parsing

Params argv:Arguments to parse.