Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
TASTE
dmt
Commits
eb648d8e
Commit
eb648d8e
authored
May 07, 2020
by
Thanassis Tsiodras
Browse files
Addressed mypy findings for aadl2glueC.
parent
83c67471
Changes
1
Hide whitespace changes
Inline
Side-by-side
dmt/aadl2glueC.py
View file @
eb648d8e
...
...
@@ -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
[:])
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment