(self, s, policy)
return join_char.join(parts)
Applies a Policy's case transforms to a string.

    Args:
      s: (str) A string to transform.
      policy: (NamingPolicy) The naming policy to use for the transform.
    Returns:
      Case transformed string.
Applies a Policy's case transforms to a string.
Applies a Policy s case transforms to a string .
def ApplyCaseTransform(self, s, policy):
    """Applies a Policy's case transforms to a string.

    Args:
      s: (str) A string to transform.
      policy: (NamingPolicy) The naming policy to use for the transform.
    Returns:
      Case transformed string.
    """
    # Pick the right transformer method
    if policy.case_transform == LOWER_CASE:
      transform = lambda s, _: ''.join(s).lower()
    elif policy.case_transform == UPPER_CASE:
      transform = lambda s, _: ''.join(s).upper()
    elif policy.case_transform == UPPER_CAMEL_CASE:
      transform = lambda s, _: ''.join([s[0].upper()] + s[1:])
    elif policy.case_transform == LOWER_CAMEL_CASE:
      # pylint: disable=g-long-lambda
      transform = (
          lambda s, first_word:
          ''.join([s[0].lower() if first_word else s[0].upper()] + s[1:]))
    elif policy.case_transform == LOWER_UNCAMEL_CASE:
      transform = lambda s, _: utilities.UnCamelCase(''.join(s))
    elif policy.case_transform == UPPER_UNCAMEL_CASE:
      transform = lambda s, _: utilities.UnCamelCase(''.join(s)).upper()
    elif policy.case_transform == CAP_FIRST:
      # pylint: disable=g-long-lambda
      transform = (
          lambda s, first_word:
          ''.join([s[0].upper() if first_word else s[0]] + s[1:]))
    else:
      transform = lambda s, _: ''.join(s)

    if policy.atsign_policy == ATSIGN_STRIP:
      s = s.replace('@', '')
    if policy.atsign_policy == ATSIGN_BREAK:
      # chr(1) is always going to not be in allowed_characters.
      s = s.replace('@', policy.separator or chr(1))

    # Split into words at characters which can not be part of an identifier.
    parts = []
    curpart = []
    for c in s:
      # Collect valid characters for an identifier.
      if not c.isalnum() and c not in self.allowed_characters:
        if curpart:
          parts.append(transform(curpart, not parts))
          curpart = []
      else:
        # end the word when we have a bad one.
        curpart.append(c)
    if curpart:
      parts.append(transform(curpart, not parts))

    join_char = policy.separator or ''
    return join_char.join(parts)
def ApplyCaseTransform ( self , s , policy ) : # Pick the right transformer method if policy . case_transform == LOWER_CASE : transform = lambda s , _ : '' . join ( s ) . lower ( ) elif policy . case_transform == UPPER_CASE : transform = lambda s , _ : '' . join ( s ) . upper ( ) elif policy . case_transform == UPPER_CAMEL_CASE : transform = lambda s , _ : '' . join ( [ s [ 0 ] . upper ( ) ] + s [ 1 : ] ) elif policy . case_transform == LOWER_CAMEL_CASE : # pylint: disable=g-long-lambda transform = ( lambda s , first_word : '' . join ( [ s [ 0 ] . lower ( ) if first_word else s [ 0 ] . upper ( ) ] + s [ 1 : ] ) ) elif policy . case_transform == LOWER_UNCAMEL_CASE : transform = lambda s , _ : utilities . UnCamelCase ( '' . join ( s ) ) elif policy . case_transform == UPPER_UNCAMEL_CASE : transform = lambda s , _ : utilities . UnCamelCase ( '' . join ( s ) ) . upper ( ) elif policy . case_transform == CAP_FIRST : # pylint: disable=g-long-lambda transform = ( lambda s , first_word : '' . join ( [ s [ 0 ] . upper ( ) if first_word else s [ 0 ] ] + s [ 1 : ] ) ) else : transform = lambda s , _ : '' . join ( s ) if policy . atsign_policy == ATSIGN_STRIP : s = s . replace ( '@' , '' ) if policy . atsign_policy == ATSIGN_BREAK : # chr(1) is always going to not be in allowed_characters. s = s . replace ( '@' , policy . separator or chr ( 1 ) ) # Split into words at characters which can not be part of an identifier. parts = [ ] curpart = [ ] for c in s : # Collect valid characters for an identifier. if not c . isalnum ( ) and c not in self . allowed_characters : if curpart : parts . append ( transform ( curpart , not parts ) ) curpart = [ ] else : # end the word when we have a bad one. curpart . append ( c ) if curpart : parts . append ( transform ( curpart , not parts ) ) join_char = policy . separator or '' return join_char . join ( parts )