You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

54 lines
1.5 KiB

  1. From 2b6bb2c1bed8f7009631e8f8c306fa3160324a49 Mon Sep 17 00:00:00 2001
  2. From: "Sergey G. Brester" <serg.brester@sebres.de>
  3. Date: Mon, 8 Feb 2021 17:19:24 +0100
  4. Subject: [PATCH 2/4] follow bpo-37324:
  5. :ref:`collections-abstract-base-classes` moved to the :mod:`collections.abc`
  6. module
  7. (since 3.10-alpha.5 `MutableMapping` is missing in collections module)
  8. ---
  9. fail2ban/server/action.py | 5 ++++-
  10. 1 file changed, 4 insertions(+), 1 deletion(-)
  11. --- a/fail2ban/server/action.py
  12. +++ b/fail2ban/server/action.py
  13. @@ -30,7 +30,10 @@ import tempfile
  14. import threading
  15. import time
  16. from abc import ABCMeta
  17. -from collections import MutableMapping
  18. +try:
  19. + from collections.abc import MutableMapping
  20. +except ImportError:
  21. + from collections import MutableMapping
  22. from .failregex import mapTag2Opt
  23. from .ipdns import DNSUtils
  24. --- a/fail2ban/server/actions.py
  25. +++ b/fail2ban/server/actions.py
  26. @@ -28,7 +28,10 @@ import logging
  27. import os
  28. import sys
  29. import time
  30. -from collections import Mapping
  31. +try:
  32. + from collections.abc import Mapping
  33. +except ImportError:
  34. + from collections import Mapping
  35. try:
  36. from collections import OrderedDict
  37. except ImportError:
  38. --- a/fail2ban/server/jails.py
  39. +++ b/fail2ban/server/jails.py
  40. @@ -22,7 +22,10 @@ __copyright__ = "Copyright (c) 2004 Cyri
  41. __license__ = "GPL"
  42. from threading import Lock
  43. -from collections import Mapping
  44. +try:
  45. + from collections.abc import Mapping
  46. +except ImportError:
  47. + from collections import Mapping
  48. from ..exceptions import DuplicateJailException, UnknownJailException
  49. from .jail import Jail