Skip to content

Commit 9e749aa

Browse files
authored
Merge pull request sigmavirus24#964 from dmerejkowsky/dm/3.8
Fix deprecation warning for 3.7 and up
2 parents 043d61f + 3c3ad20 commit 9e749aa

File tree

5 files changed

+24
-7
lines changed

5 files changed

+24
-7
lines changed

AUTHORS.rst

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,4 +181,6 @@ Contributors
181181

182182
- Steven Nyman (@stevennyman)
183183

184-
- Tigran Tchougourian (@NargiT)
184+
- Tigran Tchougourian (@NargiT)
185+
186+
- Dimitri Merejkowsky (@dmerejkowsky)

CONTRIBUTING.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,8 @@ Guidelines for Contributing to github3.py
5656

5757
#. Please follow pep-0008_. Feel free to also use flake8_ to help.
5858

59+
#. Import modules, not class or functions
60+
5961
.. links
6062
.. _README: ./README.rst
6163
.. _easy: https://github.com/sigmavirus24/github3.py/issues?labels=Easy&page=1&state=open

src/github3/session.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
# -*- coding: utf-8 -*-
22
"""Module containing session and auth logic."""
3-
from collections import Callable
3+
try:
4+
import collections.abc as abc_collections
5+
except ImportError:
6+
# For Python 2.7 compatibility
7+
import collections as abc_collections
8+
49
import datetime
510
from contextlib import contextmanager
611
from logging import getLogger
@@ -193,7 +198,7 @@ def two_factor_auth_callback(self, callback):
193198
if not callback:
194199
return
195200

196-
if not isinstance(callback, Callable):
201+
if not isinstance(callback, abc_collections.Callable):
197202
raise ValueError("Your callback should be callable")
198203

199204
self.two_factor_auth_cb = callback

src/github3/structs.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# -*- coding: utf-8 -*-
2-
import collections
2+
try:
3+
import collections.abc as abc_collections
4+
except ImportError:
5+
# For Python 2.7 compatibility
6+
import collections as abc_collections
37
import functools
48

59
from requests.compat import urlparse, urlencode
@@ -8,7 +12,7 @@
812
from . import models
913

1014

11-
class GitHubIterator(models.GitHubCore, collections.Iterator):
15+
class GitHubIterator(models.GitHubCore, abc_collections.Iterator):
1216
"""The :class:`GitHubIterator` class powers all of the iter_* methods."""
1317

1418
def __init__(

src/github3/utils.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
# -*- coding: utf-8 -*-
22
"""A collection of useful utilities."""
3-
import collections
3+
try:
4+
import collections.abc as abc_collections
5+
except ImportError:
6+
# For Python 2.7 compatibility
7+
import collections as abc_collections
48
import datetime
59
import re
610

@@ -68,7 +72,7 @@ def stream_response_to_file(response, path=None):
6872
fd = None
6973
filename = None
7074
if path:
71-
if isinstance(getattr(path, "write", None), collections.Callable):
75+
if isinstance(getattr(path, "write", None), abc_collections.Callable):
7276
pre_opened = True
7377
fd = path
7478
filename = getattr(fd, "name", None)

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy