mirror of
https://github.com/aclist/dztui.git
synced 2026-11-05 01:24:48 +01:00
chore: clear typehinting errors
This commit is contained in:
1 parent
2d265c4b9b
commit
156c1f8ec4
16 files changed
+83
-85
No files matched your search
@@ -108,7 +108,6 @@ class FastInsertListStore(ListStore):
|
||||
self.append(row)
|
||||
|
||||
def append(self, row: list[Any] | tuple[Any, ...] | None = ...) -> TreeIter: # type: ignore
|
||||
# FIXME: argument cannot be none
|
||||
"""
|
||||
Optimized for speed, but makes no assurances about row homogeneity
|
||||
and may segfault if types and length are not identical to ListStore.
|
||||
|
||||
@@ -32,7 +32,7 @@ class ProxyModelManager:
|
||||
{}
|
||||
)
|
||||
|
||||
self.proxy_model: "FastInsertListStore" = None
|
||||
self.proxy_model: "FastInsertListStore"
|
||||
self.filter_man = filter_man
|
||||
|
||||
# TODO: list typehints
|
||||
@@ -49,6 +49,8 @@ class ProxyModelManager:
|
||||
self.proxy_model.append(row)
|
||||
|
||||
def append_row_to_control(self, row: list) -> None:
|
||||
if self.control_model is None:
|
||||
raise AttributeError("Trying to add rows to a non-existent model")
|
||||
self.control_model.append(row)
|
||||
self.filter(FilterMode.INITIAL, skip_cache=True)
|
||||
|
||||
@@ -97,8 +99,10 @@ class ProxyModelManager:
|
||||
def clear_proxy_model(self) -> None:
|
||||
self.proxy_model.clear()
|
||||
|
||||
def get_proxy_model(self) -> "FastInsertListStore":
|
||||
return self.proxy_model
|
||||
def get_proxy_model(self) -> Union["FastInsertListStore", None]:
|
||||
if hasattr(self, "proxy_model"):
|
||||
return self.proxy_model
|
||||
return None
|
||||
|
||||
def filter(
|
||||
self, mode: FilterMode, skip_cache: bool = False
|
||||
@@ -243,7 +247,7 @@ class ProxyModelManager:
|
||||
return self.filtered
|
||||
|
||||
def set_cache(
|
||||
self, filters: tuple, model: Optional["FastInsertListStore"], rows: list
|
||||
self, filters: tuple, model: "FastInsertListStore", rows: list
|
||||
) -> None:
|
||||
self.filter_cache[filters] = (model, rows)
|
||||
|
||||
@@ -260,7 +264,7 @@ class ProxyModelManager:
|
||||
def get_filtered(self) -> list:
|
||||
return self.filtered
|
||||
|
||||
def set_proxy_model(self, model: Optional["FastInsertListStore"]) -> None:
|
||||
def set_proxy_model(self, model: "FastInsertListStore") -> None:
|
||||
"""
|
||||
FastInsertListStore representation of the raw model after filtration
|
||||
"""
|
||||
@@ -272,7 +276,11 @@ class ProxyModelManager:
|
||||
"""
|
||||
self.control_model = rows
|
||||
|
||||
def get_control(self) -> list:
|
||||
def get_control(self) -> list[Any]:
|
||||
if self.control_model is None:
|
||||
raise AttributeError(
|
||||
"Expected a populated control model, but it is Nonetype"
|
||||
)
|
||||
return self.control_model
|
||||
|
||||
def wipe_cache(self, full: bool = False) -> None:
|
||||
|
||||
@@ -303,7 +303,6 @@ class ServerModelManager:
|
||||
self.thread_man.set_cleanup_func(func)
|
||||
return
|
||||
config_man.add_saved_server(fqip)
|
||||
# 2026-05-04
|
||||
# FIXME: this is valid if saved servers tab is already open,
|
||||
# but not if app was just booted
|
||||
if proxy_man.has_control_model() is False:
|
||||
|
||||
Reference in new issue
Block a user