} ): #call the base method object.__init__(self) #Definition an attribute self.MyStr='I am a Foo with MyFloat equal to '+str(self.MyFloat)+' and Int equal to '+str(Int) #print print("\n".join( [ 'FooClass.__init__ is '+str(FooClass.__init__), 'FooClass has some special attributes', #'FooClass.InitInspectDict is '+SYS._str(FooClass.InitInspectDict), 'FooClass.DefaultAttributeVariablesOrderedDict is '+SYS.indent( FooClass.DefaultAttributeVariablesOrderedDict), 'FooClass.MyFloat is '+str(FooClass.MyFloat), 'FooClass.MyInt is '+str(FooClass.MyInt), ] ) ) #Definition a default instance that will take its values from the default classed attributes DefaultFoo=FooClass(3) #print print("\n"+"\n".join( [ 'What are you saying DefaultFoo ?', 'DefaultFoo.__dict__ is '+str(DefaultFoo.__dict__), 'DefaultFoo.MyFloat is '+str(DefaultFoo.MyFloat),
#ImportModules import ShareYourSystem as SYS #Definition a FooClass decorated by the ClassorClass @SYS.ClassorClass() class FooClass(object): pass #note that the SYS.indent does the same thing print('FooClass.__dict__ is ') print(SYS.indent(FooClass))
# ImportModules import ShareYourSystem as SYS # define @SYS.InspecterClass() class MakerClass(object): def default_init(self, _MakingMyStr, _MakingMyInt=0, **_KwargVariablesDict): object.__init__(self, **_KwargVariablesDict) def do_make(self): # str self.MadeMyStr = str(self.MakingMyStr) # print print("MakerClass.InspectedArgumentDict is ") print(SYS.indent(MakerClass.InspectedArgumentDict))
): object.__init__(self) def do_make(self): #print print('self.MakingMyFloat is '+str(self.MakingMyFloat)) print('self.MadeMyInt is '+str(self.MadeMyInt)) print('') #Cast self.MadeMyInt=int(self.MakingMyFloat) #print print('MakerClass.SwitchMethodDict is ') print(SYS.indent(MakerClass.SwitchMethodDict)) #Definition an instance MyMaker=MakerClass() #print print('MyMaker.getSwitch() is ') print(SYS.indent(MyMaker.getSwitch())) #Print print('Before make, MyMaker.__dict__ is ') SYS._print(MyMaker.__dict__) #make once print('We make for the first time') MyMaker.make(3.)
@SYS.PropertiserClass() class MakerClass(SYS.PrinterClass): def default_init(self, _MakingMyFloat={ 'DefaultValueType':property, 'PropertyInitVariable':3., 'PropertyDocStr':'I am doing the thing here' } ): SYS.PrinterClass.__init__(self) #Print and show that the class has already propertize_(get,set,del)MakingMyFloat # a default _MakingMyFloat value and the MakingMyFloat prop print('SYS.MakerClass.__dict__ is') print(SYS.indent(SYS.MakerClass.__dict__)) #Define MyMaker=SYS.MakerClass() #print the __dict__, there is no things related to the #MakingMyFloat property print('MyMaker.__dict__ before set is ') SYS._print(MyMaker.__dict__) #set MyMaker.MakingMyFloat=7. #print the __dict__, now there is the hidden attribute print('MyMaker.__dict__ after set is ') SYS._print(MyMaker.__dict__)
class MakerClass(object): def default_init(self, _MakingMyFloat=1., _MakingShareList=['bonjour'], _MakingSpecificList=None, _MakingMyInt={'DefaultValueType':int} ): object.__init__(self) #print at the class level print("\n".join( [ 'MakerClass has some special attributes', 'MakerClass.DoingAttributeVariablesOrderedDict is '+SYS.indent( MakerClass.DoingAttributeVariablesOrderedDict), 'MakerClass.DoneAttributeVariablesOrderedDict is '+SYS.indent( MakerClass.DoneAttributeVariablesOrderedDict) ]) ) #Definition a default instance DefaultMaker=MakerClass() #print print( '\n'+'\n'.join( [ 'What are you saying DefaultMaker ?', 'DefaultMaker.__dict__ is '+SYS.indent(DefaultMaker.__dict__), 'DefaultMaker.getDo() is '+SYS.indent(DefaultMaker.getDo()),
@SYS.ClasserClass(**{"ClassingSwitchMethodStrsList": ["make"]}) class MakerClass(SYS.RebooterClass): def default_init(self, _MakingMyFloat=0.0, _MadeMyInt=0, **_KwargVariablesDict): SYS.RebooterClass.__init__(self, **_KwargVariablesDict) def do_make(self): # print print("I am in the do_make of the Maker") # cast self.MadeMyInt = int(self.MakingMyFloat) # Define MyMaker = SYS.MakerClass() # print print("MyMaker before make is ") print(SYS.indent(MyMaker.__dict__)) # MyMaker.make(5.0) # print print("MyMaker after make is ") print(SYS.indent(MyMaker.__dict__)) # MyMaker.reboot()
#call the parent method MakerClass.make(self) #cast self.MadeMyInt+=10 def do_build(self): pass #Definition an instance MyBuilder=BuilderClass() #Print print('Before make, MyBuilder.__dict__ is ') print(SYS.indent(MyBuilder.__dict__)) #print print('MyBuilder.getSwitch() is ') print(SYS.indent(MyBuilder.getSwitch())) #make once MyBuilder.make(3.) #Print print('After the first make, MyBuilder is ') print(SYS.indent(MyBuilder.__dict__)) #print print('MyBuilder.getSwitch() is ') print(SYS.indent(MyBuilder.getSwitch()))
#print print('I am in the mimic_make of the Builder') #call the parent method MakerClass.make(self) #cast self.MadeMyInt+=10 #Definition an instance MyBuilder=BuilderClass() #Print print('Before make, MyBuilder.__dict__ is ') print(SYS.indent(MyBuilder.__dict__)) #make once MyBuilder.make( 3., _FirstInt=2, **{ 'MakingSecondInt':5 } ) #Print print('After the first make, MyBuilder.__dict__ is ') print(SYS.indent(MyBuilder.__dict__)) #Definition the AttestedStr
#ImportModules import ShareYourSystem as SYS #Definition a FooClass decorated by the DefaultorClass @SYS.DefaultorClass() class FooClass(object): def default_init(self, _ShareClassor=SYS.ClassorClass(), _SpecificClassor=None ): object.__init__(self) #Definition FooClass.ShareClassor.MyInt=2 MyFirstFoo=FooClass() MySecondFoo=FooClass() #Definition the AttestedStr print("\n".join( [ 'MyFirstFoo.ShareClassor.__dict__ is ',SYS.indent( MyFirstFoo.ShareClassor.__dict__), 'MyFirstFoo.__dict__ is '+SYS.indent(MyFirstFoo.__dict__), 'MyFirstFoo.SpecificClassor is '+str(MyFirstFoo.SpecificClassor) ] ) )
#print print('self.MadeMyInt is ') print(self.MadeMyInt) #Definition a MakerClass with decorated make by a Switcher @SYS.SwitcherClass() class BuilderClass(MakerClass): def default_init(self, ): MakerClass.__init__(self) #print print('BuilderClass.SwitchMethodDict is ') print(SYS.indent(BuilderClass.SwitchMethodDict)) #Definition an instance MyBuilder=BuilderClass() #Print print('Before make, MyBuilder.__dict__ is ') SYS._print(MyBuilder.__dict__) #print print('MyBuilder.getSwitch()') print(SYS.indent(MyBuilder.getSwitch())) #make once print('We make') print(MyBuilder.make)
#ImportModules import ShareYourSystem as SYS #define @SYS.ClassorClass() class MakerClass(object): def default_init(self, _MakingMyStr, _MakingMyInt=0, **_KwargVariablesDict ): object.__init__(self,**_KwargVariablesDict) def do_make(self): #str self.MadeMyStr=str(self.MakingMyStr) #print print('MakerClass.InspectInspectDict is ') print(SYS.indent( MakerClass.InspectInspectDict ) )
_MyFirstSpecificList=None, _MySecondSpecificList=None, _MyInt={ 'DefaultValueType':int } ): object.__init__(self) #Definition MyFoo=FooClass(**{'MyFloat':5.,'MyInt':9}) MyFoo.MyShareList.append(7) MyFoo.MyFirstSpecificList=['hello'] #Before default print('Before setDefault MyFoo.__dict__ is') print(SYS.indent(MyFoo.__dict__)) #default MyFoo.setDefault( #ClassVariable #it can be a Class, ClassKeyStr or [Class] FooClass, #AttributeKeyStrsList #it can be just a KeyStr a [<KeyStr>] and if None it is all the KeyStr from all the Classes ['MyFloat','MyFirstSpecificList'] ) #After default print('\nAfter setDefault MyFoo.__dict__ is') print(SYS.indent(MyFoo.__dict__))
): FooClass.__init__(self) #put in the SYS scope SYS.FeeClass=FeeClass #Definition MyFee=FeeClass(**{ 'MyFloat':5., 'MyInt':9, 'MyBool':False }) #Before default print('Before setDefault MyFee.__dict__ is') print(SYS.indent(MyFee.__dict__)) #default and also init the mutable variables MyFee.setDefault( #ClassVariable, [FooClass,'FeeClass'], **{'DefaultMutableBool':True} ) #print print('\nMyFee.__dict__ is ') print(SYS.indent(MyFee.__dict__))
def do_make(self): #set self.MadeMyInt=self.MakingMyFloat #define and itemize just like a get MyMaker=MakerClass( ).itemize( #ItemizingKeyVariable 'MakingMyFloat' ) #print print('MyMaker.getDo(SYS.ItemizerClass) for a simple get like is ') print(SYS.indent(MyMaker.getDo(SYS.ItemizerClass))) #define and itemize like a set MyMaker=MakerClass( ).itemize( #ItemizingKeyVariable 'MakingMyFloat', #ItemizingValueVariable 3. ) #print print('MyMaker.getDo(SYS.ItemizerClass) for a set like is ') print(SYS.indent(MyMaker.getDo(SYS.ItemizerClass))) #define and itemize
def default_init(self, _MakingMyFloat=1., _MakingShareList=['bonjour'], _MakingRestrictList=None, _MakingMyInt={'DefaultValueType':int} ): object.__init__(self) def do_make(self): #print print('Maker : I am going to make') print('') #set self.MadeMyInt=int(self.MakingMyFloat) #print print('InspectMethodDict is ') print(SYS.indent(MakerClass.InspectMethodDict)) #print print("\n".join([ 'MakerClass.do_make is '+str(MakerClass.do_make), 'MakerClass.doWithmake is '+str(MakerClass.superDo_make), 'MakerClass.make is '+str(MakerClass.make), 'MakerClass.callDo is '+str(MakerClass.callDo), ]))
#Define @SYS.PropertiserClass() class MakerClass(object): def default_init(self, _MakingMyList=None, _MakingMyInt={ 'DefaultValueType':property, 'PropertyInitVariable':None, 'PropertyDocStr':'I am doing the thing here', 'ShapeDict':{ 'MakingMyList':0 } }, _MadeMyInt=0 ): object.__init__(self) #Define MyMaker=MakerClass() #Set and this will bind the value of MakingMyInt MyMaker.MakingMyInt=2 #print print('MyMaker.__dict__ is ') print(SYS.indent(MyMaker))
object.__init__(self) def do_build(self): #print print('We build here') #first make self.make() #Cast self.BuiltMyStr='My MadeMyInt is '+str(self.MadeMyInt) #print print('BuilderClass.SwitchMethodDict is ') print(SYS.indent(BuilderClass.SwitchMethodDict)) #Definition an instance MyBuilder=BuilderClass() #Print print('Before make, MyBuilder.__dict__ is ') SYS._print(MyBuilder.__dict__) #make once print('NOW we build') MyBuilder.build(**{'MakingMyFloat':3.}) #Print print('After the build, MyBuilder.__dict__ is ') SYS._print(MyBuilder.__dict__)
#ImportModules import ShareYourSystem as SYS #Definition MyInterfacer=SYS.InterfacerClass() #print print('MyInterfacer.__dict__ is ') print(SYS.indent(MyInterfacer.__dict__))