Skip to content

Commit

Permalink
Add Python 3.8 compatibility to type annotations.
Browse files Browse the repository at this point in the history
  • Loading branch information
jaraco committed Dec 9, 2023
1 parent 0bea1bd commit fe929fc
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
1 change: 1 addition & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
omit =
# leading `*/` for pytest-dev/pytest-cov#456
*/.tox/*
*/compat/*
disable_warnings =
couldnt-parse

Expand Down
4 changes: 3 additions & 1 deletion jaraco/collections/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,14 @@
import copy
import functools
import random
from collections.abc import Container, Iterable, Mapping, MutableMapping
from collections.abc import Container, Iterable, Mapping
from typing import Any, Callable, Union

import jaraco.text
from more_itertools import consume

from .compat.py38 import MutableMapping


_Matchable = Union[Callable, Container, Iterable, re.Pattern]

Expand Down
8 changes: 8 additions & 0 deletions jaraco/collections/compat/py38.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import collections.abc
import sys
import typing

if sys.version_info >= (3, 9):
MutableMapping = collections.abc.MutableMapping
else:
MutableMapping = typing.MutableMapping

0 comments on commit fe929fc

Please sign in to comment.