[usability] added assertion message in registry (#864)

pull/867/head
Frank Lee 2022-04-25 11:45:15 +08:00 committed by GitHub
parent f0e654558f
commit ee222dfbf3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -35,7 +35,7 @@ class Registry:
AssertionError: Raises an AssertionError if the module has already been registered before. AssertionError: Raises an AssertionError if the module has already been registered before.
""" """
module_name = module_class.__name__ module_name = module_class.__name__
assert module_name not in self._registry assert module_name not in self._registry, f"{module_name} not found in {self.name}"
self._registry[module_name] = module_class self._registry[module_name] = module_class
# return so as to use it normally if via importing # return so as to use it normally if via importing