8000 Fix deprecation warning for 3.7 and up · sigmavirus24/github3.py@3e81ad1 · GitHub
[go: up one dir, main page]

Skip to content

Commit 3e81ad1

Browse files
committed
Fix deprecation warning for 3.7 and up
Fix #963
1 parent 043d61f commit 3e81ad1

File tree

3 files changed

+15
-4
lines changed

3 files changed

+15
-4
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)

src/github3/session.py

Lines changed: 6 additions & 1 deletion
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+
from collections.abc import Callable
5+
except ImportError:
6+
# For Python 2.7 compatibility
7+
from collections import Callable
8+
49
import datetime
510
from contextlib import contextmanager
611
from logging import getLogger

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+
from collections.abc import Iterator
4+
except ImportError:
5+
# For Python 2.7 compatibility
6+
from collections import Iterator
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, Iterator):
1216
"""The :class:`GitHubIterator` class powers all of the iter_* methods."""
1317

1418
def __init__(

0 commit comments

Comments
 (0)
0