Commit eb648d8e authored by Thanassis Tsiodras's avatar Thanassis Tsiodras
Browse files

Addressed mypy findings for aadl2glueC.

parent 83c67471
......@@ -81,6 +81,8 @@ but with an extra call to OnFinal at the end.
import os
import sys
import hashlib
import pickle
import tempfile
from distutils import spawn
from typing import cast, Optional, Dict, List, Tuple, Set, Any # NOQA pylint: disable=unused-import
......@@ -154,8 +156,8 @@ of each SUBPROGRAM param.'''
except:
panic("The configured cache folder:\n\n\t" + projectCache +
"\n\n...is not there!\n")
cachedModelExists = False
aadlASTcache = None
astInfo = None
if projectCache is not None:
filehash = hashlib.md5()
for each in sorted(sys.argv[1:]):
......@@ -167,15 +169,10 @@ of each SUBPROGRAM param.'''
print("[DMT] No cached AADL model found for",
",".join(sys.argv[1:]))
else:
cachedModelExists = True
print("[DMT] Reusing cached AADL model for",
",".join(sys.argv[1:]))
import pickle
if cachedModelExists:
astInfo = pickle.load(open(aadlASTcache, 'rb'), fix_imports=False)
else:
import tempfile
astInfo = pickle.load(open(aadlASTcache, 'rb'), fix_imports=False)
if astInfo is None:
f = tempfile.NamedTemporaryFile(delete=False)
astFile = f.name
f.close()
......@@ -547,18 +544,16 @@ def main() -> None:
uniqueDataFiles[param._signal._asnFilename][sp._language].append(sp)
asn1files = list(uniqueDataFiles.keys())
asnFile = None # type: Optional[str]
if len(asn1files) == 1:
asnFile = asn1files[0]
commonPy.asnParser.ParseAsnFileList(asn1files)
elif asn1files:
panic("There appear to be more than one ASN.1 files referenced (%s)..." % str(asn1files))
if asnFile is not None:
inform("Checking that all base nodes have mandatory ranges set in %s..." % asnFile)
names = commonPy.asnParser.g_names
for node in names.values():
verify.VerifyRanges(node, names)
inform("Checking that all base nodes have mandatory ranges set in %s..." % asnFile)
names = commonPy.asnParser.g_names
for node in names.values():
verify.VerifyRanges(node, names)
SystemsAndImplementations = commonPy.aadlAST.g_subProgramImplementations[:]
SystemsAndImplementations.extend(commonPy.aadlAST.g_threadImplementations[:])
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment