tenfourfox/testing/taskcluster/taskcluster_graph/slugidjar.py
Cameron Kaiser c9b2922b70 hello FPR
2017-04-19 00:56:45 -07:00

21 lines
531 B
Python

from slugid import nice as slugid
class SlugidJar():
'''
Container of seen slugid's used to implement the as_slugid functionality
used in the task graph templates.
'''
def __init__(self):
self._names = {}
def __call__(self, name):
'''
So this object can easily be passed to mustache we allow it to be called
directly...
'''
if name in self._names:
return self._names[name];
self._names[name] = slugid()
return self._names[name]