Skip to content

Commit

Permalink
Fix typing errors in system_info.py
Browse files Browse the repository at this point in the history
- import "importlib.util" directly to please the type checker
- handle case when flatpack-version is not present
- fix the return value of __get_gtk_version
  • Loading branch information
gycsaba96 authored and diegogangl committed Oct 15, 2024
1 parent c059f8b commit d883f75
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions GTG/core/system_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,12 @@

import os
import platform
import importlib
import importlib.util
from typing import Tuple

from GTG.core import info

from gi.repository import Gdk, Gtk, GObject, GLib, Xdp
from gi.repository import Gdk, Gtk, GObject, GLib, Xdp # type: ignore[import-untyped]


class SystemInfo:
Expand Down Expand Up @@ -99,9 +100,10 @@ def __get_flatpak_version(self) -> str:
if line.startswith("flatpak-version"):
flatpak_version = line.split("=")[1].strip()
return flatpak_version
raise RuntimeError("Missing flatpak-version in /.flatpak-info file.")


def __get_gtk_version(self) -> str:
def __get_gtk_version(self) -> Tuple[int,int,int]:
"""Get GTK version."""
return (
Gtk.get_major_version(),
Expand Down

0 comments on commit d883f75

Please sign in to comment.