<s> from . import Plugin <EOL> class NativeProto2Plugin ( Plugin ) : <EOL> priority = <NUM_LIT:5> <EOL> targets = [ ] <EOL> def upgrade_metric ( self , metric ) : <EOL> """<STR_LIT>""" <EOL> if '<STR_LIT:=>' in metric or '<STR_LIT>' in metric : <EOL> if getattr ( self . config , '<STR_LIT>' , True ) : <EOL> nodes = metric . replace ( '<STR_LIT>' , '<STR_LIT:=>' ) . split ( '<STR_LIT:.>' ) <EOL> tags = { } <EOL> for ( i , node ) in enumerate ( nodes ) : <EOL> if '<STR_LIT:=>' in node : <EOL> ( key , val ) = node . split ( '<STR_LIT:=>' , <NUM_LIT:1> ) <EOL> if key == '<STR_LIT>' and val . endswith ( '<STR_LIT>' ) : <EOL> val = val [ : - <NUM_LIT:2> ] + "<STR_LIT>" <EOL> tags [ key ] = val <EOL> else : <EOL> tags [ "<STR_LIT>" % ( i + <NUM_LIT:1> ) ] = node <EOL> target = { <EOL> '<STR_LIT:id>' : metric , <EOL> '<STR_LIT>' : tags <EOL> } <EOL> return ( self . get_target_id ( target ) , target ) <EOL> else : <EOL> return False <EOL> return None </s>
