@@ -133,7 +133,7 @@ class iXml(iBase): IBM i XMLSERVICE raw xml input.
133
133
import xml .dom .minidom
134
134
# import inspect
135
135
136
- class iBase :
136
+ class iBase ( object ) :
137
137
"""
138
138
IBM i XMLSERVICE call addable operation(s).
139
139
@@ -163,10 +163,9 @@ class iBase:
163
163
"""
164
164
def __init__ (self , iopt = {}, idft = {}):
165
165
# xml defaults
166
- self .opt = idft
167
- # xml options
168
- for k ,v in iopt .items ():
169
- self .opt [k ] = v
166
+ self .opt = idft .copy ()
167
+ self .opt .update (iopt )
168
+
170
169
# my children objects
171
170
self .opt ['c' ] = []
172
171
@@ -267,7 +266,7 @@ def __init__(self, ikey, icmd, iopt={}):
267
266
myexec = 'rexx'
268
267
else :
269
268
myexec = 'cmd'
270
- iBase . __init__ ( self , iopt , {'i' :ikey ,'k' :'cmd' ,'v' :icmd , 'exec' :myexec , 'error' :'fast' })
269
+ super ( iCmd , self ). __init__ ( iopt , {'i' :ikey ,'k' :'cmd' ,'v' :icmd , 'exec' :myexec , 'error' :'fast' })
271
270
272
271
273
272
class iSh (iBase ):
@@ -303,7 +302,7 @@ class iSh(iBase):
303
302
"""
304
303
def __init__ (self , ikey , icmd , iopt = {}):
305
304
# parent class
306
- iBase .__init__ (self , iopt , {'i' :ikey ,'k' :'sh' ,'v' :icmd , 'error' :'fast' })
305
+ super ( iSh , self ) .__init__ (iopt , {'i' :ikey ,'k' :'sh' ,'v' :icmd , 'error' :'fast' })
307
306
308
307
309
308
class iCmd5250 (iSh ):
@@ -340,7 +339,7 @@ class iCmd5250(iSh):
340
339
"""
341
340
def __init__ (self , ikey , icmd , iopt = {}):
342
341
# parent class
343
- iSh .__init__ (self , ikey , "/QOpenSys/usr/bin/system " + icmd )
342
+ super ( iCmd5250 , self ) .__init__ (ikey , "/QOpenSys/usr/bin/system " + icmd )
344
343
345
344
346
345
class iPgm (iBase ):
@@ -384,7 +383,7 @@ class iPgm (iBase):
384
383
"""
385
384
def __init__ (self , ikey , iname , iopt = {}):
386
385
# parent class
387
- iBase . __init__ ( self , iopt , {'i' :ikey ,'k' :'pgm' ,'v' :'' ,'name' :iname ,'error' :'fast' })
386
+ super ( iPgm , self ). __init__ ( iopt , {'i' :ikey ,'k' :'pgm' ,'v' :'' ,'name' :iname ,'error' :'fast' })
388
387
self .pcnt = 0 ;
389
388
390
389
def addParm (self , obj ):
@@ -434,7 +433,7 @@ def __init__(self, ikey, iname, ifunc, iopt={}):
434
433
iopt = iopt .copy ()
435
434
iopt ['func' ] = ifunc
436
435
# parent class
437
- iPgm . __init__ ( self , ikey , iname , iopt )
436
+ super ( iSrvPgm , self ). __init__ ( ikey , iname , iopt )
438
437
439
438
def addRet (self , obj ):
440
439
"""Add a return structure child node.
@@ -480,7 +479,7 @@ class iParm (iBase):
480
479
"""
481
480
def __init__ (self , ikey , iopt = {}):
482
481
# parent class
483
- iBase .__init__ (self , iopt , {'i' :ikey ,'k' :'parm' ,'v' :'' ,'io' :'both' })
482
+ super ( iParm , self ) .__init__ (iopt , {'i' :ikey ,'k' :'parm' ,'v' :'' ,'io' :'both' })
484
483
485
484
class iRet (iBase ):
486
485
"""
@@ -505,8 +504,7 @@ class iRet (iBase):
505
504
"""
506
505
def __init__ (self , ikey ):
507
506
# parent class
508
- iopt = {}
509
- iBase .__init__ (self ,iopt , {'i' :ikey ,'k' :'return' ,'v' :'' })
507
+ super (iRet , self ).__init__ ({}, {'i' :ikey ,'k' :'return' ,'v' :'' })
510
508
511
509
class iDS (iBase ):
512
510
"""
@@ -535,7 +533,7 @@ class iDS (iBase):
535
533
"""
536
534
def __init__ (self , ikey , iopt = {}):
537
535
# parent class
538
- iBase .__init__ (self , iopt , {'i' :ikey ,'k' :'ds' ,'v' :'' })
536
+ super ( iDS , self ) .__init__ (iopt , {'i' :ikey ,'k' :'ds' ,'v' :'' })
539
537
540
538
def addData (self , obj ):
541
539
"""Add a iData or iDS child node.
@@ -613,7 +611,7 @@ class iData (iBase):
613
611
"""
614
612
def __init__ (self , ikey , itype , ival , iopt = {}):
615
613
# parent class
616
- iBase . __init__ ( self , iopt , {'i' :ikey ,'k' :'data' ,'v' :ival ,'type' :itype })
614
+ super ( iData , self ). __init__ ( iopt , {'i' :ikey ,'k' :'data' ,'v' :ival ,'type' :itype })
617
615
618
616
619
617
class iSqlQuery (iBase ):
@@ -641,7 +639,7 @@ class iSqlQuery (iBase):
641
639
"""
642
640
def __init__ (self , ikey , isql , iopt = {}):
643
641
# parent class
644
- iBase . __init__ ( self , iopt , {'i' :ikey ,'j' :'sql' ,'k' :'query' ,'v' :isql , 'error' :'fast' })
642
+ super ( iSqlQuery , self ). __init__ ( iopt , {'i' :ikey ,'j' :'sql' ,'k' :'query' ,'v' :isql , 'error' :'fast' })
645
643
646
644
647
645
class iSqlPrepare (iBase ):
@@ -674,7 +672,7 @@ class iSqlPrepare (iBase):
674
672
"""
675
673
def __init__ (self , ikey , isql , iopt = {}):
676
674
# parent class
677
- iBase . __init__ ( self , iopt , {'i' :ikey ,'j' :'sql' ,'k' :'prepare' ,'v' :isql , 'error' :'fast' })
675
+ super ( iSqlPrepare , self ). __init__ ( iopt , {'i' :ikey ,'j' :'sql' ,'k' :'prepare' ,'v' :isql , 'error' :'fast' })
678
676
679
677
680
678
class iSqlExecute (iBase ):
@@ -700,7 +698,7 @@ class iSqlExecute (iBase):
700
698
"""
701
699
def __init__ (self , ikey , iopt = {}):
702
700
# parent class
703
- iBase . __init__ ( self , iopt , {'i' :ikey ,'j' :'sql' ,'k' :'execute' ,'v' :'' , 'error' :'fast' })
701
+ super ( iSqlExecute , self ). __init__ ( iopt , {'i' :ikey ,'j' :'sql' ,'k' :'execute' ,'v' :'' , 'error' :'fast' })
704
702
self .pcnt = 0 ;
705
703
706
704
def addParm (self , obj ):
@@ -743,7 +741,7 @@ class iSqlFetch (iBase):
743
741
"""
744
742
def __init__ (self , ikey , iopt = {}):
745
743
# parent class
746
- iBase . __init__ ( self , iopt , {'i' :ikey ,'j' :'sql' ,'k' :'fetch' ,'v' :'' ,'block' :'all' , 'error' :'fast' })
744
+ super ( iSqlFetch , self ). __init__ ( iopt , {'i' :ikey ,'j' :'sql' ,'k' :'fetch' ,'v' :'' ,'block' :'all' , 'error' :'fast' })
747
745
748
746
749
747
class iSqlParm (iBase ):
@@ -773,7 +771,7 @@ class iSqlParm (iBase):
773
771
"""
774
772
def __init__ (self , ikey , ival , iopt = {}):
775
773
# parent class
776
- iBase .__init__ (self , iopt , {'i' :ikey ,'k' :'parm' ,'v' :ival ,'io' :'both' })
774
+ super ( iSqlParm , self ) .__init__ (iopt , {'i' :ikey ,'k' :'parm' ,'v' :ival ,'io' :'both' })
777
775
778
776
779
777
class iSqlFree (iBase ):
@@ -806,7 +804,7 @@ class iSqlFree (iBase):
806
804
"""
807
805
def __init__ (self , ikey , iopt = {}):
808
806
# parent class
809
- iBase . __init__ ( self , iopt , {'i' :ikey ,'j' :'sql' ,'k' :'free' ,'v' :'' , 'error' :'fast' })
807
+ super ( iSqlFree , self ). __init__ ( iopt , {'i' :ikey ,'j' :'sql' ,'k' :'free' ,'v' :'' , 'error' :'fast' })
810
808
811
809
class iXml (iBase ):
812
810
"""
@@ -826,7 +824,7 @@ class iXml(iBase):
826
824
Not commonly used, but ok when other classes fall short.
827
825
"""
828
826
def __init__ (self , ixml ):
829
- iBase .__init__ (self )
827
+ super ( iXml , self ) .__init__ ()
830
828
self .xml_body = ixml
831
829
832
830
def add (self , obj ):
0 commit comments