class protocol(pyre.protocol):
     """a protocol"""
     # properties
     p1 = pyre.property()
     p2 = pyre.property()
     # behavior
     @pyre.provides
     def do(self):
         """behave"""
    class component(pyre.component, family="test", implements=protocol):
        """a component"""
        # traits
        p1 = pyre.property()
        p1.default = "p1"

        p2 = pyre.property()
        p2.default = "p2"

        @pyre.export
        def do(self):
            """behave"""
            return "component"
Exemple #3
0
    class protocol(pyre.protocol):
        """a simple protocol"""
        # properties
        name = pyre.property()
        name.default = "my name"

        @pyre.provides
        def say(self):
            """say my name"""
Exemple #4
0
    class implicit(pyre.component, family="tests.implicit"):
        """a simple component"""
        # properties
        name = pyre.property()
        name.default = "whatever"

        @pyre.export
        def say(self):
            """say my name"""
            return self.name
 class derived(base):
     """a derived one, so automatically compatible"""
     extra = pyre.property()
Exemple #6
0
 class derived(a1, a2):
     """the derived one"""
     common = pyre.property()
     extra = pyre.property()
 class base(pyre.protocol):
     """the base protocol"""
     common = pyre.property()
Exemple #8
0
 class a1(base):
     a1 = pyre.property()
Exemple #9
0
 class a2(base):
     a2 = pyre.property()
Exemple #10
0
 class derived(base):
     """the derived one"""
     common = pyre.property()
Exemple #11
0
 class component(pyre.component):
     """a trivial component"""
     p = pyre.property()
 class ok(pyre.protocol):
     """one that doesn't derive but has the right public protocol"""
     common = pyre.property()
Exemple #13
0
 class base(pyre.component):
     """the base component"""
     common = pyre.property()
     common.default = "base.common"
Exemple #14
0
 class derived(base):
     """the derived one"""
     extra = pyre.property()
     extra.default = "derived.extra"
Exemple #15
0
 class derived(base):
     """the derived one"""
     extra = pyre.property()
 class notok(pyre.component):
     """one that doesn't provide the right public component"""
     what = pyre.property()
 class ok(pyre.component):
     """one that doesn't derive but has the right public component"""
     common = pyre.property()
Exemple #18
0
 class protocol(pyre.protocol):
     """a trivial protocol"""
     p = pyre.property()
 class notok(pyre.protocol):
     """one that doesn't provide the right public protocol"""
     what = pyre.property()
Exemple #20
0
 class base(pyre.component):
     """the base component"""
     common = pyre.property()