Skip to content

Commit 25ddac0

Browse files
committed
Use the new format session to re-format imports
1 parent 5df1a80 commit 25ddac0

9 files changed

+29
-18
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ Internal changes
1717
- Refactored the code to parse MI records to decrease the number of regex matches to perform
1818
- Added `__all__` to all modules, which means that star imports (like `from pygdbmi.gdbmiparser import *`) will not pollute the namespace with modules used by pygdbmi itself
1919
- Added `nox -s format` to re-format the source code using the correct options
20+
- Reformatted all imports with `isort`, and use it as part of `nox -s lint` and `nox -s format`
2021

2122
## 0.10.0.2
2223

example.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,14 @@
33
"""
44
Run with `python -m example`
55
"""
6-
import subprocess
76
import os
7+
import subprocess
88
import sys
9-
from pygdbmi.gdbcontroller import GdbController
109
from distutils.spawn import find_executable
1110

11+
from pygdbmi.gdbcontroller import GdbController
12+
13+
1214
SAMPLE_C_CODE_DIR = os.path.join(
1315
os.path.dirname(os.path.realpath(__file__)), "tests", "sample_c_app"
1416
)

noxfile.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
import itertools
2-
import nox # type: ignore
3-
from pathlib import Path
42
import shutil
3+
from pathlib import Path
4+
5+
import nox # type: ignore
6+
57

68
nox.options.sessions = ["tests", "lint", "docs"]
79
nox.options.reuse_existing_virtualenvs = True

pygdbmi/IoManager.py

+7-5
Original file line numberDiff line numberDiff line change
@@ -3,24 +3,26 @@
33
or pty.
44
"""
55
import io
6+
import logging
7+
import os
68
import select
79
import time
810
from pprint import pformat
9-
from typing import Union, List, Optional, Dict, Any, Tuple
11+
from typing import Any, Dict, List, Optional, Tuple, Union
12+
1013
from pygdbmi import gdbmiparser
11-
import os
12-
import logging
1314
from pygdbmi.constants import (
1415
DEFAULT_GDB_TIMEOUT_SEC,
1516
DEFAULT_TIME_TO_CHECK_FOR_ADDITIONAL_OUTPUT_SEC,
1617
USING_WINDOWS,
1718
GdbTimeoutError,
1819
)
1920

21+
2022
if USING_WINDOWS:
2123
import msvcrt
22-
from ctypes import windll, byref, wintypes, WinError, POINTER # type: ignore
23-
from ctypes.wintypes import HANDLE, DWORD, BOOL
24+
from ctypes import POINTER, WinError, byref, windll, wintypes # type: ignore
25+
from ctypes.wintypes import BOOL, DWORD, HANDLE
2426
else:
2527
import fcntl
2628

pygdbmi/gdbcontroller.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,13 @@
66
import logging
77
import subprocess
88
from distutils.spawn import find_executable
9-
from typing import Union, List, Optional
10-
from pygdbmi.IoManager import IoManager
9+
from typing import List, Optional, Union
10+
1111
from pygdbmi.constants import (
1212
DEFAULT_GDB_TIMEOUT_SEC,
1313
DEFAULT_TIME_TO_CHECK_FOR_ADDITIONAL_OUTPUT_SEC,
1414
)
15+
from pygdbmi.IoManager import IoManager
1516

1617

1718
__all__ = ["GdbController"]

pygdbmi/gdbmiparser.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@
1212
import re
1313
from typing import Callable, Dict, List, Match, Optional, Pattern, Tuple, Union
1414

15+
from pygdbmi.gdbescapes import unescape
1516
from pygdbmi.printcolor import fmt_green
1617
from pygdbmi.StringStream import StringStream
17-
from pygdbmi.gdbescapes import unescape
1818

1919

2020
__all__ = [

setup.py

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
from setuptools import find_packages, setup # type: ignore
99

10+
1011
EXCLUDE_FROM_PACKAGES = ["tests"]
1112
CURDIR = os.path.abspath(os.path.dirname(__file__))
1213
README = io.open("README.md", "r", encoding="utf-8").read()

tests/__main__.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1-
from . import test_pygdbmi, static_tests
1+
from . import static_tests, test_pygdbmi
2+
23

34
exit(test_pygdbmi.main() + static_tests.main())

tests/test_pygdbmi.py

+6-5
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,17 @@
88

99
import os
1010
import random
11-
import unittest
1211
import subprocess
13-
from time import time
12+
import unittest
1413
from distutils.spawn import find_executable
1514
from pprint import pprint
16-
from pygdbmi.StringStream import StringStream
15+
from time import time
16+
17+
from pygdbmi.constants import USING_WINDOWS, GdbTimeoutError
18+
from pygdbmi.gdbcontroller import GdbController
1719
from pygdbmi.gdbescapes import advance_past_string_with_gdb_escapes, unescape
1820
from pygdbmi.gdbmiparser import parse_response
19-
from pygdbmi.gdbcontroller import GdbController
20-
from pygdbmi.constants import GdbTimeoutError, USING_WINDOWS
21+
from pygdbmi.StringStream import StringStream
2122

2223

2324
if USING_WINDOWS:

0 commit comments

Comments
 (0)