Skip to content

Commit 5a1ada9

Browse files
remove six usage (pyocd#1812)
Co-authored-by: Alexandre Detiste <[email protected]>
1 parent 2db39e1 commit 5a1ada9

29 files changed

+24
-60
lines changed

.pylintrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,7 @@ init-import=no
319319

320320
# List of qualified module names which can have objects that can redefine
321321
# builtins.
322-
redefining-builtins-modules=six.moves,past.builtins,future.builtins,builtins,io
322+
redefining-builtins-modules=builtins,io
323323

324324

325325
[FORMAT]

pyocd/commands/execution_context.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
import sys
2222
from typing import (Any, Callable, cast, Dict, IO, Iterator, List, NamedTuple, Optional, Sequence,
2323
TYPE_CHECKING)
24-
import six
2524
import pprint
2625
import subprocess
2726
from shutil import get_terminal_size
@@ -30,6 +29,7 @@
3029
from ..coresight.ap import MEM_AP
3130
from ..utility.strings import UniquePrefixMatcher
3231
from ..utility.cmdline import split_command_line
32+
from ..utility.compatibility import to_str_safe
3333

3434
if TYPE_CHECKING:
3535
from ..debug.svd.model import SVDPeripheral
@@ -493,6 +493,6 @@ def handle_system(self, invocation: CommandInvocation) -> None:
493493
"""@brief Evaluate a system call command."""
494494
try:
495495
output = subprocess.check_output(invocation.cmd, stderr=subprocess.STDOUT, shell=True)
496-
self.write(six.ensure_str(output), end='')
496+
self.write(to_str_safe(output), end='')
497497
except subprocess.CalledProcessError as err:
498498
raise exceptions.CommandError(str(err)) from err

pyocd/probe/jlink_probe.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
# See the License for the specific language governing permissions and
1717
# limitations under the License.
1818

19-
import six
2019
import logging
2120
from time import sleep
2221
import pylink
@@ -30,6 +29,7 @@
3029
from ..core.plugin import Plugin
3130
from ..core.options import OptionInfo
3231
from ..utility import conversion
32+
from ..utility.compatibility import to_str_safe
3333

3434
if TYPE_CHECKING:
3535
from pylink.structs import JLinkHardwareStatus
@@ -128,7 +128,7 @@ def __init__(self, serial_number):
128128
self._protocol = None
129129
self._default_protocol = None
130130
self._is_open = False
131-
self._product_name = six.ensure_str(info.acProduct)
131+
self._product_name = to_str_safe(info.acProduct)
132132
self._memory_interfaces = {}
133133

134134
@property

pyocd/probe/pydapaccess/interface/hidapi_backend.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818

1919
import logging
2020
import platform
21-
import six
2221
import threading
2322
import queue
2423
from typing import Optional
@@ -70,7 +69,7 @@ def __init__(self, dev, info: dict):
7069
self.vendor_name = info['manufacturer_string'] or f"{self.vid:#06x}"
7170
self.product_name = info['product_string'] or f"{self.pid:#06x}"
7271
self.serial_number = info['serial_number'] \
73-
or generate_device_unique_id(self.vid, self.pid, six.ensure_str(info['path']))
72+
or generate_device_unique_id(self.vid, self.pid, to_str_safe(info['path']))
7473
self.device_info = info
7574
self.device = dev
7675
self.closed = True

setup.cfg

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,6 @@ install_requires =
6767
pylink-square>=1.0,<2.0
6868
pyusb>=1.2.1,<2.0
6969
pyyaml>=6.0,<7.0
70-
six>=1.15.0,<2.0
7170
typing-extensions>=4.0,<5.0
7271

7372
[options.extras_require]

test/basic_test.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@
1313
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1414
# See the License for the specific language governing permissions and
1515
# limitations under the License.
16-
from __future__ import print_function
17-
1816
import argparse
1917
import os
2018
import sys

test/blank_test.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@
1414
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1515
# See the License for the specific language governing permissions and
1616
# limitations under the License.
17-
from __future__ import print_function
18-
1917
import os
2018
import sys
2119
from time import sleep

test/commands_test.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@
1313
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1414
# See the License for the specific language governing permissions and
1515
# limitations under the License.
16-
from __future__ import print_function
17-
1816
import argparse
1917
import sys
2018
import traceback

test/concurrency_test.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@
1313
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1414
# See the License for the specific language governing permissions and
1515
# limitations under the License.
16-
from __future__ import print_function
17-
1816
import argparse
1917
import os
2018
import sys

test/connect_test.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@
1313
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1414
# See the License for the specific language governing permissions and
1515
# limitations under the License.
16-
from __future__ import print_function
17-
1816
import os
1917
import sys
2018
import traceback

0 commit comments

Comments
 (0)