Skip to content

Commit

Permalink
Auto merge of #1134 - yan12125:fix-collections-abc-warning, r=micbou
Browse files Browse the repository at this point in the history
Fix DeprecationWarning from classes in collections.abc

This patch removes the following warning:
```
/usr/share/nvim/runtime/third_party/ycmd/ycmd/utils.py:499: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated, and in 3.8 it will stop working
  class HashableDict( collections.Mapping ):
```
This warning is originated from python/cpython#5460

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/valloric/ycmd/1134)
<!-- Reviewable:end -->
  • Loading branch information
zzbot authored Nov 23, 2018
2 parents 389bd2d + 7089fec commit b9e9430
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions ycmd/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
from builtins import * # noqa

from future.utils import PY2, native
import collections
import copy
import json
import logging
Expand All @@ -46,9 +45,11 @@
# from ycmd.utils import pathname2url, url2pathname, urljoin, urlparse
#
if PY2:
from collections import Mapping
from urlparse import urljoin, urlparse, unquote
from urllib import pathname2url, url2pathname, quote
else:
from collections.abc import Mapping # noqa
from urllib.parse import urljoin, urlparse, unquote, quote # noqa
from urllib.request import pathname2url, url2pathname # noqa

Expand Down Expand Up @@ -496,7 +497,7 @@ def StartThread( func, *args ):
return thread


class HashableDict( collections.Mapping ):
class HashableDict( Mapping ):
"""An immutable dictionary that can be used in dictionary's keys. The
dictionary must be JSON-encodable; in particular, all keys must be strings."""

Expand Down

0 comments on commit b9e9430

Please sign in to comment.