diff --git a/pkgs/clan-app/clan_app/api/file.py b/pkgs/clan-app/clan_app/api/file.py index 62100d978..5dd2b1d04 100644 --- a/pkgs/clan-app/clan_app/api/file.py +++ b/pkgs/clan-app/clan_app/api/file.py @@ -40,8 +40,7 @@ def open_file( root.withdraw() # Hide the main window root.attributes("-topmost", True) # Bring the dialogs to the front - - file_path: str = "" + file_path: str = "" multiple_files: list[str] = [] if file_request.mode == "open_file": @@ -67,10 +66,10 @@ def open_file( elif file_request.mode == "open_multiple_files": tresult = filedialog.askopenfilenames( - title=file_request.title, - initialdir=file_request.initial_folder, - filetypes=_apply_filters(file_request.filters), - ) + title=file_request.title, + initialdir=file_request.initial_folder, + filetypes=_apply_filters(file_request.filters), + ) multiple_files = list(tresult) if len(file_path) == 0 and len(multiple_files) == 0: diff --git a/pkgs/clan-cli/clan_cli/api/__init__.py b/pkgs/clan-cli/clan_cli/api/__init__.py index 4e3f18b08..c0a1ce37b 100644 --- a/pkgs/clan-cli/clan_cli/api/__init__.py +++ b/pkgs/clan-cli/clan_cli/api/__init__.py @@ -54,12 +54,14 @@ def update_wrapper_signature(wrapper: Callable, wrapped: Callable) -> None: params = list(sig.parameters.values()) # Add 'op_key' parameter - op_key_param = Parameter("op_key", - Parameter.KEYWORD_ONLY, - # we add a None default value so that typescript code gen drops the parameter - # FIXME: this is a hack, we should filter out op_key in the typescript code gen - default=None, - annotation=str) + op_key_param = Parameter( + "op_key", + Parameter.KEYWORD_ONLY, + # we add a None default value so that typescript code gen drops the parameter + # FIXME: this is a hack, we should filter out op_key in the typescript code gen + default=None, + annotation=str, + ) params.append(op_key_param) # Create a new signature diff --git a/pkgs/clan-cli/clan_cli/api/serde.py b/pkgs/clan-cli/clan_cli/api/serde.py index e15be8e2d..6b1f60281 100644 --- a/pkgs/clan-cli/clan_cli/api/serde.py +++ b/pkgs/clan-cli/clan_cli/api/serde.py @@ -302,7 +302,7 @@ def construct_dataclass( field_value = data.get(data_field_name) if field_value is None and ( - field.type is None or is_type_in_union(field.type, type(None)) + field.type is None or is_type_in_union(field.type, type(None)) # type: ignore ): field_values[field.name] = None else: diff --git a/pkgs/clan-cli/clan_cli/api/util.py b/pkgs/clan-cli/clan_cli/api/util.py index 404f5e39f..073a945d2 100644 --- a/pkgs/clan-cli/clan_cli/api/util.py +++ b/pkgs/clan-cli/clan_cli/api/util.py @@ -119,7 +119,9 @@ def type_to_dict( f.type, str ), f"Expected field type to be a type, got {f.type}, Have you imported `from __future__ import annotations`?" properties[f.metadata.get("alias", f.name)] = type_to_dict( - f.type, f"{scope} {t.__name__}.{f.name}", type_map + f.type, + f"{scope} {t.__name__}.{f.name}", # type: ignore + type_map, # type: ignore ) required = set() diff --git a/pkgs/clan-cli/clan_cli/jsonrpc.py b/pkgs/clan-cli/clan_cli/jsonrpc.py index ec83050d9..8234e837d 100644 --- a/pkgs/clan-cli/clan_cli/jsonrpc.py +++ b/pkgs/clan-cli/clan_cli/jsonrpc.py @@ -10,6 +10,6 @@ class ClanJSONEncoder(json.JSONEncoder): return o.to_json() # Check if the object is a dataclass if dataclasses.is_dataclass(o): - return dataclasses.asdict(o) # type: ignore[call-overload] + return dataclasses.asdict(o) # type: ignore # Otherwise, use the default serialization return super().default(o) diff --git a/pkgs/webview-ui/app/src/api/index.ts b/pkgs/webview-ui/app/src/api/index.ts index 30ce2aa07..9bca920ec 100644 --- a/pkgs/webview-ui/app/src/api/index.ts +++ b/pkgs/webview-ui/app/src/api/index.ts @@ -43,14 +43,18 @@ export interface GtkResponse { op_key: string; } - export const callApi = async ( method: K, args: OperationArgs, ): Promise> => { console.log("Calling API", method, args); - const response = await (window as unknown as Record) => Promise>>)[method](args); + const response = await ( + window as unknown as Record< + OperationNames, + ( + args: OperationArgs, + ) => Promise> + > + )[method](args); return response as OperationResponse; }; - - diff --git a/pkgs/webview-ui/app/src/index.tsx b/pkgs/webview-ui/app/src/index.tsx index a172e586e..155294f66 100644 --- a/pkgs/webview-ui/app/src/index.tsx +++ b/pkgs/webview-ui/app/src/index.tsx @@ -26,7 +26,6 @@ export const client = new QueryClient(); const root = document.getElementById("app"); - if (import.meta.env.DEV && !(root instanceof HTMLElement)) { throw new Error( "Root element not found. Did you forget to add it to your index.html? Or maybe the id attribute got misspelled?", diff --git a/pkgs/webview-ui/app/tests/types.test.ts b/pkgs/webview-ui/app/tests/types.test.ts index 2db35d654..b4d7f748e 100644 --- a/pkgs/webview-ui/app/tests/types.test.ts +++ b/pkgs/webview-ui/app/tests/types.test.ts @@ -1,9 +1,6 @@ import { describe, it } from "vitest"; - describe.concurrent("API types work properly", () => { // Test some basic types - it("distinct success/error unions", async () => { - - }); + it("distinct success/error unions", async () => {}); });