From 7f0a8e9bce53eccfd23291f81d3253c107e70e99 Mon Sep 17 00:00:00 2001 From: Alexander Engelsberger Date: Mon, 30 Aug 2021 16:39:23 +0200 Subject: [PATCH] feat(compatibility): Python3.8 compatibility --- .travis.yml | 4 +++- prototorch/utils/utils.py | 12 ++++++++---- setup.py | 2 +- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/.travis.yml b/.travis.yml index 6320573..1ef6d58 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,7 +1,9 @@ dist: bionic sudo: false language: python -python: 3.9 +python: + - 3.9 + - 3.8 cache: directories: - "$HOME/.cache/pip" diff --git a/prototorch/utils/utils.py b/prototorch/utils/utils.py index df718bb..2d7462a 100644 --- a/prototorch/utils/utils.py +++ b/prototorch/utils/utils.py @@ -1,8 +1,12 @@ """ProtoFlow utilities""" import warnings -from collections.abc import Iterable -from typing import Union +from typing import ( + Dict, + Iterable, + List, + Union, +) import numpy as np import torch @@ -24,7 +28,7 @@ def mesh2d(x=None, border: float = 1.0, resolution: int = 100): return mesh, xx, yy -def distribution_from_list(list_dist: list[int], +def distribution_from_list(list_dist: List[int], clabels: Iterable[int] = None): clabels = clabels or list(range(len(list_dist))) distribution = dict(zip(clabels, list_dist)) @@ -32,7 +36,7 @@ def distribution_from_list(list_dist: list[int], def parse_distribution(user_distribution, - clabels: Iterable[int] = None) -> dict[int, int]: + clabels: Iterable[int] = None) -> Dict[int, int]: """Parse user-provided distribution. Return a dictionary with integer keys that represent the class labels and diff --git a/setup.py b/setup.py index de4531a..3441f07 100644 --- a/setup.py +++ b/setup.py @@ -59,7 +59,7 @@ setup( url=PROJECT_URL, download_url=DOWNLOAD_URL, license="MIT", - python_requires=">=3.9", + python_requires=">=3.8", install_requires=INSTALL_REQUIRES, extras_require={ "datasets": DATASETS,