Created
February 16, 2012 19:24
-
-
Save vitaminmoo/1847137 to your computer and use it in GitHub Desktop.
func it
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# old: | |
type = 'default' | |
m = re.search(r'(?<=type=)([^,]*)', key) | |
if m: | |
type = re.sub(r'\s+', '_', m.group()) | |
name = 'default' | |
m = re.search(r'(?<=name=)([^,]*)', key) | |
if m: | |
name = re.sub(r'\s+', '_', m.group()) | |
# new: | |
def parse_rash_node(key): | |
# key format = "namespace:key=value,key=value | |
# key = "com.urbanairship.falconpunch.ingress:name=queueDepth,type=KafkaConsumer" | |
# key = "java.lang:type=Compilation" | |
# key = "org.apache.cassandra.db:columnfamily=HintsColumnFamily,keyspace=system,type=ColumnFamilies" | |
namespace, keyvals = key.split(':', 1) | |
return namespace, dict(map(lambda x: x.split('='), keyvals.split(','))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment