feat(compatibility): Python3.8 compatibility

This commit is contained in:
Alexander Engelsberger 2021-08-30 16:39:23 +02:00 committed by Alexander Engelsberger
parent bf09ff8f7f
commit 7f0a8e9bce
3 changed files with 12 additions and 6 deletions

View File

@ -1,7 +1,9 @@
dist: bionic
sudo: false
language: python
python: 3.9
python:
- 3.9
- 3.8
cache:
directories:
- "$HOME/.cache/pip"

View File

@ -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

View File

@ -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,