diff --git a/chanfig/registry.py b/chanfig/registry.py index 3e120117..530a26eb 100644 --- a/chanfig/registry.py +++ b/chanfig/registry.py @@ -93,7 +93,7 @@ def __init__(self, override: bool | None = None, fallback: bool | None = None): if override is not None: self.setattr("override", override) - def register(self, component: Any = None, name: Any | None = None) -> Callable: + def register(self, component: Any = None, name: Any | None = None, override: bool = False) -> Callable: r""" Register a new component. @@ -125,7 +125,7 @@ def register(self, component: Any = None, name: Any | None = None) -> Callable: ) """ - if name in self and not self.override: + if name in self and not (override or self.override): raise ValueError(f"Component with name {name} already registered.") # Registry.register()