(cls, value)
return name
Construct a safe name for a constant from a value.

    Constants might be numbers or strings with symbols that cannot be used in
    identifiers. We want to do the minimal transform we can to make a name
    that could be turned into an identifier.

    Args:
      value: (str) The value to derive a name from.

    Returns:
      (str): A name which could
Construct a safe name for a constant from a value.
Construct a safe name for a constant from a value .
def _NameFromValue(cls, value):
    """Construct a safe name for a constant from a value.

    Constants might be numbers or strings with symbols that cannot be used in
    identifiers. We want to do the minimal transform we can to make a name
    that could be turned into an identifier.

    Args:
      value: (str) The value to derive a name from.

    Returns:
      (str): A name which could
    """
    # Many string constants begin with punctuation or symbols like '@'. Remove
    # those.
    name = value
    while not name[0].isalnum():
      name = name[1:]
      if not name:
        # we ran out? Just revert
        name = value
        break
    # If we are left with a number, we have to turn it into an alphanumeric.
    if not name[0].isalpha():
      name = 'value_' + name
    return name
def _NameFromValue ( cls , value ) : # Many string constants begin with punctuation or symbols like '@'. Remove # those. name = value while not name [ 0 ] . isalnum ( ) : name = name [ 1 : ] if not name : # we ran out? Just revert name = value break # If we are left with a number, we have to turn it into an alphanumeric. if not name [ 0 ] . isalpha ( ) : name = 'value_' + name return name