Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
gaoqiong
MIGraphX
Commits
2a79a9ff
Unverified
Commit
2a79a9ff
authored
Feb 01, 2022
by
Paul Fultz II
Committed by
GitHub
Feb 01, 2022
Browse files
Add python type annotations to api.py (#1061)
This will also check the types using mypy on the CI.
parent
7e7ef0b8
Changes
3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
195 additions
and
136 deletions
+195
-136
.github/workflows/ci.yaml
.github/workflows/ci.yaml
+4
-2
tools/api.py
tools/api.py
+182
-132
tools/generate.sh
tools/generate.sh
+9
-2
No files found.
.github/workflows/ci.yaml
View file @
2a79a9ff
...
@@ -142,10 +142,12 @@ jobs:
...
@@ -142,10 +142,12 @@ jobs:
with
:
with
:
python-version
:
3.6
python-version
:
3.6
-
name
:
Install pyflakes
-
name
:
Install pyflakes
run
:
pip install pyflakes==2.3.1
run
:
pip install pyflakes==2.3.1
mypy==0.931
-
name
:
Run pyflakes
-
name
:
Run pyflakes
run
:
pyflakes examples/ tools/ src/ test/ doc/
run
:
|
pyflakes examples/ tools/ src/ test/ doc/
mypy tools/api.py
linux
:
linux
:
...
...
tools/api.py
View file @
2a79a9ff
This diff is collapsed.
Click to expand it.
tools/generate.sh
View file @
2a79a9ff
DIR
=
"
$(
cd
"
$(
dirname
"
${
BASH_SOURCE
[0]
}
"
)
"
&&
pwd
)
"
DIR
=
"
$(
cd
"
$(
dirname
"
${
BASH_SOURCE
[0]
}
"
)
"
&&
pwd
)
"
SRC_DIR
=
$DIR
/../src
SRC_DIR
=
$DIR
/../src
ls
-1
$DIR
/include/ | xargs
-n
1
-P
$(
nproc
)
-I
{}
-t
bash
-c
"python3.6
$DIR
/te.py
$DIR
/include/{} | clang-format-5.0 -style=file >
$SRC_DIR
/include/migraphx/{}"
PYTHON
=
python3
if
type
-p
python3.6
>
/dev/null
;
then
PYTHON
=
python3.6
fi
if
type
-p
python3.8
>
/dev/null
;
then
PYTHON
=
python3.8
fi
ls
-1
$DIR
/include/ | xargs
-n
1
-P
$(
nproc
)
-I
{}
-t
bash
-c
"
$PYTHON
$DIR
/te.py
$DIR
/include/{} | clang-format-5.0 -style=file >
$SRC_DIR
/include/migraphx/{}"
function
api
{
function
api
{
python3.6
$DIR
/api.py
$SRC_DIR
/api/migraphx.py
$1
| clang-format-5.0
-style
=
file
>
$2
$PYTHON
$DIR
/api.py
$SRC_DIR
/api/migraphx.py
$1
| clang-format-5.0
-style
=
file
>
$2
}
}
api
$DIR
/api/migraphx.h
$SRC_DIR
/api/include/migraphx/migraphx.h
api
$DIR
/api/migraphx.h
$SRC_DIR
/api/include/migraphx/migraphx.h
...
...
Write
Preview
Markdown
is supported
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