Skip to content

Commit 062bc0a

Browse files
authored
Merge pull request #17 from jfuruness/main
Modified collections import and added 3.10 to nox file
2 parents 352a1bd + 220088d commit 062bc0a

3 files changed

Lines changed: 9 additions & 3 deletions

File tree

ci_tools/nox_utils.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222

2323

2424
PY27, PY35, PY36, PY37, PY38, PY39 = "2.7", "3.5", "3.6", "3.7", "3.8", "3.9"
25+
PY310 = "3.10"
2526
DONT_INSTALL = "dont_install"
2627

2728

noxfile.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,15 @@
99
# add parent folder to python path so that we can import noxfile_utils.py
1010
# note that you need to "pip install -r noxfile-requiterements.txt" for this file to work.
1111
sys.path.append(str(Path(__file__).parent / "ci_tools"))
12-
from nox_utils import PY27, PY37, PY36, PY35, PY38, PY39, power_session, rm_folder, rm_file, PowerSession # noqa
12+
from nox_utils import PY27, PY37, PY36, PY35, PY38, PY39, PY310, power_session, rm_folder, rm_file, PowerSession # noqa
1313

1414

1515
pkg_name = "yamlable"
1616
gh_org = "smarie"
1717
gh_repo = "python-yamlable"
1818

1919
ENVS = {
20+
PY310: {"coverage": False, "pkg_specs": {"pip": ">19"}},
2021
PY39: {"coverage": False, "pkg_specs": {"pip": ">19"}},
2122
PY27: {"coverage": False, "pkg_specs": {"pip": ">10"}},
2223
PY35: {"coverage": False, "pkg_specs": {"pip": ">10", "PyYaml": "<5"}},

yamlable/main.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,11 @@
33
#
44
# License: 3-clause BSD, <https://github.com/smarie/python-yamlable/blob/master/LICENSE>
55

6-
import collections
6+
try:
7+
from collections.abc import Mapping
8+
except ImportError:
9+
from collections import Mapping
10+
711
from abc import abstractmethod, ABCMeta
812

913
import six
@@ -520,7 +524,7 @@ def encode(cls, dumper, obj,
520524
"""
521525
# Convert objects to a dictionary of their representation
522526
yaml_tag_suffix, obj_as_dict = cls.to_yaml_dict(obj)
523-
if not isinstance(obj_as_dict, collections.Mapping) or not isinstance(yaml_tag_suffix, str):
527+
if not isinstance(obj_as_dict, Mapping) or not isinstance(yaml_tag_suffix, str):
524528
raise TypeError("`to_yaml_dict` did not return correct results. It should return a tuple of "
525529
"`yaml_tag_suffix, obj_as_dict`")
526530

0 commit comments

Comments
 (0)