diff options
author | Brett Holman <bholman.devel@gmail.com> | 2022-02-14 12:24:00 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-02-14 13:24:00 -0600 |
commit | 50195ec8d1052d2b7a80f47a3709ebc4e74d6764 (patch) | |
tree | 4abf46c23a891199f5e13aff3071feaebeb36d38 /cloudinit/importer.py | |
parent | 9ba3ca6ce5013207737e431f52735c7eda3a2fbb (diff) | |
download | vyos-cloud-init-50195ec8d1052d2b7a80f47a3709ebc4e74d6764.tar.gz vyos-cloud-init-50195ec8d1052d2b7a80f47a3709ebc4e74d6764.zip |
use PEP 589 syntax for TypeDict (#1253)
Use PEP 589 syntax for TypeDict annotation.
Also fixes previously broken typing MetaSchema typing implementation.
Diffstat (limited to 'cloudinit/importer.py')
-rw-r--r-- | cloudinit/importer.py | 26 |
1 files changed, 12 insertions, 14 deletions
diff --git a/cloudinit/importer.py b/cloudinit/importer.py index f84ff4da..2bc210dd 100644 --- a/cloudinit/importer.py +++ b/cloudinit/importer.py @@ -12,21 +12,19 @@ import sys import typing # annotations add value for development, but don't break old versions -# pyver: 3.5 -> 3.8 +# pyver: 3.6 -> 3.8 # pylint: disable=E1101 -if sys.version_info >= (3, 8) and hasattr(typing, "TypeDict"): - MetaSchema = typing.TypedDict( - "MetaSchema", - { - "name": str, - "id": str, - "title": str, - "description": str, - "distros": typing.List[str], - "examples": typing.List[str], - "frequency": str, - }, - ) +if sys.version_info >= (3, 8): + + class MetaSchema(typing.TypedDict): + name: str + id: str + title: str + description: str + distros: typing.List[str] + examples: typing.List[str] + frequency: str + else: MetaSchema = dict # pylint: enable=E1101 |