Fix runtime exception due to dict typing (#2243)

This commit is contained in:
Alex 2021-09-05 21:48:28 -05:00 committed by GitHub
parent 7f76f3726f
commit 4a6f1f150a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,7 +1,7 @@
import socket import socket
import threading import threading
import time import time
from typing import Optional from typing import Dict, Optional
from zeroconf import ( from zeroconf import (
_CLASS_IN, _CLASS_IN,
@ -64,7 +64,7 @@ class DashboardStatus(RecordUpdateListener, threading.Thread):
threading.Thread.__init__(self) threading.Thread.__init__(self)
self.zc = zc self.zc = zc
self.query_hosts: set[str] = set() self.query_hosts: set[str] = set()
self.key_to_host: dict[str, str] = {} self.key_to_host: Dict[str, str] = {}
self.stop_event = threading.Event() self.stop_event = threading.Event()
self.query_event = threading.Event() self.query_event = threading.Event()
self.on_update = on_update self.on_update = on_update
@ -72,7 +72,7 @@ class DashboardStatus(RecordUpdateListener, threading.Thread):
def update_record(self, zc: Zeroconf, now: float, record: DNSRecord) -> None: def update_record(self, zc: Zeroconf, now: float, record: DNSRecord) -> None:
pass pass
def request_query(self, hosts: dict[str, str]) -> None: def request_query(self, hosts: Dict[str, str]) -> None:
self.query_hosts = set(hosts.values()) self.query_hosts = set(hosts.values())
self.key_to_host = hosts self.key_to_host = hosts
self.query_event.set() self.query_event.set()