Skip to content

Commit 7c742b0

Browse files
committed
Fix: Annotation was not supported by Python 3.8
We still support Ubuntu 20.04 that ships with Python 3.8. Solution: Use a different typing annotation depending on the version of Python, making it easier to ditch the simpler annotation when Python 3.8 goes out of support.
1 parent 23f05fb commit 7c742b0

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

vm_supervisor/pubsub.py

+6-1
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,18 @@
55

66
import asyncio
77
import logging
8+
import sys
89
from typing import Dict, Hashable, Set
910

1011
logger = logging.getLogger(__name__)
1112

1213

1314
class PubSub:
14-
subscribers: Dict[Hashable, Set[asyncio.Queue[set]]]
15+
if sys.version_info >= (3, 9):
16+
subscribers: Dict[Hashable, Set[asyncio.Queue[Set]]]
17+
else:
18+
# Support for Python 3.8 (Ubuntu 20.04)
19+
subscribers: Dict[Hashable, Set[asyncio.Queue]]
1520

1621
def __init__(self):
1722
self.subscribers = {}

0 commit comments

Comments
 (0)