Skip to content

Commit

Permalink
use collections.abc for Mapping (#2750)
Browse files Browse the repository at this point in the history
* use collections.abc.Mapping when available

* ignore py2, tox -e py27-linux revealed setup.py requires python 3.5

* use collections.abc.Iterable
  • Loading branch information
mattf authored Mar 21, 2020
1 parent 30ca5b3 commit f767e1e
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 5 deletions.
3 changes: 2 additions & 1 deletion gensim/corpora/dictionary.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@

from __future__ import with_statement

from collections import Mapping, defaultdict
from collections import defaultdict
from collections.abc import Mapping
import sys
import logging
import itertools
Expand Down
3 changes: 2 additions & 1 deletion gensim/models/doc2vec.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,8 @@
except ImportError:
from Queue import Queue # noqa:F401

from collections import namedtuple, defaultdict, Iterable
from collections import namedtuple, defaultdict
from collections.abc import Iterable
from timeit import default_timer

from numpy import zeros, float32 as REAL, empty, ones, \
Expand Down
2 changes: 1 addition & 1 deletion gensim/models/fasttext.py
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@
import numpy as np
from numpy import ones, vstack, float32 as REAL
import six
from collections import Iterable
from collections.abc import Iterable

import gensim.models._fasttext_bin

Expand Down
3 changes: 1 addition & 2 deletions gensim/test/test_corpora_dictionary.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@
Unit tests for the `corpora.Dictionary` class.
"""


from collections import Mapping
from collections.abc import Mapping
from itertools import chain
import logging
import unittest
Expand Down

0 comments on commit f767e1e

Please sign in to comment.