Skip to content

Commit

Permalink
Merge cdd91fc into 7627a57
Browse files Browse the repository at this point in the history
  • Loading branch information
M Zulqarnain authored Apr 29, 2020
2 parents 7627a57 + cdd91fc commit 14d7702
Show file tree
Hide file tree
Showing 19 changed files with 117 additions and 164 deletions.
24 changes: 7 additions & 17 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,29 +1,19 @@
language: python
python:
- "2.7"
- "3.5"
- "3.8"

env:
- TOXENV=django111
- TOXENV=django20
- TOXENV=django21
- TOXENV=django22
- TOXENV=quality
- TOXENV=without-django

matrix:
exclude:
- python: "2.7"
env: TOXENV=django20
- python: "2.7"
env: TOXENV=django21
- python: "2.7"
env: TOXENV=django22
include:
- python: "3.5"
env: TOXENV=quality
- python: "3.5"
env: TOXENV=without-django
allow_failures:
- python: 3.8

install:
- pip install pip==20.0.2
- make requirements
- pip install coveralls
script:
Expand All @@ -38,6 +28,6 @@ deploy:
on:
tags: true
python: "3.5"
condition: "$TOXENV = django111"
condition: "$TOXENV = django22"
distributions: sdist bdist_wheel
repo: edx/opaque-keys
4 changes: 2 additions & 2 deletions opaque_keys/edx/django/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
log = logging.getLogger(__name__)


class _Creator(object):
class _Creator:
"""
DO NOT REUSE THIS CLASS. Provided for backwards compatibility only!
Expand All @@ -42,7 +42,7 @@ def __set__(self, obj, value):


# pylint: disable=missing-docstring,unused-argument
class CreatorMixin(object):
class CreatorMixin:
"""
Mixin class to provide SubfieldBase functionality to django fields.
See: https://docs.djangoproject.com/en/1.11/releases/1.8/#subfieldbase
Expand Down
2 changes: 1 addition & 1 deletion opaque_keys/edx/django/tests/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
)


class Container(object):
class Container:
"""A simple wrapper class for string-like objects."""

def __init__(self, text):
Expand Down
2 changes: 1 addition & 1 deletion opaque_keys/edx/keys.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ def block_type(self): # pragma: no cover
raise NotImplementedError()


class CourseObjectMixin(object):
class CourseObjectMixin:
"""
An abstract :class:`opaque_keys.OpaqueKey` mixin
for keys that belong to courses.
Expand Down
2 changes: 1 addition & 1 deletion opaque_keys/edx/locations.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ def replace(self, **kwargs):
)


class LocationBase(object):
class LocationBase:
"""Deprecated. Base class for :class:`Location` and :class:`AssetLocation`"""

DEPRECATED_TAG = None # Subclasses should define what DEPRECATED_TAG is
Expand Down
10 changes: 5 additions & 5 deletions opaque_keys/edx/locator.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
import re
from uuid import UUID
import warnings
from abc import abstractproperty

from bson.errors import InvalidId
from bson.objectid import ObjectId
Expand All @@ -23,7 +22,7 @@
log = logging.getLogger(__name__)


class LocalId(object):
class LocalId:
"""
Class for local ids for non-persisted xblocks (which can have hardcoded block_ids if necessary)
"""
Expand All @@ -48,7 +47,7 @@ class Locator(OpaqueKey):
ALLOWED_ID_CHARS = r'[\w\-~.:]'
DEPRECATED_ALLOWED_ID_CHARS = r'[\w\-~.:%]'

@abstractproperty
@property
def version(self): # pragma: no cover
"""
Returns the ObjectId referencing this specific location.
Expand All @@ -72,7 +71,7 @@ def as_object_id(cls, value):
raise InvalidKeyError(cls, u'"%s" is not a valid version_guid' % value)


class CheckFieldMixin(object):
class CheckFieldMixin:
"""
Mixin that provides handy methods for checking field types/values.
"""
Expand Down Expand Up @@ -1220,14 +1219,15 @@ def _from_string(cls, serialized):

return cls(**{key: parse.get(key) for key in cls.KEY_FIELDS})

@property
def version(self):
"""
Returns the ObjectId referencing this specific location.
"""
return self.definition_id


class VersionTree(object):
class VersionTree:
"""
Holds trees of Locators to represent version histories.
"""
Expand Down
2 changes: 1 addition & 1 deletion opaque_keys/edx/tests/test_locators.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def test_description_locator_url(self):
def test_description_locator_version(self):
object_id = '{:024x}'.format(random.randrange(16 ** 24))
definition_locator = DefinitionLocator('html', object_id)
self.assertEqual(object_id, str(definition_locator.version()))
self.assertEqual(object_id, str(definition_locator.version))


@ddt.ddt
Expand Down
3 changes: 1 addition & 2 deletions opaque_keys/tests/strategies.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,12 @@
``hypothesis`` strategies for generating OpaqueKey objects.
"""

from functools import update_wrapper
from functools import singledispatch, update_wrapper
import string
from six import text_type

from hypothesis import strategies, assume
from hypothesis.strategies._internal.core import cacheable
from singledispatch import singledispatch

from opaque_keys.edx.block_types import BlockTypeKeyV1, XBLOCK_V1, XMODULE_V1
from opaque_keys.edx.asides import (
Expand Down
9 changes: 6 additions & 3 deletions requirements/constraints.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
# pin when possible. Writing an issue against the offending project and
# linking to it here is good.

# These packages are backports which can only be installed on Python 2.7
functools32 ; python_version == "2.7"
futures ; python_version == "2.7"
# pytest command fails if pytest > 5.3 is used
# Look into https://github.com/pytest-dev/pytest/issues/6925
pytest<=5.3

# version >= 0.16 requires pytest >= 5.4
pytest-pylint<0.16
64 changes: 28 additions & 36 deletions requirements/dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,90 +7,82 @@
alabaster==0.7.12 # via -r requirements/doc.txt, sphinx
apipkg==1.5 # via -r requirements/doc.txt, execnet
appdirs==1.4.3 # via -r requirements/travis.txt, virtualenv
astroid==1.6.6 # via -r requirements/doc.txt, pylint, pylint-celery
atomicwrites==1.3.0 # via -r requirements/doc.txt, pytest
astroid==2.3.3 # via -r requirements/doc.txt, pylint, pylint-celery
attrs==19.3.0 # via -r requirements/doc.txt, hypothesis, pytest
babel==2.8.0 # via -r requirements/doc.txt, sphinx
backports.functools-lru-cache==1.6.1 # via -r requirements/doc.txt, astroid, isort, pylint
bleach==3.1.4 # via -r requirements/doc.txt, readme-renderer
certifi==2020.4.5.1 # via -r requirements/doc.txt, -r requirements/travis.txt, requests, urllib3
cffi==1.14.0 # via -r requirements/travis.txt, cryptography
certifi==2020.4.5.1 # via -r requirements/doc.txt, -r requirements/travis.txt, requests
chardet==3.0.4 # via -r requirements/doc.txt, -r requirements/travis.txt, requests
click-log==0.3.2 # via -r requirements/doc.txt, edx-lint
click==7.1.1 # via -r requirements/doc.txt, -r requirements/pip-tools.txt, click-log, edx-lint, pip-tools
configparser==4.0.2 # via -r requirements/doc.txt, -r requirements/travis.txt, importlib-metadata, pylint
contextlib2==0.6.0.post1 # via -r requirements/doc.txt, -r requirements/travis.txt, importlib-metadata, importlib-resources, virtualenv, zipp
click==7.1.2 # via -r requirements/doc.txt, -r requirements/pip-tools.txt, click-log, edx-lint, pip-tools
coverage==5.1 # via -r requirements/doc.txt, -r requirements/travis.txt, coveralls, pytest-cov
coveralls==1.11.1 # via -r requirements/travis.txt
cryptography==2.9.2 # via -r requirements/travis.txt, pyopenssl, urllib3
coveralls==2.0.0 # via -r requirements/travis.txt
ddt==1.3.1 # via -r requirements/doc.txt
distlib==0.3.0 # via -r requirements/travis.txt, virtualenv
docopt==0.6.2 # via -r requirements/travis.txt, coveralls
docutils==0.16 # via -r requirements/doc.txt, readme-renderer, sphinx
edx-lint==1.4.1 # via -r requirements/doc.txt
edx-sphinx-theme==1.5.0 # via -r requirements/doc.txt
enum34==1.1.10 # via -r requirements/doc.txt, -r requirements/travis.txt, astroid, cryptography, hypothesis
execnet==1.7.1 # via -r requirements/doc.txt, pytest-cache, pytest-xdist
filelock==3.0.12 # via -r requirements/travis.txt, tox, virtualenv
funcsigs==1.0.2 # via -r requirements/doc.txt, mock, pytest
futures==3.3.0 ; python_version == "2.7" # via -c requirements/constraints.txt, -r requirements/doc.txt, isort
hypothesis==4.57.1 # via -r requirements/doc.txt
idna==2.9 # via -r requirements/doc.txt, -r requirements/travis.txt, requests, urllib3
hypothesis==5.10.4 # via -r requirements/doc.txt
idna==2.9 # via -r requirements/doc.txt, -r requirements/travis.txt, requests
imagesize==1.2.0 # via -r requirements/doc.txt, sphinx
importlib-metadata==1.6.0 # via -r requirements/doc.txt, -r requirements/travis.txt, importlib-resources, pluggy, pytest, tox, virtualenv
importlib-resources==1.4.0 # via -r requirements/travis.txt, virtualenv
ipaddress==1.0.23 # via -r requirements/travis.txt, cryptography, urllib3
importlib-resources==1.5.0 # via -r requirements/travis.txt, virtualenv
isort==4.3.21 # via -r requirements/doc.txt, pylint
jinja2==2.11.2 # via -r requirements/doc.txt, sphinx
lazy-object-proxy==1.4.3 # via -r requirements/doc.txt, astroid
markupsafe==1.1.1 # via -r requirements/doc.txt, jinja2
mccabe==0.6.1 # via -r requirements/doc.txt, pylint
mock==3.0.5 # via -r requirements/doc.txt
more-itertools==5.0.0 # via -r requirements/doc.txt, pytest
more-itertools==8.2.0 # via -r requirements/doc.txt, pytest
packaging==20.3 # via -r requirements/doc.txt, -r requirements/travis.txt, pytest, sphinx, tox
pathlib2==2.3.5 # via -r requirements/doc.txt, -r requirements/travis.txt, importlib-metadata, importlib-resources, pytest, virtualenv
pathlib2==2.3.5 # via -r requirements/doc.txt, pytest
pbr==5.4.5 # via -r requirements/doc.txt, stevedore
pep8==1.7.1 # via -r requirements/doc.txt, pytest-pep8
pip-tools==5.0.0 # via -r requirements/pip-tools.txt
pip-tools==5.1.0 # via -r requirements/pip-tools.txt
pluggy==0.13.1 # via -r requirements/doc.txt, -r requirements/travis.txt, pytest, tox
py==1.8.1 # via -r requirements/doc.txt, -r requirements/travis.txt, pytest, tox
pycodestyle==2.5.0 # via -r requirements/doc.txt
pycparser==2.20 # via -r requirements/travis.txt, cffi
pygments==2.5.2 # via -r requirements/doc.txt, readme-renderer, sphinx
pygments==2.6.1 # via -r requirements/doc.txt, readme-renderer, sphinx
pylint-celery==0.3 # via -r requirements/doc.txt, edx-lint
pylint-django==0.11.1 # via -r requirements/doc.txt, edx-lint
pylint-django==2.0.11 # via -r requirements/doc.txt, edx-lint
pylint-plugin-utils==0.6 # via -r requirements/doc.txt, pylint-celery, pylint-django
pylint==1.9.5 # via -r requirements/doc.txt, edx-lint, pylint-celery, pylint-django, pylint-plugin-utils, pytest-pylint
pylint==2.4.2 # via -r requirements/doc.txt, edx-lint, pylint-celery, pylint-django, pylint-plugin-utils, pytest-pylint
pymongo==3.10.1 # via -r requirements/doc.txt
pyopenssl==19.1.0 # via -r requirements/travis.txt, urllib3
pyparsing==2.4.7 # via -r requirements/doc.txt, -r requirements/travis.txt, packaging
pytest-cache==1.0 # via -r requirements/doc.txt, pytest-pep8
pytest-cov==2.8.1 # via -r requirements/doc.txt
pytest-forked==1.1.3 # via -r requirements/doc.txt, pytest-xdist
pytest-pep8==1.0.6 # via -r requirements/doc.txt
pytest-pylint==0.14.1 # via -r requirements/doc.txt
pytest-pylint==0.15.1 # via -c requirements/constraints.txt, -r requirements/doc.txt
pytest-xdist==1.31.0 # via -r requirements/doc.txt
pytest==4.6.9 # via -r requirements/doc.txt, pytest-cache, pytest-cov, pytest-forked, pytest-pep8, pytest-pylint, pytest-xdist
pytz==2019.3 # via -r requirements/doc.txt, babel
pytest==5.3.0 # via -c requirements/constraints.txt, -r requirements/doc.txt, pytest-cache, pytest-cov, pytest-forked, pytest-pep8, pytest-pylint, pytest-xdist
pytz==2020.1 # via -r requirements/doc.txt, babel
readme-renderer==26.0 # via -r requirements/doc.txt
requests==2.23.0 # via -r requirements/doc.txt, -r requirements/travis.txt, coveralls, sphinx
scandir==1.10.0 # via -r requirements/doc.txt, -r requirements/travis.txt, pathlib2
singledispatch==3.4.0.3 # via -r requirements/doc.txt, -r requirements/travis.txt, astroid, importlib-resources, pylint
six==1.14.0 # via -r requirements/doc.txt, -r requirements/pip-tools.txt, -r requirements/travis.txt, astroid, bleach, cryptography, edx-lint, edx-sphinx-theme, mock, more-itertools, packaging, pathlib2, pip-tools, pylint, pyopenssl, pytest, pytest-pylint, pytest-xdist, readme-renderer, singledispatch, sphinx, stevedore, tox, virtualenv
singledispatch==3.4.0.3 # via -r requirements/doc.txt
six==1.14.0 # via -r requirements/doc.txt, -r requirements/pip-tools.txt, -r requirements/travis.txt, astroid, bleach, edx-lint, edx-sphinx-theme, mock, packaging, pathlib2, pip-tools, pytest-xdist, readme-renderer, singledispatch, stevedore, tox, virtualenv
snowballstemmer==2.0.0 # via -r requirements/doc.txt, sphinx
sortedcontainers==2.1.0 # via -r requirements/doc.txt, hypothesis
sphinx==1.8.5 # via -r requirements/doc.txt, edx-sphinx-theme
sphinxcontrib-websupport==1.1.2 # via -r requirements/doc.txt, sphinx
sphinx==3.0.3 # via -r requirements/doc.txt, edx-sphinx-theme
sphinxcontrib-applehelp==1.0.2 # via -r requirements/doc.txt, sphinx
sphinxcontrib-devhelp==1.0.2 # via -r requirements/doc.txt, sphinx
sphinxcontrib-htmlhelp==1.0.3 # via -r requirements/doc.txt, sphinx
sphinxcontrib-jsmath==1.0.1 # via -r requirements/doc.txt, sphinx
sphinxcontrib-qthelp==1.0.3 # via -r requirements/doc.txt, sphinx
sphinxcontrib-serializinghtml==1.1.4 # via -r requirements/doc.txt, sphinx
stevedore==1.32.0 # via -r requirements/doc.txt
toml==0.10.0 # via -r requirements/travis.txt, tox
tox-battery==0.5.2 # via -r requirements/travis.txt
tox==3.14.6 # via -r requirements/travis.txt, tox-battery
typing==3.7.4.1 # via -r requirements/doc.txt, -r requirements/travis.txt, importlib-resources, sphinx
urllib3[secure]==1.25.9 # via -r requirements/doc.txt, -r requirements/travis.txt, coveralls, requests
typed-ast==1.4.1 # via -r requirements/doc.txt, astroid
urllib3==1.25.9 # via -r requirements/doc.txt, -r requirements/travis.txt, requests
virtualenv==20.0.18 # via -r requirements/travis.txt, tox
wcwidth==0.1.9 # via -r requirements/doc.txt, pytest
webencodings==0.5.1 # via -r requirements/doc.txt, bleach
wrapt==1.12.1 # via -r requirements/doc.txt, astroid
wrapt==1.11.2 # via -r requirements/doc.txt, astroid
zipp==1.2.0 # via -r requirements/doc.txt, -r requirements/travis.txt, importlib-metadata, importlib-resources

# The following packages are considered to be unsafe in a requirements file:
Expand Down
36 changes: 15 additions & 21 deletions requirements/django-test.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,55 +5,49 @@
# make upgrade
#
apipkg==1.5 # via -r requirements/test.txt, execnet
astroid==1.6.6 # via -r requirements/test.txt, pylint, pylint-celery
atomicwrites==1.3.0 # via -r requirements/test.txt, pytest
astroid==2.3.3 # via -r requirements/test.txt, pylint, pylint-celery
attrs==19.3.0 # via -r requirements/test.txt, hypothesis, pytest
backports.functools-lru-cache==1.6.1 # via -r requirements/test.txt, astroid, isort, pylint
click-log==0.3.2 # via -r requirements/test.txt, edx-lint
click==7.1.1 # via -r requirements/test.txt, click-log, edx-lint
configparser==4.0.2 # via -r requirements/test.txt, importlib-metadata, pylint
contextlib2==0.6.0.post1 # via -r requirements/test.txt, importlib-metadata, zipp
click==7.1.2 # via -r requirements/test.txt, click-log, edx-lint
coverage==5.1 # via -r requirements/test.txt, pytest-cov
ddt==1.3.1 # via -r requirements/test.txt
edx-lint==1.4.1 # via -r requirements/test.txt
enum34==1.1.10 # via -r requirements/test.txt, astroid, hypothesis
execnet==1.7.1 # via -r requirements/test.txt, pytest-cache, pytest-xdist
funcsigs==1.0.2 # via -r requirements/test.txt, mock, pytest
futures==3.3.0 ; python_version == "2.7" # via -c requirements/constraints.txt, -r requirements/test.txt, isort
hypothesis==4.57.1 # via -r requirements/test.txt
hypothesis==5.10.4 # via -r requirements/test.txt
importlib-metadata==1.6.0 # via -r requirements/test.txt, pluggy, pytest
isort==4.3.21 # via -r requirements/test.txt, pylint
lazy-object-proxy==1.4.3 # via -r requirements/test.txt, astroid
mccabe==0.6.1 # via -r requirements/test.txt, pylint
mock==3.0.5 # via -r requirements/test.txt
more-itertools==5.0.0 # via -r requirements/test.txt, pytest
more-itertools==8.2.0 # via -r requirements/test.txt, pytest
packaging==20.3 # via -r requirements/test.txt, pytest
pathlib2==2.3.5 # via -r requirements/test.txt, importlib-metadata, pytest, pytest-django
pathlib2==2.3.5 # via -r requirements/test.txt, pytest
pbr==5.4.5 # via -r requirements/test.txt, stevedore
pep8==1.7.1 # via -r requirements/test.txt, pytest-pep8
pluggy==0.13.1 # via -r requirements/test.txt, pytest
py==1.8.1 # via -r requirements/test.txt, pytest
pycodestyle==2.5.0 # via -r requirements/test.txt
pylint-celery==0.3 # via -r requirements/test.txt, edx-lint
pylint-django==0.11.1 # via -r requirements/test.txt, edx-lint
pylint-django==2.0.11 # via -r requirements/test.txt, edx-lint
pylint-plugin-utils==0.6 # via -r requirements/test.txt, pylint-celery, pylint-django
pylint==1.9.5 # via -r requirements/test.txt, edx-lint, pylint-celery, pylint-django, pylint-plugin-utils, pytest-pylint
pylint==2.4.2 # via -r requirements/test.txt, edx-lint, pylint-celery, pylint-django, pylint-plugin-utils, pytest-pylint
pymongo==3.10.1 # via -r requirements/test.txt
pyparsing==2.4.7 # via -r requirements/test.txt, packaging
pytest-cache==1.0 # via -r requirements/test.txt, pytest-pep8
pytest-cov==2.8.1 # via -r requirements/test.txt
pytest-django==3.9.0 # via -r requirements/django-test.in
pytest-forked==1.1.3 # via -r requirements/test.txt, pytest-xdist
pytest-pep8==1.0.6 # via -r requirements/test.txt
pytest-pylint==0.14.1 # via -r requirements/test.txt
pytest-pylint==0.15.1 # via -c requirements/constraints.txt, -r requirements/test.txt
pytest-xdist==1.31.0 # via -r requirements/test.txt
pytest==4.6.9 # via -r requirements/test.txt, pytest-cache, pytest-cov, pytest-django, pytest-forked, pytest-pep8, pytest-pylint, pytest-xdist
pytz==2019.3 # via -r requirements/django.txt, django
scandir==1.10.0 # via -r requirements/test.txt, pathlib2
singledispatch==3.4.0.3 # via -r requirements/test.txt, astroid, pylint
six==1.14.0 # via -r requirements/test.txt, astroid, edx-lint, mock, more-itertools, packaging, pathlib2, pylint, pytest, pytest-pylint, pytest-xdist, singledispatch, stevedore
pytest==5.3.0 # via -c requirements/constraints.txt, -r requirements/test.txt, pytest-cache, pytest-cov, pytest-django, pytest-forked, pytest-pep8, pytest-pylint, pytest-xdist
pytz==2020.1 # via -r requirements/django.txt, django
singledispatch==3.4.0.3 # via -r requirements/test.txt
six==1.14.0 # via -r requirements/test.txt, astroid, edx-lint, mock, packaging, pathlib2, pytest-xdist, singledispatch, stevedore
sortedcontainers==2.1.0 # via -r requirements/test.txt, hypothesis
sqlparse==0.3.1 # via -r requirements/django.txt, django
stevedore==1.32.0 # via -r requirements/test.txt
typed-ast==1.4.1 # via -r requirements/test.txt, astroid
wcwidth==0.1.9 # via -r requirements/test.txt, pytest
wrapt==1.12.1 # via -r requirements/test.txt, astroid
wrapt==1.11.2 # via -r requirements/test.txt, astroid
zipp==1.2.0 # via -r requirements/test.txt, importlib-metadata
2 changes: 1 addition & 1 deletion requirements/django.in
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@
-c base.txt


Django>=1.11
Django>=2.2,<3.0
5 changes: 3 additions & 2 deletions requirements/django.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@
#
# make upgrade
#
django==1.11.29 # via -r requirements/django.in
pytz==2019.3 # via django
django==2.2.12 # via -r requirements/django.in
pytz==2020.1 # via django
sqlparse==0.3.1 # via django
Loading

0 comments on commit 14d7702

Please sign in to comment.