Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix "from collections import Mapping, MutableMapping" with Python 3.8. #511

Closed
KelSolaar opened this issue Oct 1, 2019 · 4 comments
Closed

Comments

@KelSolaar
Copy link
Member

@KelSolaar KelSolaar commented Oct 1, 2019

This relates directly to #489 which has unfortunately not been updated by the original contributor.

The takeaway is that for Python 3.8 not breaking our imports we need to change a few imports from:

from collections import Mapping, MutableMapping

to:

from collections.abc import Mapping, MutableMapping

So I'm suggesting we use the following import scheme:

import sys

if sys.version_info[:2] >= (3, 8):  # pragma: no cover
    from collections.abc import Mapping, MutableMapping
else:  # pragma: no cover
    from collections import Mapping, MutableMapping

These are the imports I noted that would need change when I looked at it a few weeks ago:

/colour-science/colour/colour/algebra
    interpolation.py
        from collections import OrderedDict, Mapping
/colour-science/colour/colour/continuous
    multi_signals.py
        from collections import Iterator, Mapping, OrderedDict, Sequence
    signal.py
        from collections import Iterator, Mapping, OrderedDict, Sequence
/colour-science/colour/colour/plotting
    models.py
        from collections import Mapping
/colour-science/colour/colour/utilities
    array.py
        from collections import Mapping
    data_structures.py
        from collections import Mapping, MutableMapping

We cannot really check if the code works on 3.8 as we don't build against it but I'm assuming this should work.

@Chinmayrane16
Copy link
Contributor

@Chinmayrane16 Chinmayrane16 commented Oct 1, 2019

Hey @KelSolaar, is anyone working on this?

@KelSolaar
Copy link
Member Author

@KelSolaar KelSolaar commented Oct 1, 2019

Hi @Chinmayrane16,

Nobody currently! You can claim it if you want :)

Cheers,

Thomas

@Chinmayrane16
Copy link
Contributor

@Chinmayrane16 Chinmayrane16 commented Oct 1, 2019

Hey @KelSolaar,

I have updated the code. Kindly look into it and suggest changes, if any! :)

@KelSolaar
Copy link
Member Author

@KelSolaar KelSolaar commented Oct 1, 2019

Thanks a lot, this is merged! :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants