Test error: module 'collections' has no attribute 'MutableSet'

Issue #70 resolved
Former user created an issue
Running tests
Done
Traceback (most recent call last):
  File "/usr/bin/run_resfinder.py", line 8, in <module>
    from cge.resfinder import ResFinder
  File "/usr/share/resfinder/cge/resfinder.py", line 14, in <module>
    from .output.table import TableResults
  File "/usr/share/resfinder/cge/output/table.py", line 2, in <module>
    from .orderedset import OrderedSet
  File "/usr/share/resfinder/cge/output/orderedset.py", line 20, in <module>
    class OrderedSet(collections.MutableSet):
AttributeError: module 'collections' has no attribute 'MutableSet'
EEEE

In python 3.10[1] deprecated aliases to Collections Abstract Base Classes from the collections module have been removed. These imports must be done from collections.abc.

  1. https://docs.python.org/3/whatsnew/3.10.html

Trivial change below:

--- a/cge/output/orderedset.py
+++ b/cge/output/orderedset.py
@@ -17,7 +17,7 @@
 # SOFTWARE.
 import collections

-class OrderedSet(collections.MutableSet):
+class OrderedSet(collections.abc.MutableSet):

     def __init__(self, iterable=None):
         self.end = end = []

Comments (1)

  1. Log in to comment