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"
Esempio n. 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"""
Esempio n. 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
Esempio n. 5
0
 class derived(base):
     """a derived one, so automatically compatible"""
     extra = pyre.property()
Esempio n. 6
0
 class derived(a1, a2):
     """the derived one"""
     common = pyre.property()
     extra = pyre.property()
Esempio n. 7
0
 class base(pyre.protocol):
     """the base protocol"""
     common = pyre.property()
Esempio n. 8
0
 class a1(base):
     a1 = pyre.property()
Esempio n. 9
0
 class a2(base):
     a2 = pyre.property()
Esempio n. 10
0
 class derived(base):
     """the derived one"""
     common = pyre.property()
Esempio n. 11
0
 class component(pyre.component):
     """a trivial component"""
     p = pyre.property()
Esempio n. 12
0
 class ok(pyre.protocol):
     """one that doesn't derive but has the right public protocol"""
     common = pyre.property()
Esempio n. 13
0
 class base(pyre.component):
     """the base component"""
     common = pyre.property()
     common.default = "base.common"
Esempio n. 14
0
 class derived(base):
     """the derived one"""
     extra = pyre.property()
     extra.default = "derived.extra"
Esempio n. 15
0
 class derived(base):
     """the derived one"""
     extra = pyre.property()
Esempio n. 16
0
 class notok(pyre.component):
     """one that doesn't provide the right public component"""
     what = pyre.property()
Esempio n. 17
0
 class ok(pyre.component):
     """one that doesn't derive but has the right public component"""
     common = pyre.property()
Esempio n. 18
0
 class protocol(pyre.protocol):
     """a trivial protocol"""
     p = pyre.property()
Esempio n. 19
0
 class notok(pyre.protocol):
     """one that doesn't provide the right public protocol"""
     what = pyre.property()
Esempio n. 20
0
 class base(pyre.component):
     """the base component"""
     common = pyre.property()