Skip to content

Commit abc583f

Browse files
committed
Fix or suppress all Python type errors
1 parent cb042d6 commit abc583f

24 files changed

+116
-57
lines changed

cursorless-talon-dev/src/spoken_form_test.py

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,25 +42,31 @@ def did_emit_pre_phrase_signal():
4242
return True
4343

4444
def private_cursorless_run_rpc_command_and_wait(
45-
command_id: str, arg1: Any, arg2: Any = None
45+
command_id: str, # pyright: ignore [reportGeneralTypeIssues]
46+
arg1: Any,
47+
arg2: Any = None,
4648
):
4749
commands_run.append(arg1)
4850

4951
def private_cursorless_run_rpc_command_no_wait(
50-
command_id: str, arg1: Any, arg2: Any = None
52+
command_id: str, # pyright: ignore [reportGeneralTypeIssues]
53+
arg1: Any,
54+
arg2: Any = None,
5155
):
5256
commands_run.append(arg1)
5357

5458
def private_cursorless_run_rpc_command_get(
55-
command_id: str, arg1: Any, arg2: Any = None
59+
command_id: str, # pyright: ignore [reportGeneralTypeIssues]
60+
arg1: Any,
61+
arg2: Any = None,
5662
) -> Any:
5763
commands_run.append(arg1)
5864
return mockedGetValue
5965

6066

6167
@mod.action_class
6268
class Actions:
63-
def private_cursorless_spoken_form_test_mode(enable: bool):
69+
def private_cursorless_spoken_form_test_mode(enable: bool): # pyright: ignore [reportGeneralTypeIssues]
6470
"""Enable/disable Cursorless spoken form test mode"""
6571
global saved_modes, saved_microphone
6672

@@ -84,7 +90,7 @@ def private_cursorless_spoken_form_test_mode(enable: bool):
8490
"Cursorless spoken form tests are done. Talon microphone is re-enabled."
8591
)
8692

87-
def private_cursorless_use_community_snippets(enable: bool):
93+
def private_cursorless_use_community_snippets(enable: bool): # pyright: ignore [reportGeneralTypeIssues]
8894
"""Enable/disable cursorless community snippets in test mode"""
8995
if enable:
9096
tags = set(ctx.tags)
@@ -99,7 +105,8 @@ def private_cursorless_use_community_snippets(enable: bool):
99105
print(f"Set community snippet enablement to {enable}")
100106

101107
def private_cursorless_spoken_form_test(
102-
phrase: str, mockedGetValue_: Optional[str]
108+
phrase: str, # pyright: ignore [reportGeneralTypeIssues]
109+
mockedGetValue_: Optional[str],
103110
):
104111
"""Run Cursorless spoken form test"""
105112
global commands_run, mockedGetValue

cursorless-talon/src/actions/actions.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
from ..targets.target_types import (
66
CursorlessDestination,
7+
CursorlessExplicitTarget,
78
CursorlessTarget,
89
ImplicitDestination,
910
)
@@ -48,7 +49,7 @@
4849
"custom_action",
4950
]
5051

51-
callback_actions: dict[str, Callable[[CursorlessTarget], None]] = {
52+
callback_actions: dict[str, Callable[[CursorlessExplicitTarget], None]] = {
5253
"nextHomophone": cursorless_homophones_action,
5354
}
5455

@@ -88,7 +89,7 @@ def cursorless_action_or_ide_command(m) -> dict[str, str]:
8889

8990
@mod.action_class
9091
class Actions:
91-
def cursorless_command(action_name: str, target: CursorlessTarget):
92+
def cursorless_command(action_name: str, target: CursorlessExplicitTarget): # pyright: ignore [reportGeneralTypeIssues]
9293
"""Perform cursorless command on target"""
9394
if action_name in callback_actions:
9495
callback_actions[action_name](target)
@@ -107,28 +108,30 @@ def cursorless_command(action_name: str, target: CursorlessTarget):
107108
action = {"name": action_name, "target": target}
108109
actions.user.private_cursorless_command_and_wait(action)
109110

110-
def cursorless_vscode_command(command_id: str, target: CursorlessTarget):
111+
def cursorless_vscode_command(command_id: str, target: CursorlessTarget): # pyright: ignore [reportGeneralTypeIssues]
111112
"""
112113
Perform vscode command on cursorless target
113114
114115
Deprecated: prefer `cursorless_ide_command`
115116
"""
116117
return actions.user.cursorless_ide_command(command_id, target)
117118

118-
def cursorless_ide_command(command_id: str, target: CursorlessTarget):
119+
def cursorless_ide_command(command_id: str, target: CursorlessTarget): # pyright: ignore [reportGeneralTypeIssues]
119120
"""Perform ide command on cursorless target"""
120121
return cursorless_execute_command_action(command_id, target)
121122

122123
def cursorless_insert(
123-
destination: CursorlessDestination, text: Union[str, list[str]]
124+
destination: CursorlessDestination, # pyright: ignore [reportGeneralTypeIssues]
125+
text: Union[str, list[str]],
124126
):
125127
"""Perform text insertion on Cursorless destination"""
126128
if isinstance(text, str):
127129
text = [text]
128130
cursorless_replace_action(destination, text)
129131

130132
def private_cursorless_action_or_ide_command(
131-
instruction: dict[str, str], target: CursorlessTarget
133+
instruction: dict[str, str], # pyright: ignore [reportGeneralTypeIssues]
134+
target: CursorlessTarget,
132135
):
133136
"""Perform cursorless action or ide command on target (internal use only)"""
134137
type = instruction["type"]

cursorless-talon/src/actions/bring_move.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ def cursorless_bring_move_targets(m) -> BringMoveTargets:
3535

3636
@mod.action_class
3737
class Actions:
38-
def private_cursorless_bring_move(action_name: str, targets: BringMoveTargets):
38+
def private_cursorless_bring_move(action_name: str, targets: BringMoveTargets): # pyright: ignore [reportGeneralTypeIssues]
3939
"""Execute Cursorless move/bring action"""
4040
actions.user.private_cursorless_command_and_wait(
4141
{

cursorless-talon/src/actions/call.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
@mod.action_class
1010
class Actions:
1111
def private_cursorless_call(
12-
callee: CursorlessTarget,
12+
callee: CursorlessTarget, # pyright: ignore [reportGeneralTypeIssues]
1313
argument: CursorlessTarget = ImplicitTarget(),
1414
):
1515
"""Execute Cursorless call action"""

cursorless-talon/src/actions/get_text.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
@mod.action_class
1111
class Actions:
1212
def cursorless_get_text(
13-
target: CursorlessTarget,
13+
target: CursorlessTarget, # pyright: ignore [reportGeneralTypeIssues]
1414
hide_decorations: bool = False,
1515
) -> str:
1616
"""Get target text. If hide_decorations is True, don't show decorations"""
@@ -21,7 +21,7 @@ def cursorless_get_text(
2121
)[0]
2222

2323
def cursorless_get_text_list(
24-
target: CursorlessTarget,
24+
target: CursorlessTarget, # pyright: ignore [reportGeneralTypeIssues]
2525
hide_decorations: bool = False,
2626
) -> list[str]:
2727
"""Get texts for multiple targets. If hide_decorations is True, don't show decorations"""

cursorless-talon/src/actions/homophones.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,15 @@
22

33
from talon import actions, app
44

5-
from ..targets.target_types import CursorlessTarget, PrimitiveDestination
5+
from ..targets.target_types import (
6+
CursorlessExplicitTarget,
7+
PrimitiveDestination,
8+
)
69
from .get_text import cursorless_get_text_action
710
from .replace import cursorless_replace_action
811

912

10-
def cursorless_homophones_action(target: CursorlessTarget):
13+
def cursorless_homophones_action(target: CursorlessExplicitTarget):
1114
"""Replaced target with next homophone"""
1215
texts = cursorless_get_text_action(target, show_decorations=False)
1316
try:

cursorless-talon/src/actions/paste.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@
99

1010
@mod.action_class
1111
class Actions:
12-
def private_cursorless_paste(destination: CursorlessDestination):
12+
def private_cursorless_paste(
13+
destination: CursorlessDestination, # pyright: ignore [reportGeneralTypeIssues]
14+
):
1315
"""Execute Cursorless paste action"""
1416
actions.user.private_cursorless_command_and_wait(
1517
{

cursorless-talon/src/actions/reformat.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
from talon import Module, actions
22

3-
from ..targets.target_types import CursorlessTarget, PrimitiveDestination
3+
from ..targets.target_types import (
4+
CursorlessExplicitTarget,
5+
PrimitiveDestination,
6+
)
47
from .get_text import cursorless_get_text_action
58
from .replace import cursorless_replace_action
69

@@ -11,7 +14,10 @@
1114

1215
@mod.action_class
1316
class Actions:
14-
def private_cursorless_reformat(target: CursorlessTarget, formatters: str):
17+
def private_cursorless_reformat(
18+
target: CursorlessExplicitTarget, # pyright: ignore [reportGeneralTypeIssues]
19+
formatters: str,
20+
):
1521
"""Execute Cursorless reformat action. Reformat target with formatter"""
1622
texts = cursorless_get_text_action(target, show_decorations=False)
1723
updated_texts = [actions.user.reformat_text(text, formatters) for text in texts]

cursorless-talon/src/actions/swap.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,9 @@ def cursorless_swap_targets(m) -> SwapTargets:
3636

3737
@mod.action_class
3838
class Actions:
39-
def private_cursorless_swap(targets: SwapTargets):
39+
def private_cursorless_swap(
40+
targets: SwapTargets, # pyright: ignore [reportGeneralTypeIssues]
41+
):
4042
"""Execute Cursorless swap action"""
4143
actions.user.private_cursorless_command_and_wait(
4244
{

cursorless-talon/src/actions/wrap.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@
1010
@mod.action_class
1111
class Actions:
1212
def private_cursorless_wrap_with_paired_delimiter(
13-
action_name: str, target: CursorlessTarget, paired_delimiter: list[str]
13+
action_name: str, # pyright: ignore [reportGeneralTypeIssues]
14+
target: CursorlessTarget,
15+
paired_delimiter: list[str],
1416
):
1517
"""Execute Cursorless wrap/rewrap with paired delimiter action"""
1618
if action_name == "rewrap":
@@ -26,7 +28,9 @@ def private_cursorless_wrap_with_paired_delimiter(
2628
)
2729

2830
def private_cursorless_wrap_with_snippet(
29-
action_name: str, target: CursorlessTarget, snippet_location: str
31+
action_name: str, # pyright: ignore [reportGeneralTypeIssues]
32+
target: CursorlessTarget,
33+
snippet_location: str,
3034
):
3135
"""Execute Cursorless wrap with snippet action"""
3236
if action_name == "wrapWithPairedDelimiter":

0 commit comments

Comments
 (0)