Skip to content

Commit

Permalink
Fix typing hints
Browse files Browse the repository at this point in the history
Older Python (like 3.8 in R4.1) does not allow plain 'list' or 'tuple'
in hints, use typing module instead.

QubesOS/qubes-issues#7991
  • Loading branch information
marmarek committed Mar 14, 2023
1 parent 7b568f1 commit 1787d9f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
5 changes: 3 additions & 2 deletions sender/screenshare.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
gi.require_version("Gdk", "3.0")
from gi.repository import Gdk
from service import Service
from typing import List, Tuple


class ScreenShare(Service):
Expand All @@ -28,13 +29,13 @@ def video_source(self) -> str:
def icon(self) -> str:
return "video-display"

def parameters(self) -> tuple[int, int, int]:
def parameters(self) -> Tuple[int, int, int]:
monitor = Gdk.Display().get_default().get_monitor(0)
scale, geometry = monitor.get_scale_factor(), monitor.get_geometry()
return (scale * geometry.width, scale * geometry.height, 30, {})

def pipeline(self, width: int, height: int, fps: int,
**kwargs) -> list[str]:
**kwargs) -> List[str]:
caps = (
"colorimetry=2:4:7:1,"
"chroma-site=none,"
Expand Down
6 changes: 3 additions & 3 deletions sender/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
import os
import struct
import sys
from typing import Optional, NoReturn
from typing import Optional, NoReturn, List, Tuple

import gi

Expand Down Expand Up @@ -65,13 +65,13 @@ def icon(self) -> str:
raise NotImplementedError("Pure virtual method called!")

def pipeline(self, width: int, height: int, fps: int,
**kwargs) -> list[str]:
**kwargs) -> List[str]:
"""
Return a set-up GStreamer pipeline
"""
raise NotImplementedError("Pure virtual method called!")

def parameters(self) -> tuple[int, int, int, dict]:
def parameters(self) -> Tuple[int, int, int, dict]:
"""
Compute the parameters. Return a (width, height, fps) tuple.
"""
Expand Down

0 comments on commit 1787d9f

Please sign in to comment.