Skip to content

Commit

Permalink
python: Sort import order of libraries using isort
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
kangtegong authored and namhyung committed Sep 29, 2021
1 parent 304a492 commit 2adf355
Show file tree
Hide file tree
Showing 74 changed files with 173 additions and 91 deletions.
3 changes: 2 additions & 1 deletion misc/gen-autoargs.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@
#

from __future__ import print_function
import sys

import re
import sys

# The syntax of C in Backus-Naur Form
# https://cs.wmich.edu/~gupta/teaching/cs4850/sumII06/The%20syntax%20of%20C%20in%20Backus-Naur%20form.htm
Expand Down
8 changes: 8 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[tool.isort]
profile = "black"
lines_between_types = 0
lines_after_imports = 1
combine_as_imports = true
ignore_whitespace = true
skip_gitignore = true

10 changes: 6 additions & 4 deletions tests/runtest.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
#!/usr/bin/env python

import glob
import multiprocessing
import os
import random
import os, sys
import tempfile
import glob, re
import re
import subprocess as sp
import multiprocessing
import sys
import tempfile
import time

class TestBase:
Expand Down
3 changes: 2 additions & 1 deletion tests/t022_filter_kernel.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
#!/usr/bin/env python

from runtest import TestBase
import os

from runtest import TestBase

class TestCase(TestBase):
def __init__(self):
TestBase.__init__(self, 'getids', serial=True, result="""
Expand Down
3 changes: 2 additions & 1 deletion tests/t067_report_diff.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
#!/usr/bin/env python

from runtest import TestBase
import subprocess as sp

from runtest import TestBase

XDIR='xxx'
YDIR='yyy'

Expand Down
5 changes: 3 additions & 2 deletions tests/t079_replay_kernel_D.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
#!/usr/bin/env python

from runtest import TestBase
import subprocess as sp
import os
import subprocess as sp

from runtest import TestBase

class TestCase(TestBase):
def __init__(self):
Expand Down
5 changes: 3 additions & 2 deletions tests/t080_replay_kernel_D2.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
#!/usr/bin/env python

from runtest import TestBase
import subprocess as sp
import os
import subprocess as sp

from runtest import TestBase

TDIR='xxx'

Expand Down
3 changes: 2 additions & 1 deletion tests/t081_kernel_depth.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
#!/usr/bin/env python

from runtest import TestBase
import os

from runtest import TestBase

class TestCase(TestBase):
def __init__(self):
TestBase.__init__(self, 'openclose', serial=True, result="""
Expand Down
3 changes: 2 additions & 1 deletion tests/t091_replay_tid.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
#!/usr/bin/env python

from runtest import TestBase
import os.path

from runtest import TestBase

class TestCase(TestBase):
def __init__(self):
TestBase.__init__(self, 'fork', """
Expand Down
3 changes: 2 additions & 1 deletion tests/t092_report_tid.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
#!/usr/bin/env python

from runtest import TestBase
import os.path

from runtest import TestBase

class TestCase(TestBase):
def __init__(self):
TestBase.__init__(self, 'fork', """
Expand Down
3 changes: 2 additions & 1 deletion tests/t095_graph_tid.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
#!/usr/bin/env python

from runtest import TestBase
import os.path

from runtest import TestBase

class TestCase(TestBase):
def __init__(self):
TestBase.__init__(self, 'fork', result="""
Expand Down
3 changes: 2 additions & 1 deletion tests/t097_dump_basic.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
#!/usr/bin/env python

from runtest import TestBase
import subprocess as sp

from runtest import TestBase

class TestCase(TestBase):
def __init__(self):
TestBase.__init__(self, 'abc', """
Expand Down
5 changes: 3 additions & 2 deletions tests/t098_dump_tid.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
#!/usr/bin/env python

from runtest import TestBase
import subprocess as sp
import os.path
import subprocess as sp

from runtest import TestBase

class TestCase(TestBase):
def __init__(self):
Expand Down
3 changes: 2 additions & 1 deletion tests/t099_dump_filter.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
#!/usr/bin/env python

from runtest import TestBase
import subprocess as sp

from runtest import TestBase

class TestCase(TestBase):
def __init__(self):
TestBase.__init__(self, 'abc', """
Expand Down
3 changes: 2 additions & 1 deletion tests/t100_dump_depth.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
#!/usr/bin/env python

from runtest import TestBase
import subprocess as sp

from runtest import TestBase

class TestCase(TestBase):
def __init__(self):
TestBase.__init__(self, 'abc', """
Expand Down
5 changes: 3 additions & 2 deletions tests/t103_dump_kernel.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
#!/usr/bin/env python

from runtest import TestBase
import subprocess as sp
import os
import subprocess as sp

from runtest import TestBase

class TestCase(TestBase):
def __init__(self):
Expand Down
5 changes: 3 additions & 2 deletions tests/t104_graph_kernel.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
#!/usr/bin/env python

from runtest import TestBase
import subprocess as sp
import os
import subprocess as sp

from runtest import TestBase

class TestCase(TestBase):
def __init__(self):
Expand Down
5 changes: 3 additions & 2 deletions tests/t111_kernel_tid.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
#!/usr/bin/env python

from runtest import TestBase
import subprocess as sp
import os
import subprocess as sp

from runtest import TestBase

class TestCase(TestBase):
def __init__(self):
Expand Down
3 changes: 2 additions & 1 deletion tests/t117_time_range.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
#!/usr/bin/env python

from runtest import TestBase
import subprocess as sp

from runtest import TestBase

START=0

class TestCase(TestBase):
Expand Down
3 changes: 2 additions & 1 deletion tests/t122_time_range2.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
#!/usr/bin/env python

from runtest import TestBase
import subprocess as sp

from runtest import TestBase

START=0

class TestCase(TestBase):
Expand Down
3 changes: 2 additions & 1 deletion tests/t125_report_range.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
#!/usr/bin/env python

from runtest import TestBase
import subprocess as sp

from runtest import TestBase

START=0

class TestCase(TestBase):
Expand Down
3 changes: 2 additions & 1 deletion tests/t129_session_tid.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
#!/usr/bin/env python

from runtest import TestBase
import subprocess as sp

from runtest import TestBase

# Test that task.txt files with a tid in the SESS line still work

class TestCase(TestBase):
Expand Down
3 changes: 2 additions & 1 deletion tests/t132_trigger_kernel.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
#!/usr/bin/env python

from runtest import TestBase
import os

from runtest import TestBase

# there was a problem applying depth filter if it contains kernel functions
class TestCase(TestBase):
def __init__(self):
Expand Down
3 changes: 2 additions & 1 deletion tests/t135_trigger_time2.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
#!/usr/bin/env python

from runtest import TestBase
import subprocess as sp

from runtest import TestBase

TDIR='xxx'
TIME=0
UNIT=''
Expand Down
3 changes: 2 additions & 1 deletion tests/t137_kernel_tid_update.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
#!/usr/bin/env python

from runtest import TestBase
import os

from runtest import TestBase

class TestCase(TestBase):
def __init__(self):
TestBase.__init__(self, 'fork2', serial=True, result="""
Expand Down
3 changes: 2 additions & 1 deletion tests/t138_kernel_dynamic.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
#!/usr/bin/env python

from runtest import TestBase
import os

from runtest import TestBase

class TestCase(TestBase):
def __init__(self):
TestBase.__init__(self, 'openclose', serial=True, result="""
Expand Down
3 changes: 2 additions & 1 deletion tests/t139_kernel_dynamic2.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
#!/usr/bin/env python

from runtest import TestBase
import os

from runtest import TestBase

class TestCase(TestBase):
def __init__(self):
TestBase.__init__(self, 'openclose', serial=True, result="""
Expand Down
5 changes: 3 additions & 2 deletions tests/t141_recv_basic.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
#!/usr/bin/env python

from runtest import TestBase
import subprocess as sp
import os.path
import subprocess as sp

from runtest import TestBase

TDIR = 'xxx'

Expand Down
5 changes: 3 additions & 2 deletions tests/t142_recv_multi.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
#!/usr/bin/env python

from runtest import TestBase
import subprocess as sp
import os.path
import random
import subprocess as sp

from runtest import TestBase

TDIR = 'xxx'

Expand Down
7 changes: 4 additions & 3 deletions tests/t143_recv_kernel.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
#!/usr/bin/env python

from runtest import TestBase
import subprocess as sp
import random
import os
import random
import subprocess as sp

from runtest import TestBase

TDIR = 'xxx'

Expand Down
3 changes: 2 additions & 1 deletion tests/t148_event_kernel.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
#!/usr/bin/env python

from runtest import TestBase
import os

from runtest import TestBase

class TestCase(TestBase):
def __init__(self):
TestBase.__init__(self, 'sleep', serial=True, result="""
Expand Down
3 changes: 2 additions & 1 deletion tests/t149_event_kernel2.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
#!/usr/bin/env python

from runtest import TestBase
import os

from runtest import TestBase

class TestCase(TestBase):
def __init__(self):
TestBase.__init__(self, 'fork', serial=True, result="""
Expand Down
5 changes: 3 additions & 2 deletions tests/t150_recv_event.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
#!/usr/bin/env python

from runtest import TestBase
import subprocess as sp
import os.path
import subprocess as sp

from runtest import TestBase

TDIR = 'xxx'

Expand Down
3 changes: 2 additions & 1 deletion tests/t151_recv_runcmd.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
#!/usr/bin/env python

from runtest import TestBase
import subprocess as sp

from runtest import TestBase

TDIR = 'xxx'
TMPF = 'out'

Expand Down
Loading

0 comments on commit 2adf355

Please sign in to comment.