Skip to content

Commit

Permalink
BUG: Fix Mapping and Iterables names import modules
Browse files Browse the repository at this point in the history
Fix `Mapping` and `Iterables` classes import modules: import them from
`collections.abc` instead of from `collections` as they have been moved
to the former since Python 3.3.

Fixes:
```
Traceback (most recent call last):
  File ".virtualenvs/tract_querier/bin/tract_math", line 8, in <module>
    sys.exit(main())
  File ".virtualenvs/tract_querier/lib/python3.10/site-packages/scripts/tract_math.py", line 33, in main
    from tract_querier.tract_math import operations
  File ".virtualenvs/tract_querier/lib/python3.10/site-packages/tract_querier/tract_math/__init__.py", line 3, in <module>
    from .decorator import tract_math_operation, TractMathWrongArgumentsError
  File ".virtualenvs/tract_querier/lib/python3.10/site-packages/tract_querier/tract_math/decorator.py", line 3, in <module>
    from collections import Mapping, Iterable
ImportError: cannot import name 'Mapping' from 'collections' (/usr/lib/python3.10/collections/__init__.py)
```

Documentation:
https://docs.python.org/3.3/library/collections.abc.html
  • Loading branch information
jhlegarreta committed Jan 13, 2025
1 parent 15a6eba commit af87be4
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion tract_querier/tract_math/decorator.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import inspect
from itertools import repeat
from collections import Mapping, Iterable
from collections.abc import Mapping, Iterable
import io
import csv
from os import path
Expand Down

0 comments on commit af87be4

Please sign in to comment.