Skip to content

Commit

Permalink
return default if Registry.lookup finds a Registry
Browse files Browse the repository at this point in the history
Signed-off-by: Zhiyuan Chen <[email protected]>
  • Loading branch information
ZhiyuanChen committed Aug 26, 2024
1 parent 122c02b commit 6782522
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion chanfig/registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,10 @@ def lookup(self, name: str, default: Any = Null) -> Any:

if default is Null:
default = self.getattr("default", Null)
return self.get(name, default)
element = self.get(name, default)
if isinstance(element, Registry):
return element.getattr("default")
return element

@staticmethod
def init(cls: Callable, *args: Any, **kwargs: Any) -> Any: # pylint: disable=W0211
Expand Down

0 comments on commit 6782522

Please sign in to comment.