Interfacer

Doc


The Interfacer


View the Interfacer notebook on [NbViewer](http://nbviewer.ipython.org/url/shareyoursystem.ouvaton.org/Interfacer.ipynb)

Code



# -*- coding: utf-8 -*-
"""


<DefineSource>
@Date : Fri Nov 14 13:20:38 2014 \n
@Author : Erwan Ledoux \n\n
</DefineSource>


The Interfacer

"""

#<DefineAugmentation>
import ShareYourSystem as SYS
BaseModuleStr="ShareYourSystem.Standards.Objects.Rebooter"
DecorationModuleStr="ShareYourSystem.Standards.Classors.Classer"
SYS.setSubModule(globals())
#</DefineAugmentation>

#<ImportSpecificModules>
import os
#</ImportSpecificModules>

#<DefineLocals>
#</DefineLocals>

#<DefineClass>
@DecorationClass()
class InterfacerClass(BaseClass):

    #Definition
    RepresentingKeyStrsList=[
                                ]


    def default_init(self,
                        **_KwargVariablesDict
                    ):

        #Call the parent __init__ method
        BaseClass.__init__(self,**_KwargVariablesDict)

    #@Argumenter.ArgumenterClass()
    def do_interface(self,**_KwargVariablesDict):

        pass

        #Return self
        #return self

#</DefineClass>

View the Interfacer sources on Github

Example

Let's create an empty class, which will automatically receive special attributes from the decorating ClassorClass, specially the NameStr, that should be the ClassStr without the TypeStr in the end.


In [3]:
#ImportModules
import ShareYourSystem as SYS
from ShareYourSystem.Standards.Interfacers import Interfacer

#Definition 
MyInterfacer=Interfacer.InterfacerClass()

#Definition the AttestedStr
SYS._attest(
    [
        'MyInterfacer is '+SYS._str(
            MyInterfacer,
            **{
            'RepresentingAlineaIsBool':False
            })
    ]
) 

#Print



*****Start of the Attest *****

MyInterfacer is < (InterfacerClass), 4554249040>
   /{ 
   /  '<New><Instance>IdInt' : 4554249040
   /}

*****End of the Attest *****


Folderer

Doc


The Folderer is a quick object helping for getting the FolderedDirKeyStrsList at a specified directory or in the current one by default


View the Folderer notebook on [NbViewer](http://nbviewer.ipython.org/url/shareyoursystem.ouvaton.org/Folderer.ipynb)

Code



# -*- coding: utf-8 -*-
"""


<DefineSource>
@Date : Fri Nov 14 13:20:38 2014 \n
@Author : Erwan Ledoux \n\n
</DefineSource>


The Folderer is a quick object helping for getting the FolderedDirKeyStrsList
at a specified directory or in the current one by default

"""

#<DefineAugmentation>
import ShareYourSystem as SYS
BaseModuleStr="ShareYourSystem.Standards.Interfacers.Interfacer"
DecorationModuleStr="ShareYourSystem.Standards.Classors.Classer"
SYS.setSubModule(globals())
#</DefineAugmentation>

#<ImportSpecificModules>
import collections
import json
import os
import sys
#</ImportSpecificModules>

#<DefineClass>
@DecorationClass()
class FoldererClass(BaseClass):
    """
        FoldererClass ...

    """

    #Definition
    RepresentingKeyStrsList=[
                                    'FolderingPathVariable',
                                    'FolderingMkdirBool',
                                    'FolderedDirKeyStrsList',   
                                    'FolderedModuleStr',
                                    'FolderedParentModuleStr',
                                    'FolderedNameStr'
                                ]

    def default_init(self,
                        _FolderingPathVariable="",
                        _FolderingMkdirBool=False,
                        _FolderedDirKeyStrsList=None,   
                        _FolderedModuleStr="",
                        _FolderedParentModuleStr="",
                        _FolderedNameStr="",
                        **_KwargVariablesDict
                    ):

        #Call the parent __init__ method
        BaseClass.__init__(self,**_KwargVariablesDict)

    def do_folder(self,**_KwargVariablesDict):

        #Get the current
        FolderedCurrentPathStr=os.getcwd()

        #set
        if self.FolderingPathVariable=="":
            self.FolderingPathVariable=FolderedCurrentPathStr+'/'

        #debug
        '''
        print('self.FolderingPathVariable is '+self.FolderingPathVariable)
        print('FolderedCurrentPathStr is '+FolderedCurrentPathStr)
        print('')
        '''

        #Check
        if self.FolderingPathVariable!="":

            #Add the '/' if not in the end
            if self.FolderingPathVariable[-1]!="/":
                self.FolderingPathVariable+="/"

            #Build intermediar pathes
            if os.path.isdir(self.FolderingPathVariable)==False:

                #Check
                if self.FolderingMkdirBool:

                    #debug
                    '''
                    print('We are going to build the intermediar folder')
                    print('self.FolderingPathVariable is ',self.FolderingPathVariable)
                    print('')
                    '''

                    #Definition
                    FolderingPathVariablesList=self.FolderingPathVariable.split('/')
                    FolderedRootPathStr=FolderingPathVariablesList[0]
                    for _PathStr in FolderingPathVariablesList[1:]:

                        #debug
                        '''
                        print('FolderedRootPathStr is ',FolderedRootPathStr)
                        print('')
                        '''

                        #Mkdir if it doesn't exist
                        if FolderedRootPathStr!="" and os.path.isdir(FolderedRootPathStr)==False:
                            os.popen('mkdir '+FolderedRootPathStr)

                        #Add the following
                        FolderedRootPathStr+='/'+_PathStr

                    #Mkdir if it doesn't exist
                    if os.path.isdir(FolderedRootPathStr)==False:
                        os.popen('mkdir '+FolderedRootPathStr)

        #Recheck
        if os.path.isdir(self.FolderingPathVariable):

            #set
            self.FolderedDirKeyStrsList=os.listdir(self.FolderingPathVariable)

            #Check
            if '__init__.py' in self.FolderedDirKeyStrsList:

                #set maybe FolderedModuleStr and FolderedParentModuleStr if we are located in the SYS path
                if 'ShareYourSystem' in self.FolderingPathVariable:

                    #set
                    self.FolderedModuleStr='ShareYourSystem'+self.FolderingPathVariable.split(
                        'ShareYourSystem')[-1].replace('/','.')

                    #Remove the ossibly last dot
                    if self.FolderedModuleStr[-1]=='.':
                        self.FolderedModuleStr=self.FolderedModuleStr[:-1]

                    #set
                    if '.' in self.FolderedModuleStr:

                        #set
                        self.FolderedNameStr=self.FolderedModuleStr.split('.')[-1]

                        #debug
                        '''
                        self.debug(('self.',self,['FolderingPathVariable','FolderedNameStr']))
                        '''

                        #set the parent
                        self.FolderedParentModuleStr=self.FolderedNameStr.join(
                            self.FolderedModuleStr.split(self.FolderedNameStr)[:-1]
                        )
                        if len(self.FolderedParentModuleStr
                            )>0 and self.FolderedParentModuleStr[-1]=='.':
                            self.FolderedParentModuleStr=self.FolderedParentModuleStr[:-1]
                    else:
                        self.FolderedModuleStr=self.FolderedModuleStr

            else:

                #set
                self.FolderedModuleStr=""
                self.FolderedParentModuleStr=""

        #Return self
        #return self

#</DefineClass>

View the Folderer sources on Github

Example

Let's create an empty class, which will automatically receive special attributes from the decorating ClassorClass, specially the NameStr, that should be the ClassStr without the TypeStr in the end.


In [7]:
#ImportModules
import ShareYourSystem as SYS
from ShareYourSystem.Standards.Interfacers import Folderer

#Definition of an instance Folderer and make it find the current dir
MyFolderer=Folderer.FoldererClass(
    ).folder(
        Folderer.LocalFolderPathStr
    )

#If you don't have these folder, MyFolderer is going to create them for you
MyFolderer=Folderer.FoldererClass(
    ).folder(
        MyFolderer.FolderingPathVariable+'TestFolder1/TestFolder2/',
        True
    )

#Definition the AttestedStr
SYS._attest(
    [
        'MyFolderer is '+SYS._str(MyFolderer,
        **{'RepresentingAlineaIsBool':False})
    ]
) 

#Print



*****Start of the Attest *****

MyFolderer is < (FoldererClass), 4554249424>
   /{ 
   /  '<New><Instance>IdInt' : 4554249424
   /  '<Spe><Class>FolderedNameStr' : 
   /  '<Spe><Instance>FolderedDirKeyStrsList' : []
   /  '<Spe><Instance>FolderedModuleStr' : 
   /  '<Spe><Instance>FolderedParentModuleStr' : 
   /  '<Spe><Instance>FolderingMkdirBool' : True
   /  '<Spe><Instance>FolderingPathVariable' : /Users/ledoux/Documents/ShareYourSystem/Pythonlogy/ShareYourSystem/Interfacers/Folderer/TestFolder1/TestFolder2/
   /}

*****End of the Attest *****


Filer

Doc


The Filer is a quick object for opening a FiledHardVariable and safely using (read,write) it depending on the FiledModeStr.


View the Filer notebook on [NbViewer](http://nbviewer.ipython.org/url/shareyoursystem.ouvaton.org/Filer.ipynb)

Code



# -*- coding: utf-8 -*-
"""


<DefineSource>
@Date : Fri Nov 14 13:20:38 2014 \n
@Author : Erwan Ledoux \n\n
</DefineSource>


The Filer is a quick object for opening a FiledHardVariable and safely using (read,write) 
it depending on the FiledModeStr.

"""

#<DefineAugmentation>
import ShareYourSystem as SYS
BaseModuleStr="ShareYourSystem.Standards.Objects.Packager"
DecorationModuleStr="ShareYourSystem.Standards.Classors.Classer"
SYS.setSubModule(globals())
#</DefineAugmentation>

#<ImportSpecificModules>
import os
#</ImportSpecificModules>

#<DefineLocals>
FilingOrderStr='_'
#</DefineLocals>

#<DefineClass>
@DecorationClass()
class FilerClass(BaseClass):

    #Definition
    RepresentingKeyStrsList=[
                                'FilingKeyStr',
                                'FilingModeStr',
                                'FiledPathStr',
                                'FiledHardVariable'
                            ]


    def default_init(self,
                        _FilingKeyStr="",
                        _FilingModeStr='r',
                        _FiledPathStr="",
                        _FiledHardVariable=None,
                        **_KwargVariablesDict
                    ):

        #Call the parent __init__ method
        BaseClass.__init__(self,**_KwargVariablesDict)

    #@Argumenter.ArgumenterClass()
    def do_file(self,**_KwargVariablesDict):

        #Call the folder method before
        self.folder()

        #debug
        '''
        self.debug(('self.',self,['FolderingPathVariable']))
        '''

        #set the FiledPathStr
        if self.FolderingPathVariable[-1]!='/':
            self.FolderingPathVariable=self.FolderingPathVariable+'/'
        self.FiledPathStr=self.FolderingPathVariable+self.FilingKeyStr

        #debug
        '''
        self.debug(('self.',self,['FilingKeyStr','FiledPathStr','FilingModeStr']))
        '''

        #Close before if we chaneg the mode
        if self.FiledHardVariable!=None:

            #Check
            if self.FiledHardVariable==self.FiledPathStr:

                #Return if it is the same mode already
                if self.FiledHardVariable.mode==self.FilingModeStr:
                    return self

                #Check
                if self.FiledHardVariable.mode!='c':
                    if ('w' in self.FilingModeStr and self.FiledHardVariable.mode=='r'
                        ) or ('r'==self.FilingModeStr and 'w' in self.FiledHardVariable.mode):
                        self.FiledHardVariable.close()

            else:

                #Close
                self.FiledHardVariable.close()



        #Open the self.FilePointer
        if self.FilingModeStr=='r' and os.path.isfile(self.FiledPathStr):

            #debug
            '''
            self.debug('Open the file for reading !')
            '''

            #Open
            self.FiledHardVariable=open(self.FiledPathStr,self.FilingModeStr)

        else:

            #debug
            '''
            self.debug('Open the file for writing !')
            '''

            #Open
            self.FiledHardVariable=open(self.FiledPathStr,self.FilingModeStr)

        #Return self
        #return self

#</DefineClass>

View the Filer sources on Github

Example

Let's create an empty class, which will automatically receive special attributes from the decorating ClassorClass, specially the NameStr, that should be the ClassStr without the TypeStr in the end.


In [11]:
#ImportModules
import ShareYourSystem as SYS
from ShareYourSystem.Standards.Interfacers import Filer

#Definition of an instance Filer and make it find the current dir
MyFiler=Filer.FilerClass().file('MyFile.txt','w',
    **{
    'FolderingPathVariable':
    Filer.LocalFolderPathStr
    }
)

#close
MyFiler.FiledHardVariable.close()

#Definition the AttestedStr
SYS._attest(
    [
        'MyFiler is '+SYS._str(MyFiler,
        **{'RepresentingAlineaIsBool':False})
    ]
) 

#Print



*****Start of the Attest *****

MyFiler is < (FilerClass), 4554249616>
   /{ 
   /  '<New><Instance>IdInt' : 4554249616
   /  '<Spe><Instance>FiledHardVariable' : <closed file '/Users/ledoux/Documents/ShareYourSystem/Pythonlogy/ShareYourSystem/Interfacers/Filer/MyFile.txt', mode 'w' at 0x10e66b420>
   /  '<Spe><Instance>FiledPathStr' : /Users/ledoux/Documents/ShareYourSystem/Pythonlogy/ShareYourSystem/Interfacers/Filer/MyFile.txt
   /  '<Spe><Instance>FilingKeyStr' : MyFile.txt
   /  '<Spe><Instance>FilingModeStr' : w
   /}

*****End of the Attest *****


Closer

Doc


The Closer


View the Closer notebook on [NbViewer](http://nbviewer.ipython.org/url/shareyoursystem.ouvaton.org/Closer.ipynb)

Code



# -*- coding: utf-8 -*-
"""


<DefineSource>
@Date : Fri Nov 14 13:20:38 2014 \n
@Author : Erwan Ledoux \n\n
</DefineSource>


The Closer
"""

#<DefineAugmentation>
import ShareYourSystem as SYS
BaseModuleStr="ShareYourSystem.Standards.Interfacers.Filer"
DecorationModuleStr="ShareYourSystem.Standards.Classors.Classer"
SYS.setSubModule(globals())
#</DefineAugmentation>

#<ImportSpecificModules>
#</ImportSpecificModules>

#<DefineDoStrsList>
DoStrsList=["Closer","Close","Closing","Closed"]
#<DefineDoStrsList>

#<DefineClass>
@DecorationClass()
class CloserClass(BaseClass):

    #Definition
    RepresentingKeyStrsList=[
                                ]

    def default_init(self,
                        **_KwargVariablesDict
                    ):

        #Call the parent __init__ method
        BaseClass.__init__(self,**_KwargVariablesDict)

    def do_close(self):

        #close
        self.FiledHardVariable.close()

        #Return self
        #return self

#</DefineClass>

View the Closer sources on Github

Example

Let's create an empty class, which will automatically receive special attributes from the decorating ClassorClass, specially the NameStr, that should be the ClassStr without the TypeStr in the end.


In [15]:
#ImportModules
import ShareYourSystem as SYS
from ShareYourSystem.Standards.Interfacers import Closer

#Definition of an instance Closer and make it find the current dir
MyCloser=Closer.CloserClass().file('MyFile.txt','w').close()

#Definition the AttestedStr
SYS._attest(
    [
        'MyCloser is '+SYS._str(
            MyCloser,
            **{
                'RepresentingAlineaIsBool':False
            }
        )
    ]
) 

#Print



*****Start of the Attest *****

MyCloser is < (CloserClass), 4554249360>
   /{ 
   /  '<New><Instance>IdInt' : 4554249360
   /}

*****End of the Attest *****


Loader

Doc


The Loader is a quick object to load from a FiledHardVariable a LoadedReadVariable


View the Loader notebook on [NbViewer](http://nbviewer.ipython.org/url/shareyoursystem.ouvaton.org/Loader.ipynb)

Code



# -*- coding: utf-8 -*-
"""


<DefineSource>
@Date : Fri Nov 14 13:20:38 2014 \n
@Author : Erwan Ledoux \n\n
</DefineSource>


The Loader is a quick object to load from a FiledHardVariable a LoadedReadVariable

"""

#<DefineAugmentation>
import ShareYourSystem as SYS
BaseModuleStr="ShareYourSystem.Standards.Interfacers.Closer"
DecorationModuleStr="ShareYourSystem.Standards.Classors.Classer"
SYS.setSubModule(globals())
#</DefineAugmentation>

#<ImportSpecificModules>
import json
import yaml
#</ImportSpecificModules>

#<DefineClass>
@DecorationClass()
class LoaderClass(BaseClass):

    #Definition
    RepresentingKeyStrsList=[
                                    'LoadingFormatStr',
                                    'LoadedReadVariable',
                                    'FiledHardVariable'
                                ]

    def default_init(self,
                        _LoadingFormatStr='txt',
                        _LoadedReadVariable=None,
                        _FiledHardVariable=None,
                        **_KwargVariablesDict
                    ):

        #Call the parent __init__ method
        BaseClass.__init__(self,**_KwargVariablesDict)

    def do_load(self,**_KwargVariablesDict):

        #debug
        '''
        self.debug(('self.',self,['LoadingFormatStr']))
        '''

        #file first
        self.file(_ModeStr='r')

        #Check
        if self.LoadingFormatStr=='txt':

            #Read the FiledHardVariable
            self.LoadedReadVariable=self.FiledHardVariable.read()

        elif self.LoadingFormatStr=='json':

            #Use the json decoder
            self.LoadedReadVariable=json.load(self.FiledHardVariable)

        elif self.LoadingFormatStr=='yaml':

            #Use the json decoder
            self.LoadedReadVariable=yaml.load(self.FiledHardVariable)

        #Return self
        #return self

#</DefineClass>

View the Loader sources on Github

Example

Let's create an empty class, which will automatically receive special attributes from the decorating ClassorClass, specially the NameStr, that should be the ClassStr without the TypeStr in the end.


In [19]:
#ImportModules
import ShareYourSystem as SYS
from ShareYourSystem.Standards.Interfacers import Loader

#Definition of an instance Loader and make it find the current dir
MyLoader=Loader.LoaderClass().file('MyFile.txt','w')
MyLoader.FiledHardVariable.write('hello')
MyLoader.FiledHardVariable.close()
MyLoader.load()

#Definition the AttestedStr
SYS._attest(
    [
        'MyLoader is '+SYS._str(MyLoader,
            **{'RepresentingAlineaIsBool':False}
        )
    ]
) 

#Print



*****Start of the Attest *****

MyLoader is < (LoaderClass), 4554249552>
   /{ 
   /  '<New><Instance>IdInt' : 4554249552
   /  '<Spe><Class>LoadingFormatStr' : txt
   /  '<Spe><Instance>LoadedReadVariable' : hello
   /}

*****End of the Attest *****


Writer

Doc


The Writer is a quick object to write from a LoadedReadVariable.


View the Writer notebook on [NbViewer](http://nbviewer.ipython.org/url/shareyoursystem.ouvaton.org/Writer.ipynb)

Code



# -*- coding: utf-8 -*-
"""


<DefineSource>
@Date : Fri Nov 14 13:20:38 2014 \n
@Author : Erwan Ledoux \n\n
</DefineSource>


The Writer is a quick object to write from a LoadedReadVariable.

"""

#<DefineAugmentation>
import ShareYourSystem as SYS
BaseModuleStr="ShareYourSystem.Standards.Interfacers.Loader"
DecorationModuleStr="ShareYourSystem.Standards.Classors.Classer"
SYS.setSubModule(globals())
#</DefineAugmentation>

#<ImportSpecificModules>
import json
import yaml
#</ImportSpecificModules>

#<DefineClass>
@DecorationClass()
class WriterClass(BaseClass):

    #Definition
    RepresentingKeyStrsList=[
                                    'WritingStoreVariable',
                                    'WritingLoadBool'
                                ]

    def default_init(self,
                        _WritingStoreVariable=None,
                        _WritingLoadBool=False,
                        **_KwargVariablesDict
                    ):

        #Call the parent __init__ method
        BaseClass.__init__(self,**_KwargVariablesDict)

    def do_write(self):

        #debug
        '''
        self.debug([
                        ('Before file'),
                        ('self.',self,[
                                    'FolderingPathVariable',
                                ])
                ])
        '''

        #file first
        self.file(_ModeStr='w')

        #debug
        '''
        self.debug([
                        ('After file'),
                        ('self.',self,[
                                    'FolderingPathVariable',
                                    'WritingLoadBool'
                                ])
                ])
        '''

        #Check
        if self.WritingLoadBool:
            self.WritingStoreVariable=self.LoadedReadVariable

        #debug
        '''
        self.debug(('self.',self,[
                                    'FiledHardVariable',
                                    'FolderingPathVariable',
                                    'LoadingFormatStr',
                                    'WritingStoreVariable'
                                ]))
        '''

        #Check
        if self.LoadingFormatStr=='txt':

            #Read the FiledHardVariable
            self.FiledHardVariable.write(self.WritingStoreVariable)

        elif self.LoadingFormatStr=='json':

            #debug
            '''
            self.debug(
                        [
                            'we write in json...',
                            'json.dumps(self.WritingStoreVariable,indent=2) is '+str(json.dumps(self.WritingStoreVariable,indent=2))
                        ]
                )
            '''

            #Use the json decoder
            self.FiledHardVariable.write(
                json.dumps(self.WritingStoreVariable,indent=2)
            )

        elif self.LoadingFormatStr=='yaml':

            #debug
            '''
            print('We yamelized !')
            print('self.FiledHardVariable is ',self.FiledHardVariable)
            print('self.WritingStoreVariable is ',self.WritingStoreVariable)
            print('')
            '''

            #Use the json decoder
            self.FiledHardVariable.write(
                yaml.dump(self.WritingStoreVariable,indent=2)
            )

        #Return self
        #return self

#</DefineClass>

View the Writer sources on Github

Example

Let's create an empty class, which will automatically receive special attributes from the decorating ClassorClass, specially the NameStr, that should be the ClassStr without the TypeStr in the end.


In [23]:
#ImportModules
import ShareYourSystem as SYS
from ShareYourSystem.Standards.Interfacers import Writer

#Definition of an instance Writer and make it find the current dir
MyWriter=Writer.WriterClass().write("hello",**{
    'FolderingPathVariable':Writer.LocalFolderPathStr,
    'FilingKeyStr':'MyFile.txt',
    'FilingModeStr':'w'
    }
)

#Definition the AttestedStr
SYS._attest(
    [
        'MyWriter is '+SYS._str(MyWriter)
    ]
) 

#Print



*****Start of the Attest *****

MyWriter is < (WriterClass), 4554250064>
   /{ 
   /  '<New><Instance>IdInt' : 4554250064
   /  '<Spe><Class>WritingLoadBool' : False
   /  '<Spe><Instance>WritingStoreVariable' : hello
   /}

*****End of the Attest *****


Deployer

Doc


The Deployer


View the Deployer notebook on [NbViewer](http://nbviewer.ipython.org/url/shareyoursystem.ouvaton.org/Deployer.ipynb)

Code



# -*- coding: utf-8 -*-
"""


<DefineSource>
@Date : Fri Nov 14 13:20:38 2014 \n
@Author : Erwan Ledoux \n\n
</DefineSource>


The Deployer

"""

#<DefineAugmentation>
import ShareYourSystem as SYS
BaseModuleStr="ShareYourSystem.Standards.Interfacers.Capturer"
DecorationModuleStr="ShareYourSystem.Standards.Classors.Classer"
SYS.setSubModule(globals())
#</DefineAugmentation>

#<ImportSpecificModules>
import os
import ftplib
#</ImportSpecificModules>

#<DefineClass>
@DecorationClass()
class DeployerClass(BaseClass):

    #Definition
    RepresentingKeyStrsList=[
                        'DeployingUrlStr',
                        'DeployingLoginStr',
                        'DeployingPwdStr',
                        'DeployingClientFilePathStrToServerFilePathStrOrderedDict',
                        'DeployedFtplibVariable',
                        'DeployedDirKeyStrsList'
                    ]

    def default_init(self,
                        _DeployingUrlStr="ftp.ouvaton.coop",
                        _DeployingLoginStr="shareyoursystemhz",
                        _DeployingPwdStr="share",
                        _DeployingClientFilePathStrToServerFilePathStrOrderedDict=None,
                        _DeployedFtplibVariable=None,
                        _DeployedDirKeyStrsList=None,
                        **_KwargVariablesDict
                    ):

        #Call the parent __init__ method
        BaseClass.__init__(self,**_KwargVariablesDict)

    def do_deploy(self):

        #open and login
        self.DeployedFtplibVariable = ftplib.FTP(self.DeployingUrlStr);
        self.DeployedFtplibVariable.login(
            user=self.DeployingLoginStr,
            passwd=self.DeployingPwdStr
        );

        """
        #delete all the files in the root folder
        self.DeployedFtplibVariable.cwd(self.DeployingServerFolderPathStr);
        for __ListedVariable in self.DeployedFtplibVariable.nlst():
            try:
                self.DeployedFtplibVariable.delete(__ListedVariable);
            except Exception:
                self.DeployedFtplibVariable.rmd(__ListedVariable);

        #delete the dir and create a new one
        try:
            self.DeployedFtplibVariable.rmd(self.DeployingServerFolderPathStr);
        except Exception:
            pass;
        self.DeployedFtplibVariable.mkd(self.DeployingServerFolderPathStr);
        """

        #debug
        self.debug(('self.',self,[
                                    'DeployingClientFilePathStrToServerFilePathStrOrderedDict'
                                ]))

        #store
        map(
                lambda __DeployingClientFilePathStrToServerFilePathStrItemTuple:
                self.DeployedFtplibVariable.storbinary(
                    'STOR '+__DeployingClientFilePathStrToServerFilePathStrItemTuple[1],
                    open(
                        __DeployingClientFilePathStrToServerFilePathStrItemTuple[0], 
                        'rb'
                        )
                ),
                self.DeployingClientFilePathStrToServerFilePathStrOrderedDict.items()
            )

        #ls
        self.DeployedDirKeyStrsList=map(
            lambda __DeployingClientFilePathStrToServerFilePathStrItemTuple:
            self.DeployedFtplibVariable.nlst(
                __DeployingClientFilePathStrToServerFilePathStrItemTuple[1]
            ),
            self.DeployingClientFilePathStrToServerFilePathStrOrderedDict.items()
        )

        #quit
        self.DeployedFtplibVariable.quit();

#</DefineClass>

View the Deployer sources on Github


In [26]:
#ImportModules
import ShareYourSystem as SYS

from ShareYourSystem.Standards.Interfacers import Folderer,Deployer

#Definition a Deployer
try:
    MyDeployer=Deployer.DeployerClass().deploy()
except:
    MyDeployer=Deployer.DeployerClass()

#Definition the AttestedStr
SYS._attest(
    [
        'MyDeployer is '+SYS._str(
        MyDeployer,
        **{
            'RepresentingBaseKeyStrsListBool':False,
            'RepresentingAlineaIsBool':False
        }
        )
    ]
)  

#Print


                    
                    xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
                    ////////////////////////////////
                    Deployer/__init__.py do_deploy
                    From Deployer/__init__.py do_deploy | site-packages/six.py exec_ | Celler/__init__.py do_cell | Notebooker/__init__.py do_notebook | Documenter/__init__.py do_inform | inform.py <module>
                    ////////////////////////////////
                    
                    l.82 : 
                    *****
                    I am with []
                    *****
                    self.DeployingClientFilePathStrToServerFilePathStrOrderedDict is 
                       /{ 
                       /}
                    
                    xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
                                        


*****Start of the Attest *****

MyDeployer is < (DeployerClass), 4554249168>
   /{ 
   /  '<New><Instance>IdInt' : 4554249168
   /  '<Spe><Class>DeployingLoginStr' : shareyoursystemhz
   /  '<Spe><Class>DeployingPwdStr' : share
   /  '<Spe><Class>DeployingUrlStr' : ftp.ouvaton.coop
   /  '<Spe><Instance>DeployedDirKeyStrsList' : []
   /  '<Spe><Instance>DeployedFtplibVariable' : <ftplib.FTP instance at 0x10f748710>
   /  '<Spe><Instance>DeployingClientFilePathStrToServerFilePathStrOrderedDict' : 
   /   /{ 
   /   /}
   /}

*****End of the Attest *****


Hdformater

Doc


An Hdformater instance maps an apply and so "grinds" a MappingArgDictsList to a method.


View the Hdformater notebook on [NbViewer](http://nbviewer.ipython.org/url/shareyoursystem.ouvaton.org/Hdformater.ipynb)

Code



# -*- coding: utf-8 -*-
"""


<DefineSource>
@Date : Fri Nov 14 13:20:38 2014 \n
@Author : Erwan Ledoux \n\n
</DefineSource>


An Hdformater instance maps an apply and so "grinds" a MappingArgDictsList 
to a method.

"""

#<DefineAugmentation>
import ShareYourSystem as SYS
BaseModuleStr="ShareYourSystem.Standards.Interfacers.Writer"
DecorationModuleStr="ShareYourSystem.Standards.Classors.Classer"
SYS.setSubModule(globals())
#</DefineAugmentation>

#<ImportSpecificModules>
import collections
import importlib
import os
import sys
#from ShareYourSystem.Functers import Alerter
#</ImportSpecificModules>

#<DefineClass>
@DecorationClass(**{'SwitchingUnboundMethodStr':'hdformat'})
class HdformaterClass(BaseClass):

    #Definition
    RepresentingKeyStrsList=[
                                    'HdformatingModuleStr',
                                    'HdformatingFileKeyStr',
                                    'HdformatedFileVariable',
                                    'HdformatedConsoleStr'
                                ]

    #@Hooker.HookerClass(**{'HookingAfterVariablesList':[{'CallingVariable':BaseClass.__init__}]})
    def default_init(self,
            _HdformatingModuleStr="tables",
            _HdformatingFileKeyStr="",          
            _HdformatedFileVariable=None, 
            _HdformatedFilePathStr="",      
            _HdformatedConsoleStr="",           
            **_KwargVariablesDict
        ):

        #Call the parent __init__ method
        BaseClass.__init__(self,**_KwargVariablesDict)

    #@Alerter.AlerterClass()        
    #@Switcher.SwitcherClass()
    def do_hdformat(self):

        #debug
        '''
        self.debug(('self.',self,[
                                    'HdformatingFileKeyStr'
                                ]))
        '''

        #Check
        if self.HdformatedFileVariable==None:

            #folder first
            self.folder()

            #set
            self.HdformatedFilePathStr=self.FolderingPathVariable+self.HdformatingFileKeyStr

            #Maybe we have to import
            if self.HdformatingModuleStr not in sys.modules:

                #debug
                '''
                self.debug('We import first the hdf module')
                '''

                #Import
                importlib.import_module(self.HdformatingModuleStr)

            #Check
            if self.HdformatingFileKeyStr!="":

                #Check for first write
                if os.path.isfile(self.HdformatedFilePathStr)==False:

                    #debug
                    '''
                    self.debug('We create the file first')
                    '''

                    #Create the file 
                    self.HdformatedFileVariable=sys.modules[self.HdformatingModuleStr].File(
                                        self.HdformatedFilePathStr,'w')

                    #Close it
                    self.HdformatedFileVariable.close()

                if self.HdformatedFileVariable==None or ( 
                    (self.HdformatingModuleStr=='tables' and self.HdformatedFileVariable.isopen==0
                        ) or (self.HdformatingModuleStr=='h5py' and self.HdformatedFileVariable.mode=='c') ):

                    #debug
                    '''
                    self.debug('We open the file')
                    '''

                    #Open the HdformatedFileVariable
                    self.HdformatedFileVariable=sys.modules[self.HdformatingModuleStr].File(
                        self.HdformatedFilePathStr,'r+')

        #Return self
        #return self

    def hdfview(self):

        #debug
        '''
        self.debug(('self.',self,['HdformatingFilePathStr']))
        '''

        if self.HdformatedFilePathStr!="":

            #set the HdformatedConsoleStr
            self.HdformatedConsoleStr=os.popen(
                                        SYS.h5lsPathStr+' -dlr '+self.HdformatedFilePathStr
                                ).read()

        #Return self
        return self

    def hdfclose(self):

        #Close the HdformatedFileVariable
        if self.HdformatedFileVariable!=None:
            self.HdformatedFileVariable.close()

        #Return self
        return self

#</DefineClass>

View the Hdformater sources on Github

Example

Let's create an empty class, which will automatically receive special attributes from the decorating ClassorClass, specially the NameStr, that should be the ClassStr without the TypeStr in the end.


In [30]:
#ImportModules
import ShareYourSystem as SYS
from ShareYourSystem.Standards.Interfacers import Hdformater

#Definition a Hdformater that writes an empty hdf file
MyHdformater=Hdformater.HdformaterClass().hdformat(
    _FileKeyStr='Hdformats.hdf5',
    **{
    'FolderingPathVariable':Hdformater.LocalFolderPathStr
}
).hdfview().hdfclose()

#Definition the AttestedStr
SYS._attest(
    [
        'MyHdformater.HdformatedConsoleStr is '+str(
            MyHdformater.HdformatedConsoleStr)
    ]
) 

#Print



*****Start of the Attest *****

MyHdformater.HdformatedConsoleStr is /                        Group


*****End of the Attest *****


Capturer

Doc


The Capturer


View the Capturer notebook on [NbViewer](http://nbviewer.ipython.org/url/shareyoursystem.ouvaton.org/Capturer.ipynb)

Code



# -*- coding: utf-8 -*-
"""


<DefineSource>
@Date : Fri Nov 14 13:20:38 2014 \n
@Author : Erwan Ledoux \n\n
</DefineSource>


The Capturer

"""

#<DefineAugmentation>
import ShareYourSystem as SYS
BaseModuleStr="ShareYourSystem.Standards.Interfacers.Hdformater"
DecorationModuleStr="ShareYourSystem.Standards.Classors.Classer"
SYS.setSubModule(globals())
#</DefineAugmentation>

#<ImportSpecificModules>
from cStringIO import StringIO
import sys
import copy
#</ImportSpecificModules>

#<DefineClass>
@DecorationClass()
class CapturerClass(BaseClass):

    #Definition
    RepresentingKeyStrsList=[
                                'CapturingStopBool',
                                'CapturedStdoutVariable',
                                'CapturedPrintStrsList'
                            ]

    def default_init(self,
                        _CapturingStopBool={
                                'DefaultValueType':property,
                                'PropertyInitVariable':False,
                                'PropertyDocStr':''
                        },
                        _CapturedStdoutVariable=sys.stdout,
                        _CapturedPrintStrsList=None,
                        **_KwargVariablesDict
                    ):

        #Call the parent __init__ method
        BaseClass.__init__(self,**_KwargVariablesDict)

    def setCapturingStopBool(self,_SettingValueVariable):

        #set
        self._CapturingStopBool=_SettingValueVariable

        #reset the CapturedStrsList
        if _SettingValueVariable:

            #Check
            if self.CapturedPrintStrsList!=None:

                if hasattr(sys.stdout,'getvalue'):

                    #extend
                    self.CapturedPrintStrsList.extend(
                        sys.stdout.getvalue().splitlines()
                    )

            #reset
            sys.stdout = self.CapturedStdoutVariable

    def do_capture(self):

        #debug
        '''
        self.debug('We capture here ')
        '''

        #set
        self.CapturedStdoutVariable = sys.stdout

        #init
        sys.stdout = StringIO()

        #Return self
        #return self

#</DefineClass>

View the Capturer sources on Github

Example

Let's create an empty class, which will automatically receive special attributes from the decorating ClassorClass, specially the NameStr, that should be the ClassStr without the TypeStr in the end.


In [34]:
#ImportModules
import ShareYourSystem as SYS
from ShareYourSystem.Standards.Interfacers import Capturer

#Definition a Capturer
MyCapturer=Capturer.CapturerClass().capture()
print('Hello !')
print('Bonjour !')
MyCapturer.CapturingStopBool=True
print('Y a quelqu un?')

#Definition the AttestedStr
SYS._attest(
    [
        'MyCapturer is '+SYS._str(
        MyCapturer,
        **{
            'RepresentingBaseKeyStrsListBool':False
        }
        )
    ]
)  

#Print


Y a quelqu un?


*****Start of the Attest *****

MyCapturer is < (CapturerClass), 4554249360>
   /{ 
   /  '<New><Instance>IdInt' : 4554249360
   /  '<New><Instance>_CapturingStopBool' : True
   /  '<Spe><Class>CapturingStopBool' : True
   /  '<Spe><Instance>CapturedPrintStrsList' : ['Hello !', 'Bonjour !']
   /  '<Spe><Instance>CapturedStdoutVariable' : <cStringIO.StringO object at 0x10f74d308>
   /}

*****End of the Attest *****


Processer

Doc


The Processer


View the Processer notebook on [NbViewer](http://nbviewer.ipython.org/url/shareyoursystem.ouvaton.org/Processer.ipynb)

Code



# -*- coding: utf-8 -*-
"""


<DefineSource>
@Date : Fri Nov 14 13:20:38 2014 \n
@Author : Erwan Ledoux \n\n
</DefineSource>


The Processer

"""

#<DefineAugmentation>
import ShareYourSystem as SYS
BaseModuleStr="ShareYourSystem.Standards.Interfacers.Capturer"
DecorationModuleStr="ShareYourSystem.Standards.Classors.Representer"
SYS.setSubModule(globals())
#</DefineAugmentation>

#<ImportSpecificModules>
import os
#</ImportSpecificModules>

#<DefineLocals>
ProcessingFileStr="ProcessTemp"
#</DefineLocals>

#<DefineClass>
@DecorationClass()
class ProcesserClass(BaseClass):

    #Definition
    RepresentingKeyStrsList=[
                                'ProcessingBashStr',
                                'ProcessedBashStr'
                            ]

    def default_init(self,
                        _ProcessingBashStr="",
                        _ProcessedBashStr="",
                        **_KwargVariablesDict
                    ):

        #Call the parent init method
        BaseClass.__init__(self,**_KwargVariablesDict)

    #<DefineDoMethod>   
    def do_process(self):

        #file
        self.file(ProcessingFileStr+'.sh','w')

        #Define
        ProcessedBashPathStr=self.FolderingPathVariable+ProcessingFileStr+'.txt'

        #set
        self.ProcessedBashStr='OUTPUT="$('+self.ProcessingBashStr+')"\n'
        self.ProcessedBashStr+='echo "${OUTPUT}" > '+ProcessedBashPathStr

        #write
        self.FiledHardVariable.write(
            self.ProcessedBashStr
        )
        self.FiledHardVariable.close()

        #debug
        '''
        self.debug(('self.',self,[
                                    'FiledPathStr',
                                ]))
        '''

        #popen
        os.popen('sh '+self.FiledPathStr)

        #load
        self.ProcessedBashStr=self.load(    
                    **{
                        'FilingKeyStr':ProcessingFileStr+'.txt',
                        'FilingModeStr':'r'
                    }
                ).LoadedReadVariable

#</DefineClass>

View the Processer sources on Github

Example

Let's create an empty class, which will automatically receive special attributes from the decorating ClassorClass, specially the NameStr, that should be the ClassStr without the TypeStr in the end.


In [38]:
#ImportModules
import ShareYourSystem as SYS
from ShareYourSystem.Standards.Interfacers import Processer

#Definition of an instance Processer and make it print hello
MyProcesser=Processer.ProcesserClass().process('which python ',
    **{
    'FolderingPathVariable':Processer.LocalFolderPathStr
    }
)
    
#Definition the AttestedStr
SYS._attest(
    [
        'MyProcesser is '+SYS._str(MyProcesser)
    ]
) 

#Print



*****Start of the Attest *****

MyProcesser is < (ProcesserClass), 4554250704>
   /{ 
   /  '<New><Instance>IdInt' : 4554250704
   /  '<Spe><Instance>ProcessedBashStr' : /usr/local/bin/python

   /  '<Spe><Instance>ProcessingBashStr' : which python 
   /}

*****End of the Attest *****


Statuser

Doc


The Statuser


View the Statuser notebook on [NbViewer](http://nbviewer.ipython.org/url/shareyoursystem.ouvaton.org/Statuser.ipynb)

Code



# -*- coding: utf-8 -*-
"""


<DefineSource>
@Date : Fri Nov 14 13:20:38 2014 \n
@Author : Erwan Ledoux \n\n
</DefineSource>


The Statuser

"""

#<DefineAugmentation>
import ShareYourSystem as SYS
BaseModuleStr="ShareYourSystem.Standards.Interfacers.Processer"
DecorationModuleStr="ShareYourSystem.Standards.Classors.Classer"
SYS.setSubModule(globals())
#</DefineAugmentation>

#<ImportSpecificModules>
import os
#</ImportSpecificModules>

#<DefineClass>
@DecorationClass()
class StatuserClass(BaseClass):

    #Definition
    RepresentingKeyStrsList=[
                                    'StatusingProcessStr',
                                    'StatusedSnapshotStr',
                                    'StatusedLineStrsList',
                                    'StatusedIdStrsList'
                                ]

    def default_init(self,
                        _StatusingProcessStr="",
                        _StatusedSnapshotStr="",
                        _StatusedLineStrsList=None,
                        _StatusedIdStrsList=None,
                        **_KwargVariablesDict
                    ):

        #Call the parent __init__ method
        BaseClass.__init__(self,**_KwargVariablesDict)

    def do_status(self):

        #Check
        if self.StatusingProcessStr!="":

            #call
            self.StatusedSnapshotStr=self.process(
                "ps -ef | grep "+self.StatusingProcessStr
            ).ProcessedBashStr

            #debug
            '''
            self.debug(('self.',self,['StatusedSnapshotStr']))
            '''

            #map
            self.StatusedLineStrsList=SYS._filter(
                    lambda __LineStr:
                    SYS.PythonPathStr in __LineStr,
                    self.StatusedSnapshotStr.split('\n')
                )

            #debug
            '''
            self.debug(('self.',self,['StatusedLineStrsList']))
            '''

            #call
            self.StatusedIdStrsList=map(
                lambda __LineStr:
                __LineStr.split()[1],
                self.StatusedLineStrsList   
            )

            #debug
            '''
            self.debug(('self.',self,['StatusedIdStrsList']))
            '''

        #Return self
        #return self

#</DefineClass>

View the Statuser sources on Github


In [41]:
#ImportModules
import ShareYourSystem as SYS
from ShareYourSystem.Standards.Interfacers import Statuser
import os

#Definition a Statuser
MyStatuser=Statuser.StatuserClass().status('Python')

#Definition the AttestedStr
SYS._attest(
    [
        'MyStatuser is '+SYS._str(
        MyStatuser,
        **{
            'RepresentingBaseKeyStrsListBool':False
        }
        )
    ]
)  

#Print



*****Start of the Attest *****

MyStatuser is < (StatuserClass), 4554248976>
   /{ 
   /  '<New><Instance>IdInt' : 4554248976
   /  '<Spe><Instance>StatusedIdStrsList' : ['15410']
   /  '<Spe><Instance>StatusedLineStrsList' : ['  501 15410 12535   0  5:55PM ttys000    0:01.18 /usr/local/Cellar/python/2.7.9/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python inform.py']
   /  '<Spe><Instance>StatusedSnapshotStr' :   501 15410 12535   0  5:55PM ttys000    0:01.18 /usr/local/Cellar/python/2.7.9/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python inform.py
  501 16092 16090   0  5:56PM ttys000    0:00.00 grep Python

   /  '<Spe><Instance>StatusingProcessStr' : Python
   /}

*****End of the Attest *****


Killer

Doc


The Killer


View the Killer notebook on [NbViewer](http://nbviewer.ipython.org/url/shareyoursystem.ouvaton.org/Killer.ipynb)

Code



# -*- coding: utf-8 -*-
"""


<DefineSource>
@Date : Fri Nov 14 13:20:38 2014 \n
@Author : Erwan Ledoux \n\n
</DefineSource>


The Killer

"""

#<DefineAugmentation>
import ShareYourSystem as SYS
BaseModuleStr="ShareYourSystem.Standards.Interfacers.Statuser"
DecorationModuleStr="ShareYourSystem.Standards.Classors.Classer"
SYS.setSubModule(globals())
#</DefineAugmentation>

#<ImportSpecificModules>
import os
#</ImportSpecificModules>

#<DefineDoStrsList>
DoStrsList=["Killer","Kill","Killing","Killed"]
#<DefineDoStrsList>

#<DefineClass>
@DecorationClass()
class KillerClass(BaseClass):

    #Definition
    RepresentingKeyStrsList=[
                            ]

    def default_init(self,
                        **_KwargVariablesDict
                    ):

        #Call the parent __init__ method
        BaseClass.__init__(self,**_KwargVariablesDict)

    def do_kill(self):

        #first status
        self.status()

        #debug
        '''
        self.debug(('self.',self,['StatusedIdStrsList']))
        '''

        #map kill the other previous process
        if self.StatusingProcessStr=='Python' and len(self.StatusedIdStrsList)>1:
            map(
                lambda __IdStr:
                os.popen("kill "+__IdStr),
                sorted(self.StatusedIdStrsList)[:-1]
            )

        #Return self
        #return self

#</DefineClass>

View the Killer sources on Github


In [44]:
#ImportModules
import ShareYourSystem as SYS
from ShareYourSystem.Standards.Interfacers import Killer

#Definition a Killer
MyKiller=Killer.KillerClass().kill(**{'StatusingProcessStr':"Python"})

#Definition the AttestedStr
SYS._attest(
    [
        'MyKiller is '+SYS._str(
        MyKiller,
        **{
            'RepresentingBaseKeyStrsListBool':False,
            'RepresentingAlineaIsBool':False
        }
        )
    ]
)  

#Print



*****Start of the Attest *****

MyKiller is < (KillerClass), 4554250064>
   /{ 
   /  '<New><Instance>IdInt' : 4554250064
   /}

*****End of the Attest *****


Directer

Doc


The Directer is a walker through the folders of the harddrive, assuring a call of _DirectingCallbackFunction at each level.


View the Directer notebook on [NbViewer](http://nbviewer.ipython.org/url/shareyoursystem.ouvaton.org/Directer.ipynb)

Code



# -*- coding: utf-8 -*-
"""


<DefineSource>
@Date : Fri Nov 14 13:20:38 2014 \n
@Author : Erwan Ledoux \n\n
</DefineSource>


The Directer is a walker through the folders of the harddrive, 
assuring a call of _DirectingCallbackFunction at each level.

"""

#<DefineAugmentation>
import ShareYourSystem as SYS
BaseModuleStr="ShareYourSystem.Standards.Interfacers.Killer"
DecorationModuleStr="ShareYourSystem.Standards.Classors.Classer"
SYS.setSubModule(globals())
#</DefineAugmentation>

#<ImportSpecificModules>
import os
from ShareYourSystem.Functers import Argumenter
#</ImportSpecificModules>

#<DefineClass>
@DecorationClass()
class DirecterClass(BaseClass):

    #Definition
    RepresentingKeyStrsList=[
                                    'DirectingCallbackFunction',
                                    'DirectingLiargVariablesList',
                                    'DirectingFilterFunctionPointer'
                                ]

    def default_init(self,
                        _DirectingCallbackFunction=None,
                        _DirectingLiargVariablesList=None,
                        _DirectingFilterFunctionPointer=None,
                        **_KwargVariablesDict
                    ):

        #Call the parent __init__ method
        BaseClass.__init__(self,**_KwargVariablesDict)

    #@Argumenter.ArgumenterClass()
    def do_direct(self):

        #Call the folder method before
        self.folder()

        #debug
        '''
        print('Directer l.62')
        print('self.FolderingPathVariable is ',self.FolderingPathVariable)
        print('')
        '''

        #Definition the call back function if not already
        if self.DirectingCallbackFunction==None:

            #Definition a test function
            def test(_LiargVariablesList,_FolderPathStr,_DirKeyStrsList):
                pass
                print(_LiargVariablesList,_FolderPathStr,_DirKeyStrsList)

            #set
            self.DirectingCallbackFunction=test

        '''
        #Call the function
        try:
            self.DirectingCallbackFunction(
                                self.DirectingLiargVariablesList,
                                self.FolderingPathVariable,
                                self.FolderedDirKeyStrsList,
                                **_KwargVariablesDict
                                )
        except:
            self.DirectingCallbackFunction(
                                self.DirectingLiargVariablesList,
                                self.FolderingPathVariable,
                                self.FolderedDirKeyStrsList
                                )
        '''

        #Walk with os
        os.path.walk(
                        self.FolderingPathVariable,
                        self.DirectingCallbackFunction,
                        self.DirectingLiargVariablesList
                    )

        """
        #Do it Manually

        #Call the function
        try:
            self.DirectingCallbackFunction(
                                self.DirectingLiargVariablesList,
                                self.FolderingPathVariable,
                                self.FolderedDirKeyStrsList,
                                **_KwargVariablesDict
                                )
        except:
            self.DirectingCallbackFunction(
                                self.DirectingLiargVariablesList,
                                self.FolderingPathVariable,
                                self.FolderedDirKeyStrsList
                                )

        #Filter the folders to walk
        DirectedFolderKeyStrsList=SYS._filter(
                        lambda __FolderedDirKeyStr:
                        os.path.isdir(self.FolderingPathVariable+__FolderedDirKeyStr),
                        self.FolderedDirKeyStrsList
            )

        #debug
        '''
        print('After first filter DirectedFolderKeyStrsList is ',DirectedFolderKeyStrsList)
        print('')
        '''

        #Filter again maybe
        if self.DirectingFilterFunctionPointer!=None:
            DirectedFolderKeyStrsList=SYS._filter(
                        lambda __DirectedFolderKeyStr:
                        self.DirectingFilterFunctionPointer(
                            self,__DirectedFolderKeyStr),
                        DirectedFolderKeyStrsList
            )

        #debug
        '''
        print('After second DirectedFolderKeyStrsList is ',DirectedFolderKeyStrsList)
        print('')
        '''

        #Map a recursive direct
        '''
        map(    
                lambda __DirectedFolderKeyStr:
                self.__class__().direct(
                                self.DirectingCallbackFunction,
                                self.DirectingLiargVariablesList,
                                **{
                                'FolderingPathVariable':
                                    self.FolderingPathVariable+__DirectedFolderKeyStr+'/'
                                }
                            ),
                DirectedFolderKeyStrsList
            )
        '''

        """

        #Return self
        #return self    

#</DefineClass>

View the Directer sources on Github

Example

Let's create an empty class, which will automatically receive special attributes from the decorating ClassorClass, specially the NameStr, that should be the ClassStr without the TypeStr in the end.


In [48]:
#ImportModules
import ShareYourSystem as SYS
from ShareYourSystem.Standards.Interfacers import Directer
import os

#Definition an instance 
MyDirecter=Directer.DirecterClass()

#Direct for displaying folders
'''
MyDirecter.direct(
            lambda _LiargVariablesList,_FolderPathStr,_FileKeyStrsList:
            Representer._print(_LiargVariablesList[0]+_FolderPathStr),
            ["_FolderPathStr is "],
            **{'FolderingPathVariable':'/'.join(SYS.__file__.split('/')[:-1])}
        )
'''

#Delete things
def delete(_LiargVariablesList,_FolderPathStr,_FileKeyStrsList):
    #os.popen('rm -r '+_FolderPathStr+'/Attests/')
    os.popen('rm '+_FolderPathStr+'/02_ClassCell.md')
    os.popen('rm '+_FolderPathStr+'/03_ClassCell.py')
    os.popen('rm '+_FolderPathStr+'/04_InstanceCell.md')
    os.popen('rm '+_FolderPathStr+'/05_InstanceCell.py')
def move(_LiargVariablesList,_FolderPathStr,_FileKeyStrsList):
    os.popen('mv '+_FolderPathStr+'/00_ExampleCell.md '+_FolderPathStr+'/00_ExampleDoc.md')
    os.popen('mv '+_FolderPathStr+'/01_ExampleCell.py '+_FolderPathStr+'/01_ExampleDoc.py')

MyDirecter=Directer.DirecterClass().direct(
            delete,
            [],
            **{
                'FolderingPathVariable':
                SYS.ShareYourSystemLocalFolderPathStr+'/ShareYourSystem/Guiders/'
            }
        )

#Definition the AttestedStr
SYS._attest(
    [
        'MyDirecter is '+SYS._str(
                MyDirecter,
                **{
                'RepresentingBaseKeyStrsListBool':False
                }
            )
    ]
) 

#Print



*****Start of the Attest *****

MyDirecter is < (DirecterClass), 4554096272>
   /{ 
   /  '<New><Instance>IdInt' : 4554096272
   /  '<Spe><Class>DirectingFilterFunctionPointer' : None
   /  '<Spe><Instance>DirectingCallbackFunction' : <function delete at 0x10f74eed8>
   /  '<Spe><Instance>DirectingLiargVariablesList' : []
   /}

*****End of the Attest *****