Skip to content

Commit 2adf355

Browse files
kangtegongnamhyung
authored andcommitted
python: Sort import order of libraries using isort
I think it's better to stanzdarize import orders of libraries in python scripts (in tests/ and scripts/, etc) to prevent circular imports (although happens rarely), or for faster import, or for better readabilities. We can reformat import orders with isort tools, and this commit contains the result of the tool. Also, I added pyproject.toml for unified outcome. If we run isort . unnified outcome will be made. reference: https://pypi.org/project/isort/ Signed-off-by: Kang Minchul <[email protected]>
1 parent 304a492 commit 2adf355

File tree

74 files changed

+173
-91
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

74 files changed

+173
-91
lines changed

misc/gen-autoargs.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,9 @@
99
#
1010

1111
from __future__ import print_function
12-
import sys
12+
1313
import re
14+
import sys
1415

1516
# The syntax of C in Backus-Naur Form
1617
# https://cs.wmich.edu/~gupta/teaching/cs4850/sumII06/The%20syntax%20of%20C%20in%20Backus-Naur%20form.htm

pyproject.toml

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
[tool.isort]
2+
profile = "black"
3+
lines_between_types = 0
4+
lines_after_imports = 1
5+
combine_as_imports = true
6+
ignore_whitespace = true
7+
skip_gitignore = true
8+

tests/runtest.py

+6-4
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
#!/usr/bin/env python
22

3+
import glob
4+
import multiprocessing
5+
import os
36
import random
4-
import os, sys
5-
import tempfile
6-
import glob, re
7+
import re
78
import subprocess as sp
8-
import multiprocessing
9+
import sys
10+
import tempfile
911
import time
1012

1113
class TestBase:

tests/t022_filter_kernel.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
#!/usr/bin/env python
22

3-
from runtest import TestBase
43
import os
54

5+
from runtest import TestBase
6+
67
class TestCase(TestBase):
78
def __init__(self):
89
TestBase.__init__(self, 'getids', serial=True, result="""

tests/t067_report_diff.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
#!/usr/bin/env python
22

3-
from runtest import TestBase
43
import subprocess as sp
54

5+
from runtest import TestBase
6+
67
XDIR='xxx'
78
YDIR='yyy'
89

tests/t079_replay_kernel_D.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
#!/usr/bin/env python
22

3-
from runtest import TestBase
4-
import subprocess as sp
53
import os
4+
import subprocess as sp
5+
6+
from runtest import TestBase
67

78
class TestCase(TestBase):
89
def __init__(self):

tests/t080_replay_kernel_D2.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
#!/usr/bin/env python
22

3-
from runtest import TestBase
4-
import subprocess as sp
53
import os
4+
import subprocess as sp
5+
6+
from runtest import TestBase
67

78
TDIR='xxx'
89

tests/t081_kernel_depth.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
#!/usr/bin/env python
22

3-
from runtest import TestBase
43
import os
54

5+
from runtest import TestBase
6+
67
class TestCase(TestBase):
78
def __init__(self):
89
TestBase.__init__(self, 'openclose', serial=True, result="""

tests/t091_replay_tid.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
#!/usr/bin/env python
22

3-
from runtest import TestBase
43
import os.path
54

5+
from runtest import TestBase
6+
67
class TestCase(TestBase):
78
def __init__(self):
89
TestBase.__init__(self, 'fork', """

tests/t092_report_tid.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
#!/usr/bin/env python
22

3-
from runtest import TestBase
43
import os.path
54

5+
from runtest import TestBase
6+
67
class TestCase(TestBase):
78
def __init__(self):
89
TestBase.__init__(self, 'fork', """

tests/t095_graph_tid.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
#!/usr/bin/env python
22

3-
from runtest import TestBase
43
import os.path
54

5+
from runtest import TestBase
6+
67
class TestCase(TestBase):
78
def __init__(self):
89
TestBase.__init__(self, 'fork', result="""

tests/t097_dump_basic.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
#!/usr/bin/env python
22

3-
from runtest import TestBase
43
import subprocess as sp
54

5+
from runtest import TestBase
6+
67
class TestCase(TestBase):
78
def __init__(self):
89
TestBase.__init__(self, 'abc', """

tests/t098_dump_tid.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
#!/usr/bin/env python
22

3-
from runtest import TestBase
4-
import subprocess as sp
53
import os.path
4+
import subprocess as sp
5+
6+
from runtest import TestBase
67

78
class TestCase(TestBase):
89
def __init__(self):

tests/t099_dump_filter.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
#!/usr/bin/env python
22

3-
from runtest import TestBase
43
import subprocess as sp
54

5+
from runtest import TestBase
6+
67
class TestCase(TestBase):
78
def __init__(self):
89
TestBase.__init__(self, 'abc', """

tests/t100_dump_depth.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
#!/usr/bin/env python
22

3-
from runtest import TestBase
43
import subprocess as sp
54

5+
from runtest import TestBase
6+
67
class TestCase(TestBase):
78
def __init__(self):
89
TestBase.__init__(self, 'abc', """

tests/t103_dump_kernel.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
#!/usr/bin/env python
22

3-
from runtest import TestBase
4-
import subprocess as sp
53
import os
4+
import subprocess as sp
5+
6+
from runtest import TestBase
67

78
class TestCase(TestBase):
89
def __init__(self):

tests/t104_graph_kernel.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
#!/usr/bin/env python
22

3-
from runtest import TestBase
4-
import subprocess as sp
53
import os
4+
import subprocess as sp
5+
6+
from runtest import TestBase
67

78
class TestCase(TestBase):
89
def __init__(self):

tests/t111_kernel_tid.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
#!/usr/bin/env python
22

3-
from runtest import TestBase
4-
import subprocess as sp
53
import os
4+
import subprocess as sp
5+
6+
from runtest import TestBase
67

78
class TestCase(TestBase):
89
def __init__(self):

tests/t117_time_range.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
#!/usr/bin/env python
22

3-
from runtest import TestBase
43
import subprocess as sp
54

5+
from runtest import TestBase
6+
67
START=0
78

89
class TestCase(TestBase):

tests/t122_time_range2.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
#!/usr/bin/env python
22

3-
from runtest import TestBase
43
import subprocess as sp
54

5+
from runtest import TestBase
6+
67
START=0
78

89
class TestCase(TestBase):

tests/t125_report_range.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
#!/usr/bin/env python
22

3-
from runtest import TestBase
43
import subprocess as sp
54

5+
from runtest import TestBase
6+
67
START=0
78

89
class TestCase(TestBase):

tests/t129_session_tid.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
#!/usr/bin/env python
22

3-
from runtest import TestBase
43
import subprocess as sp
54

5+
from runtest import TestBase
6+
67
# Test that task.txt files with a tid in the SESS line still work
78

89
class TestCase(TestBase):

tests/t132_trigger_kernel.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
#!/usr/bin/env python
22

3-
from runtest import TestBase
43
import os
54

5+
from runtest import TestBase
6+
67
# there was a problem applying depth filter if it contains kernel functions
78
class TestCase(TestBase):
89
def __init__(self):

tests/t135_trigger_time2.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
#!/usr/bin/env python
22

3-
from runtest import TestBase
43
import subprocess as sp
54

5+
from runtest import TestBase
6+
67
TDIR='xxx'
78
TIME=0
89
UNIT=''

tests/t137_kernel_tid_update.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
#!/usr/bin/env python
22

3-
from runtest import TestBase
43
import os
54

5+
from runtest import TestBase
6+
67
class TestCase(TestBase):
78
def __init__(self):
89
TestBase.__init__(self, 'fork2', serial=True, result="""

tests/t138_kernel_dynamic.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
#!/usr/bin/env python
22

3-
from runtest import TestBase
43
import os
54

5+
from runtest import TestBase
6+
67
class TestCase(TestBase):
78
def __init__(self):
89
TestBase.__init__(self, 'openclose', serial=True, result="""

tests/t139_kernel_dynamic2.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
#!/usr/bin/env python
22

3-
from runtest import TestBase
43
import os
54

5+
from runtest import TestBase
6+
67
class TestCase(TestBase):
78
def __init__(self):
89
TestBase.__init__(self, 'openclose', serial=True, result="""

tests/t141_recv_basic.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
#!/usr/bin/env python
22

3-
from runtest import TestBase
4-
import subprocess as sp
53
import os.path
4+
import subprocess as sp
5+
6+
from runtest import TestBase
67

78
TDIR = 'xxx'
89

tests/t142_recv_multi.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
#!/usr/bin/env python
22

3-
from runtest import TestBase
4-
import subprocess as sp
53
import os.path
64
import random
5+
import subprocess as sp
6+
7+
from runtest import TestBase
78

89
TDIR = 'xxx'
910

tests/t143_recv_kernel.py

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
#!/usr/bin/env python
22

3-
from runtest import TestBase
4-
import subprocess as sp
5-
import random
63
import os
4+
import random
5+
import subprocess as sp
6+
7+
from runtest import TestBase
78

89
TDIR = 'xxx'
910

tests/t148_event_kernel.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
#!/usr/bin/env python
22

3-
from runtest import TestBase
43
import os
54

5+
from runtest import TestBase
6+
67
class TestCase(TestBase):
78
def __init__(self):
89
TestBase.__init__(self, 'sleep', serial=True, result="""

tests/t149_event_kernel2.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
#!/usr/bin/env python
22

3-
from runtest import TestBase
43
import os
54

5+
from runtest import TestBase
6+
67
class TestCase(TestBase):
78
def __init__(self):
89
TestBase.__init__(self, 'fork', serial=True, result="""

tests/t150_recv_event.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
#!/usr/bin/env python
22

3-
from runtest import TestBase
4-
import subprocess as sp
53
import os.path
4+
import subprocess as sp
5+
6+
from runtest import TestBase
67

78
TDIR = 'xxx'
89

tests/t151_recv_runcmd.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
#!/usr/bin/env python
22

3-
from runtest import TestBase
43
import subprocess as sp
54

5+
from runtest import TestBase
6+
67
TDIR = 'xxx'
78
TMPF = 'out'
89

0 commit comments

Comments
 (0)