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