Skip to content

Commit fd6fb6e

Browse files
Added deprecated boolean
1 parent 7eb7800 commit fd6fb6e

File tree

3 files changed

+19
-13
lines changed

3 files changed

+19
-13
lines changed

cursorless-talon/src/csv_overrides.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -59,12 +59,13 @@ def csv_get_normalized_ctx():
5959

6060
def init_csv_and_watch_changes(
6161
filename: str,
62-
default_values: ListToSpokenForms | None,
62+
default_values: ListToSpokenForms,
6363
handle_new_values: Optional[Callable[[list[SpokenFormEntry]], None]] = None,
6464
*,
6565
extra_ignored_values: Optional[list[str]] = None,
6666
extra_allowed_values: Optional[list[str]] = None,
6767
allow_unknown_values: bool = False,
68+
deprecated: bool = False,
6869
default_list_name: Optional[str] = None,
6970
headers: list[str] = [SPOKEN_FORM_HEADER, CURSORLESS_IDENTIFIER_HEADER],
7071
no_update_file: bool = False,
@@ -123,12 +124,11 @@ def init_csv_and_watch_changes(
123124
pluralize_lists = []
124125

125126
file_path = get_full_path(filename)
127+
is_file = file_path.is_file()
126128

127-
# No default values and file does not exist. Do nothing.
128-
if default_values is None:
129-
if not file_path.is_file():
130-
return lambda: None
131-
default_values = {}
129+
# Deprecated file that doesn't exist. Do nothing.
130+
if deprecated and not is_file:
131+
return lambda: None
132132

133133
super_default_values = get_super_values(default_values)
134134

@@ -160,7 +160,7 @@ def on_watch(path, flags):
160160

161161
fs.watch(file_path.parent, on_watch)
162162

163-
if file_path.is_file():
163+
if is_file:
164164
current_values = update_file(
165165
path=file_path,
166166
headers=headers,

cursorless-talon/src/spoken_forms.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,12 @@
233233
"-from": "experimental.setInstanceReference"
234234
}
235235
},
236+
"experimental/wrapper_snippets.csv": {},
237+
"experimental/insertion_snippets.csv": {},
238+
"experimental/insertion_snippets_single_phrase.csv": {},
239+
"experimental/miscellaneous.csv": {
240+
"phrase_terminator": { "over": "phraseTerminator" }
241+
},
236242
"experimental/actions_custom.csv": {},
237243
"experimental/regex_scope_types.csv": {},
238244
"hat_styles.csv": {

cursorless-talon/src/spoken_forms.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,7 @@ def auto_construct_defaults(
3232
spoken_forms: dict[str, ListToSpokenForms],
3333
handle_new_values: Callable[[str, list[SpokenFormEntry]], None],
3434
f: Callable[
35-
Concatenate[
36-
str, ListToSpokenForms | None, Callable[[list[SpokenFormEntry]], None], P
37-
],
35+
Concatenate[str, ListToSpokenForms, Callable[[list[SpokenFormEntry]], None], P],
3836
R,
3937
],
4038
):
@@ -55,7 +53,7 @@ def auto_construct_defaults(
5553
"""
5654

5755
def ret(filename: str, *args: P.args, **kwargs: P.kwargs) -> R:
58-
default_values = spoken_forms.get(filename)
56+
default_values = spoken_forms[filename]
5957
return f(
6058
filename,
6159
default_values,
@@ -169,23 +167,25 @@ def handle_new_values(csv_name: str, values: list[SpokenFormEntry]):
169167
# DEPRECATED @ 2025-02-01
170168
handle_csv(
171169
"experimental/wrapper_snippets.csv",
170+
deprecated=True,
172171
allow_unknown_values=True,
173172
default_list_name="wrapper_snippet",
174173
),
175174
handle_csv(
176175
"experimental/insertion_snippets.csv",
176+
deprecated=True,
177177
allow_unknown_values=True,
178178
default_list_name="insertion_snippet_no_phrase",
179179
),
180180
handle_csv(
181181
"experimental/insertion_snippets_single_phrase.csv",
182+
deprecated=True,
182183
allow_unknown_values=True,
183184
default_list_name="insertion_snippet_single_phrase",
184185
),
185186
handle_csv(
186187
"experimental/miscellaneous.csv",
187-
allow_unknown_values=True,
188-
default_list_name="phrase_terminator",
188+
deprecated=True,
189189
),
190190
# ---
191191
handle_csv(

0 commit comments

Comments
 (0)