Skip to content

Commit

Permalink
Fix: Annotation was not supported by Python 3.8
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
hoh committed Oct 6, 2022
1 parent 23f05fb commit 7c742b0
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion vm_supervisor/pubsub.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,18 @@

import asyncio
import logging
import sys
from typing import Dict, Hashable, Set

logger = logging.getLogger(__name__)


class PubSub:
subscribers: Dict[Hashable, Set[asyncio.Queue[set]]]
if sys.version_info >= (3, 9):
subscribers: Dict[Hashable, Set[asyncio.Queue[Set]]]
else:
# Support for Python 3.8 (Ubuntu 20.04)
subscribers: Dict[Hashable, Set[asyncio.Queue]]

def __init__(self):
self.subscribers = {}
Expand Down

0 comments on commit 7c742b0

Please sign in to comment.