Skip to content

Instantly share code, notes, and snippets.

@vitaminmoo
Created February 16, 2012 19:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vitaminmoo/1847137 to your computer and use it in GitHub Desktop.
Save vitaminmoo/1847137 to your computer and use it in GitHub Desktop.
func it
# 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