Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 2 additions & 6 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,22 +10,18 @@ before_cache:

matrix:
include:
- python: 2.6
env: TOX_ENV=py26
- python: 2.7
env: TOX_ENV=py27
- python: 3.3
env: TOX_ENV=py33
- python: 3.4
env: TOX_ENV=py34
- python: 3.5
env: TOX_ENV=py35
- python: 3.6
env: TOX_ENV=py36
- python: pypy
env: TOX_ENV=pypy PYPY_VERSION='2.7-5.8.0'
env: TOX_ENV=pypy PYPY_VERSION='2.7-5.10.0'
- python: 2.7
env: TOX_ENV=pep8
env: TOX_ENV=pycodestyle
- python: 2.7
env: TOX_ENV=pylint
- python: 2.7
Expand Down
2 changes: 2 additions & 0 deletions HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ Release History

**Breaking Changes**

- Python 2.6 is no longer supported.
- Python 3.3 is no longer supported.
- ``Events.get_events(...)`` now returns a list of ``Event`` instances rather than a list of ``dict``
representing events. ``Event`` inherits from ``Mapping`` but will not have all the same capabilities as
``dict``.
Expand Down
1 change: 1 addition & 0 deletions boxsdk/auth/cooperatively_managed_oauth2.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ def __init__(self, retrieve_tokens=None, *args, **kwargs):
:type retrieve_tokens:
`callable` of () => (`unicode`, `unicode`)
"""
# pylint:disable=keyword-arg-before-vararg
self._retrieve_tokens = retrieve_tokens
super(CooperativelyManagedOAuth2Mixin, self).__init__(*args, **kwargs)

Expand Down
4 changes: 3 additions & 1 deletion boxsdk/auth/oauth2.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@
import sys

import six
from six.moves.urllib.parse import urlencode, urlunsplit # pylint:disable=import-error,no-name-in-module
# pylint:disable=import-error,no-name-in-module,relative-import
from six.moves.urllib.parse import urlencode, urlunsplit
# pylint:enable=import-error,no-name-in-module,relative-import

from boxsdk.config import API
from boxsdk.exception import BoxOAuthException
Expand Down
20 changes: 11 additions & 9 deletions boxsdk/auth/redis_managed_oauth2.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,19 @@ class RedisManagedOAuth2Mixin(OAuth2):
"""
Box SDK OAuth2 subclass.
Allows for storing auth tokens in redis.

:param unique_id:
An identifier for this auth object. Auth instances which wish to share tokens must use the same ID.
:type unique_id:
`unicode`
:param redis_server:
An instance of a Redis server, configured to talk to Redis.
:type redis_server:
:class:`Redis`
"""
def __init__(self, unique_id=uuid4(), redis_server=None, *args, **kwargs):
"""
:param unique_id:
An identifier for this auth object. Auth instances which wish to share tokens must use the same ID.
:type unique_id:
`unicode`
:param redis_server:
An instance of a Redis server, configured to talk to Redis.
:type redis_server:
:class:`Redis`
"""
# pylint:disable=keyword-arg-before-vararg
self._unique_id = unique_id
self._redis_server = redis_server or StrictRedis()
refresh_lock = Lock(redis=self._redis_server, name='{0}_lock'.format(self._unique_id))
Expand Down
1 change: 1 addition & 0 deletions boxsdk/auth/remote_managed_oauth2.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ def __init__(self, retrieve_access_token=None, *args, **kwargs):
:type retrieve_access_token:
`callable` of `unicode` => `unicode`
"""
# pylint:disable=keyword-arg-before-vararg
self._retrieve_access_token = retrieve_access_token
super(RemoteOAuth2Mixin, self).__init__(*args, **kwargs)

Expand Down
1 change: 1 addition & 0 deletions boxsdk/network/default_network.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ def request(self, method, url, access_token, **kwargs):
"""Base class override.
Make a network request using a requests.Session.
"""
# pylint:disable=abstract-class-instantiated
return self.network_response_constructor(
request_response=self._session.request(method, url, **kwargs),
access_token_used=access_token,
Expand Down
2 changes: 1 addition & 1 deletion boxsdk/object/file.py
Original file line number Diff line number Diff line change
Expand Up @@ -278,4 +278,4 @@ def get_shared_link_download_url(
allow_preview=allow_preview,
password=password,
)
return item.shared_link['download_url']
return item.shared_link['download_url'] # pylint:disable=no-member
8 changes: 8 additions & 0 deletions docs/source/boxsdk.object.rst
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,14 @@ boxsdk.object.metadata module
:undoc-members:
:show-inheritance:

boxsdk.object.recent_item module
--------------------------------

.. automodule:: boxsdk.object.recent_item
:members:
:undoc-members:
:show-inheritance:

boxsdk.object.search module
---------------------------

Expand Down
1 change: 1 addition & 0 deletions docs/source/boxsdk.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ Subpackages
boxsdk.client
boxsdk.network
boxsdk.object
boxsdk.pagination
boxsdk.session
boxsdk.util

Expand Down
5 changes: 2 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,7 @@
'Intended Audience :: Developers',
'License :: OSI Approved :: Apache Software License',
'Programming Language :: Python',
'Programming Language :: Python :: 2.6',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3.3',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
Expand Down Expand Up @@ -87,7 +85,8 @@ def main():
'bottle',
'jsonpatch',
'mock>=2.0.0',
'pep8', 'pylint',
'pycodestyle',
'pylint',
'sqlalchemy',
'tox',
'pytest-cov',
Expand Down
2 changes: 1 addition & 1 deletion test/functional/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import pytest
import requests
import six
from six.moves.urllib import parse # pylint:disable=import-error, no-name-in-module,wrong-import-order
from six.moves.urllib import parse # pylint:disable=import-error, no-name-in-module,wrong-import-order,relative-import

from boxsdk.auth.oauth2 import OAuth2
from boxsdk.config import API
Expand Down
5 changes: 4 additions & 1 deletion test/unit/auth/test_oauth2.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@
from mock import Mock, patch
import pytest
from six.moves import range # pylint:disable=redefined-builtin
from six.moves.urllib import parse as urlparse # pylint:disable=import-error,no-name-in-module,wrong-import-order
# pylint:disable=import-error,no-name-in-module,wrong-import-order,relative-import
from six.moves.urllib import parse as urlparse
# pylint:enable=import-error,no-name-in-module,wrong-import-order,relative-import

from boxsdk.exception import BoxOAuthException
from boxsdk.network.default_network import DefaultNetworkResponse
Expand Down Expand Up @@ -204,6 +206,7 @@ def token_method(request):
return partial(OAuth2.refresh, access_token_to_refresh='fake_access_token')
elif request.param == OAuth2.authenticate:
return partial(OAuth2.authenticate, auth_code='fake_code')
return None


@pytest.mark.parametrize(
Expand Down
3 changes: 1 addition & 2 deletions test/unit/object/test_item.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@
def test_item_and_response(test_file, test_folder, mock_file_response, mock_folder_response, request):
if request.param == 'file':
return test_file, mock_file_response
elif request.param == 'folder':
return test_folder, mock_folder_response
return test_folder, mock_folder_response


def test_update_info(test_item_and_response, mock_box_session, etag, if_match_header):
Expand Down
5 changes: 3 additions & 2 deletions test/unit/util/test_api_call_decorator.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@

from __future__ import absolute_import, unicode_literals

from boxsdk.object.cloneable import Cloneable
from boxsdk.util.api_call_decorator import api_call
from mock import NonCallableMock
import pytest

from boxsdk.object.cloneable import Cloneable
from boxsdk.util.api_call_decorator import api_call


@pytest.fixture
def api_call_result():
Expand Down
12 changes: 5 additions & 7 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,12 @@

[tox]
envlist =
py26,
py27,
py33,
py34,
py35,
py36,
pypy,
pep8,
pycodestyle,
pylint,
rst,
docs,
Expand All @@ -32,12 +30,12 @@ commands =
rst2html.py --strict HISTORY.rst
rst2html.py --strict CONTRIBUTING.rst

[testenv:pep8]
[testenv:pycodestyle]
commands =
pep8 --ignore=E501,W292 boxsdk setup.py
pep8 --ignore=E501,W292 test
pycodestyle --ignore=E501,W292 boxsdk setup.py
pycodestyle --ignore=E501,W292 test
deps =
pep8
pycodestyle

[testenv:pylint]
commands =
Expand Down