Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated MutableMapping import for Python 3.10 compatibility. #14

Merged
merged 1 commit into from
Aug 16, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions pelecanus/pelicanjson.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,13 @@
"""
import copy
import json
import collections
import sys

if sys.version_info.major == 3 and sys.version_info.minor >= 10:
from collections.abc import MutableMapping
from collections import deque
else:
from collections import MutableMapping, deque

from .toolbox import backfill_append
from .toolbox import new_json_from_path
Expand All @@ -24,7 +30,7 @@
from .exceptions import EmptyPath


class PelicanJson(collections.MutableMapping):
class PelicanJson(MutableMapping):
"""PelicanJson objects are nested JSON objects that provide a few
methods to make it easier to navigate and edit nested JSON objects.

Expand Down Expand Up @@ -251,7 +257,7 @@ def test_path(path):
# Now, let's take this path and figure out how much of it is already
# present in the object.
keys_present = path[:]
keys_missing = collections.deque()
keys_missing = deque()
while keys_present and not test_path(keys_present):
keys_missing.appendleft(keys_present.pop())

Expand Down