# -*- coding: utf-8 -*-
"""
<DefineSource>
@Date : Fri Nov 14 13:20:38 2014 \n
@Author : Erwan Ledoux \n\n
</DefineSource>
A Weaver
"""
#<DefineAugmentation>
import ShareYourSystem as SYS
BaseModuleStr="ShareYourSystem.Applyiers.Linker"
DecorationModuleStr="ShareYourSystem.Classors.Classer"
SYS.setSubModule(globals())
#</DefineAugmentation>
#<ImportSpecificModules>
#</ImportSpecificModules>
#<DefineClass>
@DecorationClass()
class WeaverClass(BaseClass):
#Definition
RepresentingKeyStrsList=[
'WeavingInteractTuplesList'
]
def default_init(self,
_WeavingInteractTuplesList=None,
**_KwargVariablesDict):
#Call the parent __init__ method
BaseClass.__init__(self,**_KwargVariablesDict)
def do_weave(self):
""" """
#debug
'''
self.debug("self.UpdatingItemVariable is "+Representer.represent(
self.UpdatingItemVariable,**{'RepresentingAlineaIsBool':False}))
'''
#Apply
self.map('interact',map(
lambda __WeavingInteractTuple:
{'LiargVariablesList':__WeavingInteractTuple},
self.WeavingInteractTuplesList
)
)
#Return
#return self
#</DefineClass>
View the Weaver sources on Github
In [3]:
#ImportModules
import ShareYourSystem as SYS
from ShareYourSystem.Itemizers import Pointer
from ShareYourSystem.Applyiers import Weaver
#Update several things
MyWeaver=Weaver.WeaverClass().update(
map(
lambda __Int:
(
str(__Int)+'Pointer',
Pointer.PointerClass()
),
xrange(3)
)
).weave(
map(
lambda __Int:
(
[
str(__Int)+'Pointer',
str(__Int-1)+'Pointer',
],
str(__Int)+'-'+str(__Int-1)+'Pointer',
Pointer.PointerClass()
)
if __Int>0
else
(
[
str(0)+'Pointer',
str(2)+'Pointer',
],
str(0)+'-'+str(2)+'Pointer',
Pointer.PointerClass()
),
xrange(3)
)
)
#Definition the AttestedStr
SYS._attest(
[
'MyWeaver is '+SYS._str(
MyWeaver,
**{
'RepresentingBaseKeyStrsListBool':False,
'RepresentingAlineaIsBool':False
}
)
]
)
#Print