3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-11-26 02:19:26 +01:00

auto-t: correctly import Mapping from collections

The current way this was being done was to import collections and
use collections.Mapping. This has been deprecated since python 3.3
but has worked up until python 3.10. After python 3.10 this will
no longer work, and Mapping must be imported from collections.abc.
This commit is contained in:
James Prestwood 2022-06-01 09:05:47 -07:00 committed by Denis Kenzior
parent 7290989e15
commit e2aca6e917
3 changed files with 8 additions and 7 deletions

View File

@ -3,9 +3,9 @@
from gi.repository import GLib from gi.repository import GLib
import dbus import dbus
import time import time
import collections
import iwd import iwd
from collections.abc import Mapping
from config import ctx from config import ctx
EAD_SERVICE = 'net.connman.ead' EAD_SERVICE = 'net.connman.ead'
@ -38,7 +38,7 @@ class Adapter(iwd.IWDDBusAbstract):
return self._properties['Authenticated'] return self._properties['Authenticated']
class AdapterList(collections.Mapping): class AdapterList(Mapping):
def __init__(self, ead): def __init__(self, ead):
self._dict = {} self._dict = {}

View File

@ -1,8 +1,8 @@
#!/usr/bin/python3 #!/usr/bin/python3
import dbus import dbus
import sys import sys
import collections
from collections.abc import Mapping
from weakref import WeakValueDictionary from weakref import WeakValueDictionary
from abc import ABCMeta, abstractmethod from abc import ABCMeta, abstractmethod
from enum import Enum from enum import Enum
@ -210,7 +210,7 @@ class Rule(HwsimDBusAbstract):
prefix + '\tDelay:\t' + str(self.delay) + '\n' + \ prefix + '\tDelay:\t' + str(self.delay) + '\n' + \
prefix + '\tEnabled:\t' + str(self.enabled) + '\n' prefix + '\tEnabled:\t' + str(self.enabled) + '\n'
class RuleSet(collections.Mapping): class RuleSet(Mapping):
def __init__(self, hwsim, objects): def __init__(self, hwsim, objects):
self._dict = {} self._dict = {}
self._rule_manager = hwsim.rule_manager self._rule_manager = hwsim.rule_manager
@ -275,7 +275,7 @@ class Radio(HwsimDBusAbstract):
prefix + '\tName:\t\t' + self.name + '\n' + \ prefix + '\tName:\t\t' + self.name + '\n' + \
prefix + '\tAddresses:\t' + repr(self.destination) + '\n' prefix + '\tAddresses:\t' + repr(self.destination) + '\n'
class RadioList(collections.Mapping): class RadioList(Mapping):
def __init__(self, hwsim, objects): def __init__(self, hwsim, objects):
self._dict = {} self._dict = {}
self._radio_manager = hwsim.radio_manager self._radio_manager = hwsim.radio_manager

View File

@ -8,10 +8,11 @@ import sys
import os import os
import threading import threading
import time import time
import collections import collections.abc
import datetime import datetime
import weakref import weakref
from collections.abc import Mapping
from abc import ABCMeta, abstractmethod from abc import ABCMeta, abstractmethod
from enum import Enum from enum import Enum
@ -1018,7 +1019,7 @@ class P2PPeer(IWDDBusAbstract):
self._iface.Disconnect() self._iface.Disconnect()
class DeviceList(collections.Mapping): class DeviceList(Mapping):
def __init__(self, iwd): def __init__(self, iwd):
self._dict = {} self._dict = {}
self._p2p_dict = {} self._p2p_dict = {}