doc_mKeyGenTable¶
Documentation¶
- Brief Explanation of KeyGenTable
- This class is inherited from GenTable
- It will read XML lookup files, only 1 key column is allowed. The name of the key column is specified in __init__
- List of Member Variables and Methods
How to Create a class instance
>>> kg=KeyGenTable(sRestriction="PRODUCT", sFilePath=".\\Prod\\PROD.txt") >>> kg_error=KeyGenTable(sRestriction="lol", sFilePath=".\\Prod\\PROD.txt") Exception: KeyGenTable's self._srestriction is not equal to KEYCOLS
- Functions
__init__(self,*args,**kwargs)
>>> kg.__dict__ {'_pThisModuleDir': WindowsPath('C:/Users/User/Documents/ACT/ActModel/ActModel_Current'), '_pFilePath': WindowsPath('Prod/PROD.txt'), '_xmlRoot': <Element 'ROOT' at 0x0000000009EFA9A8>, 'CLASS_TYPE': 'KeyGenTable', 'NAME': 'onegufWFf2y', 'FEATURES': [''], 'KEYCOLS': ['PRODUCT'], 'HEADINGS': ['SCEN_ID', 'PRODUCT', 'STHIRD'], 'TYPE': ['int', 'str', 'float'], 'BODY': {('PROD1',): {'SCEN_ID': 1, 'STHIRD': 3.0}, ('PROD2',): {'SCEN_ID': 2, 'STHIRD': 1.0}, ('PROD3',): {'SCEN_ID': 4, 'STHIRD': 1.0}}, '_sRestriction': 'PRODUCT'}
- _fXMLFindChildOutputList(self,sChildName,sType=”str”, bIsArray=True, #xmlRoot=None,
sStripChars=r”s+”,sSplitChars=”,”)
Inherited
_fXMLReadBody(self)
Inherited
… and other functions
- Variables
- self._pThisModuleDir
- self._pFilePath
- self._xmlRoot
- self.BODY
- Related Document
Sample Code for PROD.txt
<?xml version="1.0"?> <ROOT> <CLASS_TYPE type="str" is_array="false">KeyGenTable</CLASS_TYPE> <NAME type="str" is_array="false">onegufWFf2y</NAME> <FEATURES type="str"> </FEATURES> <KEYCOLS type="str"> PRODUCT </KEYCOLS> <HEADINGS type="str"> SCEN_ID,PRODUCT,STHIRD </HEADINGS> <TYPE type="str"> int,str,float </TYPE> <BODY> 1,PROD1,3 2,PROD2,1 4,PROD3,1 </BODY> </ROOT>