Skip to content

Commit

Permalink
Merge pull request #14 from mrkkollo/main
Browse files Browse the repository at this point in the history
Updated MutableMapping import for Python 3.10 compatibility.
  • Loading branch information
erewok committed Aug 16, 2022
2 parents f53ae71 + f6ef2a9 commit 4637ce3
Showing 1 changed file with 9 additions and 3 deletions.
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

0 comments on commit 4637ce3

Please sign in to comment.