MCPcopy Create free account
hub / github.com/numpy/numpy / unique_key

Function unique_key

numpy/distutils/from_template.py:115–126  ·  view source on GitHub ↗

Obtain a unique key given a dictionary.

(adict)

Source from the content-addressed store, hash-verified

113 return ','.join(l)
114
115def unique_key(adict):
116 """ Obtain a unique key given a dictionary."""
117 allkeys = list(adict.keys())
118 done = False
119 n = 1
120 while not done:
121 newkey = '__l%s' % (n)
122 if newkey in allkeys:
123 n += 1
124 else:
125 done = True
126 return newkey
127
128
129template_name_re = re.compile(r'\A\s*(\w[\w\d]*)\s*\Z')

Callers 2

find_repl_patternsFunction · 0.70
listreplFunction · 0.70

Calls 1

keysMethod · 0.80

Tested by

no test coverage detected