<s> '''<STR_LIT>''' <EOL> from combi . _python_toolbox import string_tools <EOL> MANGLE_LEN = <NUM_LIT> <EOL> def mangle_attribute_name_if_needed ( attribute_name , class_name ) : <EOL> if ( ( not attribute_name . startswith ( '<STR_LIT>' ) ) or <EOL> ( len ( attribute_name ) + <NUM_LIT:2> >= MANGLE_LEN ) or <EOL> ( attribute_name . endswith ( '<STR_LIT>' ) ) or <EOL> set ( class_name ) == set ( ( '<STR_LIT:_>' , ) ) ) : <EOL> return attribute_name <EOL> cleaned_class_name = class_name . lstrip ( '<STR_LIT:_>' ) <EOL> total_length = len ( cleaned_class_name ) + len ( attribute_name ) <EOL> if total_length > MANGLE_LEN : <EOL> cleaned_class_name = cleaned_class_name [ : ( MANGLE_LEN - total_length ) ] <EOL> return '<STR_LIT>' % ( cleaned_class_name , attribute_name ) <EOL> def will_attribute_name_be_mangled ( attribute_name , class_name ) : <EOL> return mangle_attribute_name_if_needed ( attribute_name , class_name ) != attribute_name <EOL> def unmangle_attribute_name_if_needed ( attribute_name , class_name ) : <EOL> if ( ( string_tools . get_n_identical_edge_characters ( attribute_name , <EOL> '<STR_LIT:_>' ) != <NUM_LIT:1> ) or <EOL> ( len ( attribute_name ) >= MANGLE_LEN ) or <EOL> ( attribute_name . endswith ( '<STR_LIT>' ) ) or <EOL> set ( class_name ) == set ( '<STR_LIT:_>' ) ) : <EOL> return attribute_name <EOL> cleaned_class_name = class_name . lstrip ( '<STR_LIT:_>' ) <EOL> if not attribute_name [ <NUM_LIT:1> : ] . startswith ( cleaned_class_name + '<STR_LIT>' ) : <EOL> return attribute_name <EOL> return attribute_name [ ( len ( cleaned_class_name ) + <NUM_LIT:1> ) : ] </s>
