Skip to content

Commit 7cad725

Browse files
committed
Revert "Enable ruff TC type checking ruleset and accept automated refactorings"
This reverts commit 374a885.
1 parent 9007cc7 commit 7cad725

File tree

4 files changed

+9
-9
lines changed

4 files changed

+9
-9
lines changed

cmd2/ansi.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ def style_aware_wcswidth(text: str) -> int:
104104
then this function returns -1. Replace tabs with spaces before calling this.
105105
"""
106106
# Strip ANSI style sequences since they cause wcswidth to return -1
107-
return cast('int', wcswidth(strip_style(text)))
107+
return cast(int, wcswidth(strip_style(text)))
108108

109109

110110
def widest_line(text: str) -> int:

cmd2/clipboard.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ def get_paste_buffer() -> str:
1212
1313
:return: contents of the clipboard
1414
"""
15-
pb_str = typing.cast("str", pyperclip.paste())
15+
pb_str = typing.cast(str, pyperclip.paste())
1616
return pb_str
1717

1818

cmd2/py_bridge.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ def __call__(self, command: str, *, echo: Optional[bool] = None) -> CommandResul
115115
echo = self.cmd_echo
116116

117117
# This will be used to capture _cmd2_app.stdout and sys.stdout
118-
copy_cmd_stdout = StdSim(cast('Union[TextIO, StdSim]', self._cmd2_app.stdout), echo=echo)
118+
copy_cmd_stdout = StdSim(cast(Union[TextIO, StdSim], self._cmd2_app.stdout), echo=echo)
119119

120120
# Pause the storing of stdout until onecmd_plus_hooks enables it
121121
copy_cmd_stdout.pause_storage = True
@@ -127,17 +127,17 @@ def __call__(self, command: str, *, echo: Optional[bool] = None) -> CommandResul
127127

128128
stop = False
129129
try:
130-
self._cmd2_app.stdout = cast('TextIO', copy_cmd_stdout)
131-
with redirect_stdout(cast('IO[str]', copy_cmd_stdout)):
132-
with redirect_stderr(cast('IO[str]', copy_stderr)):
130+
self._cmd2_app.stdout = cast(TextIO, copy_cmd_stdout)
131+
with redirect_stdout(cast(IO[str], copy_cmd_stdout)):
132+
with redirect_stderr(cast(IO[str], copy_stderr)):
133133
stop = self._cmd2_app.onecmd_plus_hooks(
134134
command,
135135
add_to_history=self._add_to_history,
136136
py_bridge_call=True,
137137
)
138138
finally:
139139
with self._cmd2_app.sigint_protection:
140-
self._cmd2_app.stdout = cast('IO[str]', copy_cmd_stdout.inner_stream)
140+
self._cmd2_app.stdout = cast(IO[str], copy_cmd_stdout.inner_stream)
141141
self.stop = stop or self.stop
142142

143143
# Save the result

cmd2/utils.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ def get_bool_choices(_) -> list[str]: # type: ignore[no-untyped-def]
159159
return ['true', 'false']
160160

161161
val_type = to_bool
162-
choices_provider = cast('ChoicesProviderFunc', get_bool_choices)
162+
choices_provider = cast(ChoicesProviderFunc, get_bool_choices)
163163

164164
self.name = name
165165
self.val_type = val_type
@@ -1189,7 +1189,7 @@ def get_defining_class(meth: Callable[..., Any]) -> Optional[type[Any]]:
11891189
cls = getattr(inspect.getmodule(meth), meth.__qualname__.split('.<locals>', 1)[0].rsplit('.', 1)[0])
11901190
if isinstance(cls, type):
11911191
return cls
1192-
return cast('type', getattr(meth, '__objclass__', None)) # handle special descriptor objects
1192+
return cast(type, getattr(meth, '__objclass__', None)) # handle special descriptor objects
11931193

11941194

11951195
class CompletionMode(Enum):

0 commit comments

Comments
 (0)