##// END OF EJS Templates
registrar: add a method to merge registrar instances...
Matt Harbison -
r41112:13f50ea8 default
parent child Browse files
Show More
@@ -73,6 +73,25 b' class _funcregistrarbase(object):'
73
73
74 return func
74 return func
75
75
76 def _merge(self, registrarbase):
77 """Merge the entries of the given registrar object into this one.
78
79 The other registrar object must not contain any entries already in the
80 current one, or a ProgrammmingError is raised. Additionally, the types
81 of the two registrars must match.
82 """
83 if type(self) != type(registrarbase):
84 msg = "cannot merge different types of registrar"
85 raise error.ProgrammingError(msg)
86
87 dups = set(registrarbase._table.keys()).intersection(self._table.keys())
88
89 if dups:
90 msg = 'duplicate registration for names: "%s"' % '", "'.join(dups)
91 raise error.ProgrammingError(msg)
92
93 self._table.update(registrarbase._table)
94
76 def _parsefuncdecl(self, decl):
95 def _parsefuncdecl(self, decl):
77 """Parse function declaration and return the name of function in it
96 """Parse function declaration and return the name of function in it
78 """
97 """
General Comments 0
You need to be logged in to leave comments. Login now