Skip to content

Commit 0e4400d

Browse files
committed
Remove old import compatibility checks:
I also went ahead and removed the `mock` package imports since `mock` is built into the stdlib now. In a future PR we can remove the mock package altogether, though it's fine to leave in for now.
1 parent ff44fbe commit 0e4400d

File tree

8 files changed

+8
-34
lines changed

8 files changed

+8
-34
lines changed

requests_oauthlib/compliance_fixes/facebook.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
11
from json import dumps
2-
3-
try:
4-
from urlparse import parse_qsl
5-
except ImportError:
6-
from urllib.parse import parse_qsl
2+
from urllib.parse import parse_qsl
73

84

95
def facebook_compliance_fix(session):

requests_oauthlib/compliance_fixes/instagram.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
1-
try:
2-
from urlparse import urlparse, parse_qs
3-
except ImportError:
4-
from urllib.parse import urlparse, parse_qs
1+
from urllib.parse import urlparse, parse_qs
52

63
from oauthlib.common import add_params_to_uri
74

requests_oauthlib/compliance_fixes/slack.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
1-
try:
2-
from urlparse import urlparse, parse_qs
3-
except ImportError:
4-
from urllib.parse import urlparse, parse_qs
1+
from urllib.parse import urlparse, parse_qs
52

63
from oauthlib.common import add_params_to_uri
74

requests_oauthlib/oauth1_session.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
from __future__ import unicode_literals
22

3-
try:
4-
from urlparse import urlparse
5-
except ImportError:
6-
from urllib.parse import urlparse
3+
from urllib.parse import urlparse
74

85
import logging
96

tests/test_compliance_fixes.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,7 @@
55
import requests_mock
66
import time
77

8-
try:
9-
from urlparse import urlparse, parse_qs
10-
except ImportError:
11-
from urllib.parse import urlparse, parse_qs
8+
from urllib.parse import urlparse, parse_qs
129

1310
from oauthlib.oauth2.rfc6749.errors import InvalidGrantError
1411
from requests_oauthlib import OAuth2Session

tests/test_core.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,7 @@
77
from io import StringIO
88
import unittest
99

10-
try:
11-
from unittest import mock
12-
except ImportError:
13-
import mock
10+
from unittest import mock
1411

1512

1613
@mock.patch("oauthlib.oauth1.rfc5849.generate_timestamp")

tests/test_oauth1_session.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,12 @@
22
import unittest
33
import requests
44
from io import StringIO
5+
from unittest import mock
56

67
from oauthlib.oauth1 import SIGNATURE_TYPE_QUERY, SIGNATURE_TYPE_BODY
78
from oauthlib.oauth1 import SIGNATURE_RSA, SIGNATURE_PLAINTEXT
89
from requests_oauthlib import OAuth1Session
910

10-
try:
11-
from unittest import mock
12-
except ImportError:
13-
import mock
14-
1511
try:
1612
import cryptography
1713
except ImportError:

tests/test_oauth2_session.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,7 @@
88
from copy import deepcopy
99
from unittest import TestCase
1010

11-
try:
12-
from unittest import mock
13-
except ImportError:
14-
import mock
11+
from unittest import mock
1512

1613
from oauthlib.common import urlencode
1714
from oauthlib.oauth2 import TokenExpiredError, OAuth2Error

0 commit comments

Comments
 (0)