mirror of
https://github.com/craigerl/aprsd.git
synced 2025-02-03 09:44:15 -05:00
Fix for Collections change in 3.10
python 3.10 moved a module in the collections package breaking backwards compatibility. this patch puts a fix in to account for it.
This commit is contained in:
parent
40f23dcb48
commit
9d19502dd8
@ -1,9 +1,9 @@
|
||||
"""Utilities and helper functions."""
|
||||
|
||||
import collections
|
||||
import errno
|
||||
import os
|
||||
import re
|
||||
import sys
|
||||
|
||||
import update_checker
|
||||
|
||||
@ -15,6 +15,12 @@ from .fuzzyclock import fuzzy # noqa: F401
|
||||
from .ring_buffer import RingBuffer # noqa: F401
|
||||
|
||||
|
||||
if sys.version_info.major == 3 and sys.version_info.minor >= 10:
|
||||
from collections.abc import MutableMapping
|
||||
else:
|
||||
from collections import MutableMapping
|
||||
|
||||
|
||||
def env(*vars, **kwargs):
|
||||
"""This returns the first environment variable set.
|
||||
if none are non-empty, defaults to '' or keyword arg default
|
||||
@ -105,7 +111,7 @@ def flatten_dict(d, parent_key="", sep="."):
|
||||
items = []
|
||||
for k, v in d.items():
|
||||
new_key = parent_key + sep + k if parent_key else k
|
||||
if isinstance(v, collections.MutableMapping):
|
||||
if isinstance(v, MutableMapping):
|
||||
items.extend(flatten_dict(v, new_key, sep=sep).items())
|
||||
else:
|
||||
items.append((new_key, v))
|
||||
|
Loading…
Reference in New Issue
Block a user