8000 Merge branch 'master' into fix-getattr · silvrwolfboy/github3.py@5509030 · GitHub
[go: up one dir, main page]

Skip to content

Commit 5509030

Browse files
authored
Merge branch 'master' into fix-getattr
2 parents 00c2f9c + 9e749aa commit 5509030

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
@@ -183,4 +183,6 @@ Contributors
183183

184184
- Tigran Tchougourian (@NargiT)
185185

186-
- Samuel Mendes (@smendes)
186+
- Samuel Mendes (@smendes)
187+
188+
- 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)
0