Loading testing/asn_process.py +1 −28 Original line number Diff line number Diff line Loading @@ -68,28 +68,6 @@ def syntaxCheckASN (fileList): } return results duplicateObjects = { '102232-1/LI-PS-PDU.asn' : [ 'CCPayload', 'IRIPayload', 'Location' ], 'testing/mod1.asn' : [ 'ClashField' ] } def fixDuplicateObjects(filename): stringContent = filename.read_text() for object in duplicateObjects[filename.as_posix()]: stringContent = stringContent.replace(f'{object} ::=', f'Native{object} ::=') stringContent = stringContent.replace(f'SEQUENCE OF {object}', f'SEQUENCE OF Native{object}') #stringContent = sub(f"]\\w{object}", f"] Native{object}", stringContent) Path('temp.asn').write_text(stringContent) return 'temp.asn' def compileAllTargets (compileTargets): """ Attempts to compile a set of compile targets using the pycrate ASN1 tools Loading Loading @@ -118,11 +96,6 @@ def compileAllTargets (compileTargets): GLOBAL.clear() for filename in target: pFile = Path(filename) if pFile.as_posix() in duplicateObjects: tmpFile = Path(fixDuplicateObjects(pFile)) fileTexts.append(tmpFile.read_text()) #tmpFile.unlink() else: fileTexts.append(pFile.read_text()) fileNames.append(filename) logging.debug (f" Loading {filename}") Loading Loading
testing/asn_process.py +1 −28 Original line number Diff line number Diff line Loading @@ -68,28 +68,6 @@ def syntaxCheckASN (fileList): } return results duplicateObjects = { '102232-1/LI-PS-PDU.asn' : [ 'CCPayload', 'IRIPayload', 'Location' ], 'testing/mod1.asn' : [ 'ClashField' ] } def fixDuplicateObjects(filename): stringContent = filename.read_text() for object in duplicateObjects[filename.as_posix()]: stringContent = stringContent.replace(f'{object} ::=', f'Native{object} ::=') stringContent = stringContent.replace(f'SEQUENCE OF {object}', f'SEQUENCE OF Native{object}') #stringContent = sub(f"]\\w{object}", f"] Native{object}", stringContent) Path('temp.asn').write_text(stringContent) return 'temp.asn' def compileAllTargets (compileTargets): """ Attempts to compile a set of compile targets using the pycrate ASN1 tools Loading Loading @@ -118,11 +96,6 @@ def compileAllTargets (compileTargets): GLOBAL.clear() for filename in target: pFile = Path(filename) if pFile.as_posix() in duplicateObjects: tmpFile = Path(fixDuplicateObjects(pFile)) fileTexts.append(tmpFile.read_text()) #tmpFile.unlink() else: fileTexts.append(pFile.read_text()) fileNames.append(filename) logging.debug (f" Loading {filename}") Loading