Skip to content

Commit e224d8e

Browse files
saygoxLee-W
authored andcommitted
refactor(commands/commit): ignore type worrn
1 parent 404eb95 commit e224d8e

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

commitizen/commands/commit.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@
77
import subprocess
88
import sys
99
import tempfile
10-
from asyncio import get_event_loop_policy, set_event_loop_policy
11-
from asyncio.unix_events import _UnixDefaultEventLoopPolicy
10+
from asyncio import DefaultEventLoopPolicy, get_event_loop_policy, set_event_loop_policy
1211
from io import IOBase
1312

1413
import questionary
@@ -31,7 +30,7 @@
3130
from commitizen.git import smart_open
3231

3332

34-
class CZEventLoopPolicy(_UnixDefaultEventLoopPolicy):
33+
class CZEventLoopPolicy(DefaultEventLoopPolicy): # type: ignore
3534
def get_event_loop(self):
3635
self.set_event_loop(self._loop_factory(selectors.SelectSelector()))
3736
return self._local._loop
@@ -45,7 +44,7 @@ def __init__(self, stdx: IOBase):
4544
fd = os.open("/dev/tty", os.O_RDWR | os.O_NOCTTY)
4645
tty = open(fd, "wb+", buffering=0)
4746
else:
48-
tty = open("/dev/tty", "wb")
47+
tty = open("/dev/tty", "w") # type: ignore
4948
else:
5049
fd = os.open("/dev/tty", os.O_RDWR | os.O_NOCTTY)
5150
if self._fileno == 0:

tests/commands/test_commit_command.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -575,7 +575,7 @@ def test_WrapStdx(mocker):
575575
wrap_stout.write("data")
576576

577577
if sys.platform == "linux":
578-
writer_mock.assert_called_once_with("/dev/tty", "wb")
578+
writer_mock.assert_called_once_with("/dev/tty", "w")
579579
else:
580580
pass
581581
writer_mock().write.assert_called_once_with("data")
@@ -589,7 +589,7 @@ def test_WrapStdx(mocker):
589589
wrap_sterr.write("data")
590590

591591
if sys.platform == "linux":
592-
writer_mock.assert_called_once_with("/dev/tty", "wb")
592+
writer_mock.assert_called_once_with("/dev/tty", "w")
593593
else:
594594
pass
595595
writer_mock().write.assert_called_once_with("data")

0 commit comments

Comments
 (0)