Show More
@@ -23,3 +23,18 b' class namespaces(object):' | |||||
23 |
|
23 | |||
24 | def __init__(self): |
|
24 | def __init__(self): | |
25 | self._names = util.sortdict() |
|
25 | self._names = util.sortdict() | |
|
26 | ||||
|
27 | def addnamespace(self, namespace, namemap, order=None): | |||
|
28 | """ | |||
|
29 | register a namespace | |||
|
30 | ||||
|
31 | namespace: the name to be registered (in plural form) | |||
|
32 | namemap: function that inputs a node, output name(s) | |||
|
33 | order: optional argument to specify the order of namespaces | |||
|
34 | (e.g. 'branches' should be listed before 'bookmarks') | |||
|
35 | """ | |||
|
36 | val = {'namemap': namemap} | |||
|
37 | if order is not None: | |||
|
38 | self._names.insert(order, namespace, val) | |||
|
39 | else: | |||
|
40 | self._names[namespace] = val |
General Comments 0
You need to be logged in to leave comments.
Login now