• Jeremy Reizenstein's avatar
    redefinition -> defaults kept in config · 6b481595
    Jeremy Reizenstein authored
    Summary:
    This is an internal change in the config systen. It allows redefining a pluggable implementation with new default values. This is useful in notebooks / interactive use. For example, this now works.
    
            class A(ReplaceableBase):
                pass
    
            registry.register
            class B(A):
                i: int = 4
    
            class C(Configurable):
                a: A
                a_class_type: str = "B"
    
                def __post_init__(self):
                    run_auto_creation(self)
    
            expand_args_fields(C)
    
            registry.register
            class B(A):
                i: int = 5
    
            c = C()
    
            assert c.a.i == 5
    
    Reviewed By: shapovalov
    
    Differential Revision: D38219371
    
    fbshipit-source-id: 72911a9bd3426d3359cf8802cc016fc7f6d7713b
    6b481595
test_config.py 27.3 KB