Repository: larq/zookeeper

Issue:
`__pre_configure__` doesn't work with nested components
### Describe the bug

When `__pre_configure__` is used to modify the configuration dict of a component, the modified config is (incorrectly) _not_ passed to `configure` when called on its sub-components.

### To Reproduce

```python
    @component
    class Child:
        a: int = Field(4)

    @component
    class Parent:
        a: int = Field(2)
        child: Child = ComponentField()

        def __pre_configure__(self, conf):
            if "a" in conf:
                return {"child.a": conf["a"] * 7, **conf}
            return conf

    parent = Parent()
    configure(parent, {"a": 6})
    assert parent.a == 6
    assert parent.child.a == 42
```

The second assertion fails (the value is 6).

### Expected behavior

The value should be 6 * 7 = 42.

### Environment

TensorFlow version: N/A
Zookeeper version: v1.3.1


Discussion:

Patch:
diff --git a/zookeeper/core/component.py b/zookeeper/core/component.py
index b16b97e..dccfa79 100644
--- a/zookeeper/core/component.py
+++ b/zookeeper/core/component.py
@@ -694,6 +694,8 @@ def configure_component_instance(
     if hasattr(instance.__class__, "__post_configure__"):
         instance.__post_configure__()
 
+    return conf
+
 
 ######################
 # Exported functions #
@@ -852,7 +854,7 @@ def configure(
         if current_instance.__component_configured__:
             continue
 
-        configure_component_instance(
+        current_conf = configure_component_instance(
             current_instance,
             conf=current_conf,
             name=current_name,


Test patch:
diff --git a/zookeeper/core/component_test.py b/zookeeper/core/component_test.py
index fc4fce6..46187bf 100644
--- a/zookeeper/core/component_test.py
+++ b/zookeeper/core/component_test.py
@@ -821,6 +821,25 @@ def test_component_pre_configure():
     configure(instance, {"x": 7})
     assert instance.x == 14
 
+    @component
+    class Child:
+        a: int = Field(4)
+
+    @component
+    class Parent:
+        a: int = Field(2)
+        child: Child = ComponentField()
+
+        def __pre_configure__(self, conf):
+            if "a" in conf:
+                return {"child.a": conf["a"] * 7, **conf}
+            return conf
+
+    parent = Parent()
+    configure(parent, {"a": 6})
+    assert parent.a == 6
+    assert parent.child.a == 42
+
 
 def test_component_pre_configure_setattr():
     @component