mojo/public/tools/mojom/mojom/parse/conditional_features.py
def _IsEnabled(definition, enabled_features):
  """Returns true if a definition is enabled.

  A definition is enabled if it has no EnableIf/EnableIfNot attribute.
  It is retained if it has an EnableIf attribute and the attribute is in
  enabled_features. It is retained if it has an EnableIfNot attribute and the
  attribute is not in enabled features.
  """
  if not hasattr(definition, "attribute_list"):
    return True
  if not definition.attribute_list:
    return True

  already_defined = False
  for a in definition.attribute_list:
    if a.key == 'EnableIf' or a.key == 'EnableIfNot':
      if already_defined:
        raise EnableIfError(
            definition.filename,
            "EnableIf/EnableIfNot attribute may only be set once per field.",
            definition.lineno)
      already_defined = True

  for attribute in definition.attribute_list:
    if attribute.key == 'EnableIf' and attribute.value not in enabled_features:
      return False
    if attribute.key == 'EnableIfNot' and attribute.value in enabled_features:
      return False
  return True
Returns true if a definition is enabled.

  A definition is enabled if it has no EnableIf/EnableIfNot attribute.
  It is retained if it has an EnableIf attribute and the attribute is in
  enabled_features. It is retained if it has an EnableIfNot attribute and the
  attribute is not in enabled features.
  
Returns true if a definition is enabled.
A definition is enabled if it has no EnableIf/EnableIfNot attribute.
It is retained if it has an EnableIf attribute and the attribute is in
enabled_features. It is retained if it has an EnableIfNot attribute and the
attribute is not in enabled features.
Returns true if a definition is enabled . A definition is enabled if it has no EnableIf / EnableIfNot attribute . It is retained if it has an EnableIf attribute and the attribute is in enabled_features . It is retained if it has an EnableIfNot attribute and the attribute is not in enabled features .
def _IsEnabled(definition, enabled_features):
  if not hasattr(definition, "attribute_list"):
    return True
  if not definition.attribute_list:
    return True
  already_defined = False
  for a in definition.attribute_list:
    if a.key == 'EnableIf' or a.key == 'EnableIfNot':
      if already_defined:
        raise EnableIfError(
            definition.filename,
            "EnableIf/EnableIfNot attribute may only be set once per field.",
            definition.lineno)
      already_defined = True
  for attribute in definition.attribute_list:
    if attribute.key == 'EnableIf' and attribute.value not in enabled_features:
      return False
    if attribute.key == 'EnableIfNot' and attribute.value in enabled_features:
      return False
  return True
def _IsEnabled ( definition , enabled_features ) : if not hasattr ( definition , "attribute_list" ) : return True if not definition . attribute_list : return True already_defined = False for a in definition . attribute_list : if a . key == 'EnableIf' or a . key == 'EnableIfNot' : if already_defined : raise EnableIfError ( definition . filename , "EnableIf/EnableIfNot attribute may only be set once per field." , definition . lineno ) already_defined = True for attribute in definition . attribute_list : if attribute . key == 'EnableIf' and attribute . value not in enabled_features : return False if attribute . key == 'EnableIfNot' and attribute . value in enabled_features : return False return True
Returns true if a definition is enabled.
Returns true if a definition is enabled .
"""Returns true if a definition is enabled.

  A definition is enabled if it has no EnableIf/EnableIfNot attribute.
  It is retained if it has an EnableIf attribute and the attribute is in
  enabled_features. It is retained if it has an EnableIfNot attribute and the
  attribute is not in enabled features.
  """
definition
enabled_features