Skip to content

Commit 546d9ec

Browse files
authored
chore!: Drop support for python 2.7 (#645)
Closes: SDK-1717
1 parent 1ac5fc1 commit 546d9ec

File tree

83 files changed

+205
-305
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

83 files changed

+205
-305
lines changed

.travis.yml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,10 @@ before_cache:
1515

1616
matrix:
1717
include:
18-
- python: 2.7
18+
- python: 3.5
1919
env: TOX_ENV=pycodestyle
20-
- python: 2.7
20+
- python: 3.5
2121
env: TOX_ENV=pylint
22-
- python: 2.7
23-
env: TOX_ENV=py27
2422
- python: 3.5
2523
env: TOX_ENV=py35
2624
- python: 3.6

.travis/install.sh

Lines changed: 5 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -21,22 +21,6 @@ if [[ "$(uname -s)" == 'Darwin' ]]; then
2121
fi
2222

2323
case "${TOX_ENV}" in
24-
py26)
25-
curl -O https://bootstrap.pypa.io/get-pip.py
26-
python get-pip.py --user
27-
;;
28-
py27)
29-
curl -O https://bootstrap.pypa.io/get-pip.py
30-
python get-pip.py --user
31-
;;
32-
py33)
33-
pyenv install 3.3.6
34-
pyenv global 3.3.6
35-
;;
36-
py34)
37-
pyenv install 3.4.2
38-
pyenv global 3.4.2
39-
;;
4024
py35)
4125
pyenv install 3.5.0
4226
pyenv global 3.5.0
@@ -45,10 +29,15 @@ if [[ "$(uname -s)" == 'Darwin' ]]; then
4529
pyenv install 3.6.0
4630
pyenv global 3.6.0
4731
;;
32+
py37)
33+
pyenv install 3.7.0
34+
pyenv global 3.7.0
35+
;;
4836
pypy)
4937
pyenv install "pypy${PYPY_VERSION}"
5038
pyenv global "pypy${PYPY_VERSION}"
5139
;;
40+
5241
esac
5342
pyenv rehash
5443
python -m pip install -U --user virtualenv
@@ -65,15 +54,6 @@ else
6554
pip install -U virtualenv
6655
pip install --upgrade pip
6756
python -m venv $PWD/.venv
68-
elif [[ "${TOX_ENV}" == "py27" ]] || [[ "${TOX_ENV}" == "pycodestyle" ]] || [[ "${TOX_ENV}" == "pylint" ]]; then
69-
git clone https://github.com/yyuu/pyenv.git $PWD/.pyenv
70-
export PYENV_ROOT="$PWD/.pyenv"
71-
export PATH="$PYENV_ROOT/bin:$PATH"
72-
eval "$(pyenv init --path)"
73-
pyenv install 2.7.14
74-
pyenv global 2.7.14
75-
pip install -U virtualenv
76-
python -m virtualenv $PWD/.venv
7757
else
7858
python -m virtualenv $PWD/.venv
7959
fi

.travis/run.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ set -o pipefail
1010
if [[ "$(uname -s)" == "Darwin" ]]; then
1111
eval "$(pyenv init -)"
1212
else
13-
if [[ "${TOX_ENV}" == "pypy" ]] || [[ "${TOX_ENV}" == "py27" ]] || [[ "${TOX_ENV}" == "pycodestyle" ]] || [[ "${TOX_ENV}" == "pylint" ]]; then
13+
if [[ "${TOX_ENV}" == "pypy" ]]; then
1414
export PYENV_ROOT="$PWD/.pyenv"
1515
export PATH="$PYENV_ROOT/bin:$PATH"
1616
eval "$(pyenv init -)"

HISTORY.rst

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Release History
44
---------------
55

66
2.14.0 (2021-12-08)
7-
++++++++
7+
++++++++++++++++++++
88

99
**New Features and Enhancements:**
1010

@@ -14,11 +14,12 @@ Release History
1414
- Support base item operations for WebLink class (`#639 <https://github.com/box/box-python-sdk/pull/639>`_)
1515

1616
**Bug Fixes:**
17+
1718
- Limit cryptography to version <3.5.0 (`#636 <https://github.com/box/box-python-sdk/pull/636>`_)
1819
- Avoid raising 404 when a thumbnail cannot be generated for a file (`#642 <https://github.com/box/box-python-sdk/pull/642>`_)
1920

2021
2.13.0 (2021-09-30)
21-
++++++++
22+
++++++++++++++++++++
2223

2324
**New Features and Enhancements:**
2425

@@ -30,14 +31,14 @@ Release History
3031
- Upgrade cryptography to version 3 (`#620 <https://github.com/box/box-python-sdk/pull/620>`_)
3132

3233
2.12.1 (2021-06-16)
33-
++++++++
34+
++++++++++++++++++++
3435

3536
**Bug Fixes:**
3637

3738
- Fix bug when thumbnail representations are not found (`#597 <https://github.com/box/box-python-sdk/pull/597>`_)
3839

3940
2.12.0 (2021-04-16)
40-
++++++++
41+
++++++++++++++++++++
4142

4243
**New Features and Enhancements:**
4344

@@ -47,14 +48,14 @@ Release History
4748
- Update `get_groups()` to use documented parameter to filter by name (`#586 <https://github.com/box/box-python-sdk/pull/586>`_)
4849

4950
2.11.0 (2021-01-11)
50-
++++++++
51+
++++++++++++++++++++
5152

5253
**New Features and Enhancements:**
5354

5455
- Deprecate and add method for getting a thumbnail (`#572 <https://github.com/box/box-python-sdk/pull/572>`_)
5556

5657
2.10.0 (2020-10-02)
57-
++++++++
58+
++++++++++++++++++++
5859

5960
**New Features and Enhancements:**
6061

@@ -68,21 +69,21 @@ Release History
6869
- Allow ints to be passed in as item IDs (`#530 <https://github.com/box/box-python-sdk/pull/530>`_)
6970

7071
2.9.0 (2020-06-23)
71-
++++++++
72+
++++++++++++++++++++
7273
- Fix exception handling for OAuth
7374
- Fix path parameter sanitization
7475

7576
2.8.0 (2020-04-24)
76-
++++++++
77+
++++++++++++++++++++
7778
- Added support for token exchange using shared links
7879
- Added the ability to pass in a SHA1 value for file uploads
7980

8081
2.7.1 (2020-01-21)
81-
++++++++
82+
++++++++++++++++++++
8283
- Fixed bug in `_get_retry_request_callable` introduced in release 2.7.0 which caused chunked uploads to fail
8384

8485
2.7.0 (2020-01-16)
85-
++++++++
86+
++++++++++++++++++++
8687
- Fixed bug in `get_admin_events` function which caused errors when the optional `event_types` parameter was omitted.
8788
- Add marker based pagination for listing users.
8889
- Added support for more attribute parameters when uploading new files and new versions of existing files.
@@ -93,7 +94,7 @@ Release History
9394

9495
2.6.1 (2019-10-24)
9596
++++++++++++++++++
96-
- Added api_ call decorator for copy method.
97+
- Added `api_call` decorator for copy method.
9798

9899
2.6.0 (2019-08-29)
99100
++++++++++++++++++

boxsdk/auth/cooperatively_managed_oauth2.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ def __init__(self, retrieve_tokens=None, *args, **kwargs):
1818
"""
1919
# pylint:disable=keyword-arg-before-vararg
2020
self._retrieve_tokens = retrieve_tokens
21-
super(CooperativelyManagedOAuth2Mixin, self).__init__(*args, **kwargs)
21+
super().__init__(*args, **kwargs)
2222

2323
def _get_tokens(self):
2424
"""
@@ -33,4 +33,3 @@ class CooperativelyManagedOAuth2(CooperativelyManagedOAuth2Mixin):
3333
Allows for sharing auth tokens between multiple clients. The retrieve_tokens callback should
3434
return the current access/refresh token pair.
3535
"""
36-
pass

boxsdk/auth/developer_token_auth.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ class DeveloperTokenAuth(OAuth2):
1212

1313
def __init__(self, get_new_token_callback=None, **kwargs):
1414
self._get_new_token = get_new_token_callback
15-
super(DeveloperTokenAuth, self).__init__(
15+
super().__init__(
1616
client_id=None,
1717
client_secret=None,
1818
access_token=self._refresh_developer_token(),

boxsdk/auth/jwt_auth.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ def __init__(
144144
)
145145
del rsa_private_key_data
146146
del rsa_private_key_file_sys_path
147-
super(JWTAuth, self).__init__(
147+
super().__init__(
148148
client_id,
149149
client_secret,
150150
store_tokens=store_tokens,

boxsdk/auth/oauth2.py

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@
99
import sys
1010
from threading import Lock
1111

12-
# pylint:disable=import-error,no-name-in-module,relative-import
12+
# pylint:disable=import-error,no-name-in-module
1313
from six.moves.urllib.parse import urlencode, urlunsplit
14-
# pylint:enable=import-error,no-name-in-module,relative-import
14+
# pylint:enable=import-error,no-name-in-module
1515
import six
1616

1717
from ..config import API
@@ -38,10 +38,9 @@ class TokenScope(TextEnum):
3838

3939
class TokenResponse(BaseAPIJSONObject):
4040
""" Represents the response for a token request. """
41-
pass
4241

4342

44-
class OAuth2(object):
43+
class OAuth2:
4544
"""
4645
Responsible for handling OAuth2 for the Box API. Can authenticate and refresh tokens.
4746
@@ -344,13 +343,14 @@ def _execute_token_request(self, data, access_token, expect_refresh_token=True):
344343
access_token=access_token,
345344
)
346345
except BoxAPIException as box_api_exception:
347-
six.raise_from(self._oauth_exception(box_api_exception.network_response, url), box_api_exception)
346+
raise self._oauth_exception(box_api_exception.network_response, url) from box_api_exception
347+
348348
if not network_response.ok:
349349
raise self._oauth_exception(network_response, url)
350350
try:
351351
token_response = TokenResponse(network_response.json())
352-
except ValueError:
353-
raise self._oauth_exception(network_response, url)
352+
except ValueError as value_exception:
353+
raise self._oauth_exception(network_response, url) from value_exception
354354

355355
if ('access_token' not in token_response) or (expect_refresh_token and 'refresh_token' not in token_response):
356356
raise self._oauth_exception(network_response, url)
@@ -426,7 +426,8 @@ def revoke(self):
426426
access_token=access_token,
427427
)
428428
except BoxAPIException as box_api_exception:
429-
six.raise_from(self._oauth_exception(box_api_exception.network_response, url), box_api_exception)
429+
raise self._oauth_exception(box_api_exception.network_response, url) from box_api_exception
430+
430431
if not network_response.ok:
431432
raise BoxOAuthException(
432433
network_response.status_code,

boxsdk/auth/redis_managed_jwt_auth.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,4 @@ def _auth_with_jwt(self, sub, sub_type):
1414
"""
1515
Base class override. Returns the access token in a tuple to match the OAuth2 interface.
1616
"""
17-
return super(RedisManagedJWTAuth, self)._auth_with_jwt(sub, sub_type), None
17+
return super()._auth_with_jwt(sub, sub_type), None

boxsdk/auth/redis_managed_oauth2.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ def __init__(self, unique_id=uuid4(), redis_server=None, *args, **kwargs):
3030
self._unique_id = unique_id
3131
self._redis_server = redis_server or StrictRedis()
3232
refresh_lock = Lock(redis=self._redis_server, name='{0}_lock'.format(self._unique_id))
33-
super(RedisManagedOAuth2Mixin, self).__init__(*args, refresh_lock=refresh_lock, **kwargs)
33+
super().__init__(*args, refresh_lock=refresh_lock, **kwargs)
3434
if self._access_token is None:
3535
self._get_and_update_current_tokens()
3636

@@ -54,12 +54,11 @@ def _store_tokens(self, access_token, refresh_token):
5454
Base class override.
5555
Saves the refreshed tokens in redis.
5656
"""
57-
super(RedisManagedOAuth2Mixin, self)._store_tokens(access_token, refresh_token)
57+
super()._store_tokens(access_token, refresh_token)
5858
self._redis_server.hmset(self._unique_id, {'access': access_token, 'refresh': refresh_token})
5959

6060

6161
class RedisManagedOAuth2(RedisManagedOAuth2Mixin):
6262
"""
6363
OAuth2 subclass which uses Redis to manage tokens.
6464
"""
65-
pass

0 commit comments

Comments
 (0)