From ab0a674651a883c0c54853a07ae41c7a29b1953c Mon Sep 17 00:00:00 2001 From: edX requirements bot Date: Thu, 24 Dec 2020 08:14:14 -0500 Subject: [PATCH] Python code cleanup by the cleanup-python-code Jenkins job. This pull request was generated by the cleanup-python-code Jenkins job, which ran ``` modernize_travis;modernize_tox;make upgrade;find . -type f -name '*.py' | while read fname; do pyupgrade --exit-zero-even-if-changed --keep-percent-format --py3-plus --py36-plus --py38-plus "$fname"; done ``` The following packages were installed: `pyupgrade,git+https://github.com/edx/repo-tools.git@5ed136448729ac3bd962bdb5d8fda417dc63efaa` --- .travis.yml | 11 +++---- docs/conf.py | 15 +++++---- requirements/constraints.txt | 7 ++--- requirements/doc.txt | 21 ++++++------- requirements/pip_tools.txt | 3 +- requirements/test.txt | 59 ++++++++++++++++++------------------ requirements/tox.txt | 19 +++++------- requirements/travis.txt | 19 +++++------- setup.py | 4 +-- tests/test_user_util.py | 7 ++--- tox.ini | 26 ++++++++-------- user_util/__init__.py | 2 -- user_util/cli.py | 4 +-- user_util/user_util.py | 2 -- 14 files changed, 88 insertions(+), 111 deletions(-) mode change 100755 => 100644 docs/conf.py diff --git a/.travis.yml b/.travis.yml index 957f37f..67f663c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,13 +1,12 @@ language: python python: - - 3.5 - - 3.8 + - '3.8' install: -- pip install -r requirements/travis.txt + - pip install -r requirements/travis.txt script: -- tox + - tox after_success: -- codecov + - codecov deploy: provider: pypi distributions: sdist bdist_wheel @@ -16,4 +15,4 @@ deploy: secure: jIYzuroblLNT6jdpfhL4+U01fKGTzuXmO68aNuCH+0+Ijyma/wndnk7k1vcD/5CpPua7xw2c5irRhqEVIIKthkot48Jfk25vKPp9Mn89GYGH2lfJnrGTxUnILRU0XgFPSNpNBGQ3EnuH7PfAzjxMTiwxOk+snaAVcz2nyxP3/rHR6wOx7bNqZh79ImzD4UT5TefeZzPdB92MFj1nXGR22F7qoYfKJJsa/2RjqY6XdL+mMrK4u4ZopeBm89SAB8PTDAd+BF52dp0ZufoNwOQGcfkXHPeEV0JWlSvBB/aiB4NijmGmTVniGxWwV4i5HC44O7jhYTvAtrMJE5jjdJYUzOUpwJ4+OXvuaALJGMLc1uMXNvs+4cDZXF2iTg2Cf73cm5zvDMVJn0J7BwUPxOmonMBidpTZaiC2pEokyXXEU+99fL/IvKPtB3FJZIWpOGngWMfPOBRHwxOdwjOrEawUQ8VYIFYFRtEK541q60JDJs7Qfle69b5UpzgtxDDbLVTKNedia9uQ0yxC1VKMQslEmQrp7chG0cLw1sxM45D63P9BePItosnT0dMxY2n3DGo7z68Y4T8gpt+8ZFzfxtwgD4AUyENjwkdr3g791tsE70HJAi7GyexwX2EtMAkxhc6QBtLZq0LVnTG7E110Pcsf8zvI+qaSzZOjamFL261Tvfs= on: tags: true - python: 3.5 + python: 3.8 diff --git a/docs/conf.py b/docs/conf.py old mode 100755 new mode 100644 index eff68fc..7f02350 --- a/docs/conf.py +++ b/docs/conf.py @@ -1,5 +1,4 @@ #!/usr/bin/env python -# -*- coding: utf-8 -*- # # user_util documentation build configuration file, created by # sphinx-quickstart on Fri Jun 9 13:47:02 2017. @@ -47,9 +46,9 @@ master_doc = 'index' # General information about the project. -project = u'Open edX User Utilities' -copyright = u"2018, J Eskew" -author = u"J Eskew" +project = 'Open edX User Utilities' +copyright = "2018, J Eskew" +author = "J Eskew" # The version info for the project you're documenting, acts as replacement # for |version| and |release|, also used in various other places throughout @@ -129,8 +128,8 @@ # [howto, manual, or own class]). latex_documents = [ (master_doc, 'user_util.tex', - u'Open edX User Utilities Documentation', - u'J Eskew', 'manual'), + 'Open edX User Utilities Documentation', + 'J Eskew', 'manual'), ] @@ -140,7 +139,7 @@ # (source start file, name, description, authors, manual section). man_pages = [ (master_doc, 'user_util', - u'Open edX User Utilities Documentation', + 'Open edX User Utilities Documentation', [author], 1) ] @@ -152,7 +151,7 @@ # dir menu entry, description, category) texinfo_documents = [ (master_doc, 'user_util', - u'Open edX User Utilities Documentation', + 'Open edX User Utilities Documentation', author, 'user_util', 'One line description of project.', diff --git a/requirements/constraints.txt b/requirements/constraints.txt index bb6d02b..fdddfae 100644 --- a/requirements/constraints.txt +++ b/requirements/constraints.txt @@ -10,8 +10,5 @@ # TODO: Many pinned dependencies should be unpinned and/or moved to this constraints file. -# Use latest Django LTS version -Django<2.3.0 - -# mock version 4.0.0 drops support for python 3.5 -mock<4.0.0 +# This file contains all common constraints for edx-repos +-c https://raw.githubusercontent.com/edx/edx-lint/master/edx_lint/files/common_constraints.txt diff --git a/requirements/doc.txt b/requirements/doc.txt index 84daf27..4f95a4c 100644 --- a/requirements/doc.txt +++ b/requirements/doc.txt @@ -5,30 +5,29 @@ # make upgrade # alabaster==0.7.12 # via sphinx -babel==2.8.0 # via sphinx -certifi==2020.4.5.1 # via requests -chardet==3.0.4 # via requests +babel==2.9.0 # via sphinx +certifi==2020.12.5 # via requests +chardet==4.0.0 # via requests click==7.1.2 # via -r requirements/base.in docutils==0.16 # via sphinx -idna==2.9 # via requests +idna==2.10 # via requests imagesize==1.2.0 # via sphinx jinja2==2.11.2 # via sphinx markupsafe==1.1.1 # via jinja2 -packaging==20.3 # via sphinx -pygments==2.6.1 # via sphinx +packaging==20.8 # via sphinx +pygments==2.7.4 # via sphinx pyparsing==2.4.7 # via packaging -pytz==2020.1 # via babel -requests==2.23.0 # via sphinx -six==1.14.0 # via packaging +pytz==2020.5 # via babel +requests==2.25.1 # via sphinx snowballstemmer==2.0.0 # via sphinx -sphinx==3.0.3 # via -r requirements/doc.in +sphinx==3.4.3 # via -r requirements/doc.in sphinxcontrib-applehelp==1.0.2 # via sphinx sphinxcontrib-devhelp==1.0.2 # via sphinx sphinxcontrib-htmlhelp==1.0.3 # via sphinx sphinxcontrib-jsmath==1.0.1 # via sphinx sphinxcontrib-qthelp==1.0.3 # via sphinx sphinxcontrib-serializinghtml==1.1.4 # via sphinx -urllib3==1.25.9 # via requests +urllib3==1.26.2 # via requests # The following packages are considered to be unsafe in a requirements file: # setuptools diff --git a/requirements/pip_tools.txt b/requirements/pip_tools.txt index 937f1d6..a6f6c30 100644 --- a/requirements/pip_tools.txt +++ b/requirements/pip_tools.txt @@ -5,8 +5,7 @@ # make upgrade # click==7.1.2 # via pip-tools -pip-tools==5.1.2 # via -r requirements/pip_tools.in -six==1.14.0 # via pip-tools +pip-tools==5.5.0 # via -r requirements/pip_tools.in # The following packages are considered to be unsafe in a requirements file: # pip diff --git a/requirements/test.txt b/requirements/test.txt index 442ba7d..6a1bfe9 100644 --- a/requirements/test.txt +++ b/requirements/test.txt @@ -4,44 +4,43 @@ # # make upgrade # -attrs==19.3.0 # via pytest -bleach==3.1.5 # via readme-renderer -bumpversion==0.5.3 # via -r requirements/test.in -certifi==2020.4.5.1 # via requests -chardet==3.0.4 # via requests +attrs==20.3.0 # via pytest +bleach==3.2.1 # via readme-renderer +bump2version==1.0.1 # via bumpversion +bumpversion==0.6.0 # via -r requirements/test.in +certifi==2020.12.5 # via requests +chardet==4.0.0 # via requests click==7.1.2 # via -r requirements/base.txt -coverage==5.1 # via -r requirements/test.in +colorama==0.4.4 # via twine +coverage==5.3.1 # via -r requirements/test.in docutils==0.16 # via readme-renderer -entrypoints==0.3 # via flake8 -flake8==3.7.9 # via -r requirements/test.in -idna==2.9 # via requests -importlib-metadata==1.6.0 # via pluggy, pytest +flake8==3.8.4 # via -r requirements/test.in +idna==2.10 # via requests +iniconfig==1.1.1 # via pytest +keyring==21.8.0 # via twine mccabe==0.6.1 # via flake8 -more-itertools==8.2.0 # via pytest -packaging==20.3 # via bleach, pytest -pathlib2==2.3.5 # via pytest -pathtools==0.1.2 # via watchdog -pkginfo==1.5.0.1 # via twine +packaging==20.8 # via bleach, pytest +pkginfo==1.7.0 # via twine pluggy==0.13.1 # via pytest -py==1.8.1 # via pytest -pycodestyle==2.5.0 # via flake8 -pyflakes==2.1.1 # via flake8 -pygments==2.6.1 # via readme-renderer +py==1.10.0 # via pytest +pycodestyle==2.6.0 # via flake8 +pyflakes==2.2.0 # via flake8 +pygments==2.7.4 # via readme-renderer pyparsing==2.4.7 # via packaging pytest-runner==5.2 # via -r requirements/test.in -pytest==5.4.1 # via -r requirements/test.in -readme-renderer==26.0 # via twine +pytest==6.2.1 # via -r requirements/test.in +readme-renderer==28.0 # via twine requests-toolbelt==0.9.1 # via twine -requests==2.23.0 # via requests-toolbelt, twine -six==1.14.0 # via bleach, packaging, pathlib2, readme-renderer -tqdm==4.46.0 # via twine -twine==1.15.0 # via -r requirements/test.in -urllib3==1.25.9 # via requests -watchdog==0.10.2 # via -r requirements/test.in -wcwidth==0.1.9 # via pytest +requests==2.25.1 # via requests-toolbelt, twine +rfc3986==1.4.0 # via twine +six==1.15.0 # via bleach, readme-renderer +toml==0.10.2 # via pytest +tqdm==4.56.0 # via twine +twine==3.3.0 # via -r requirements/test.in +urllib3==1.26.2 # via requests +watchdog==1.0.2 # via -r requirements/test.in webencodings==0.5.1 # via bleach -wheel==0.34.2 # via -r requirements/test.in -zipp==1.2.0 # via importlib-metadata +wheel==0.36.2 # via -r requirements/test.in # The following packages are considered to be unsafe in a requirements file: # setuptools diff --git a/requirements/tox.txt b/requirements/tox.txt index 7d38c58..e265eff 100644 --- a/requirements/tox.txt +++ b/requirements/tox.txt @@ -4,17 +4,14 @@ # # make upgrade # -appdirs==1.4.3 # via virtualenv -distlib==0.3.0 # via virtualenv +appdirs==1.4.4 # via virtualenv +distlib==0.3.1 # via virtualenv filelock==3.0.12 # via tox, virtualenv -importlib-metadata==1.6.0 # via importlib-resources, pluggy, tox, virtualenv -importlib-resources==1.5.0 # via virtualenv -packaging==20.3 # via tox +packaging==20.8 # via tox pluggy==0.13.1 # via tox -py==1.8.1 # via tox +py==1.10.0 # via tox pyparsing==2.4.7 # via packaging -six==1.14.0 # via packaging, tox, virtualenv -toml==0.10.0 # via tox -tox==3.15.0 # via -r requirements/tox.in -virtualenv==20.0.20 # via tox -zipp==1.2.0 # via importlib-metadata, importlib-resources +six==1.15.0 # via tox, virtualenv +toml==0.10.2 # via tox +tox==3.21.2 # via -r requirements/tox.in +virtualenv==20.4.0 # via tox diff --git a/requirements/travis.txt b/requirements/travis.txt index dcc8eb7..a847d37 100644 --- a/requirements/travis.txt +++ b/requirements/travis.txt @@ -4,18 +4,15 @@ # # make upgrade # -appdirs==1.4.3 # via -r requirements/tox.txt, virtualenv -distlib==0.3.0 # via -r requirements/tox.txt, virtualenv +appdirs==1.4.4 # via -r requirements/tox.txt, virtualenv +distlib==0.3.1 # via -r requirements/tox.txt, virtualenv filelock==3.0.12 # via -r requirements/tox.txt, tox, virtualenv -importlib-metadata==1.6.0 # via -r requirements/tox.txt, importlib-resources, pluggy, tox, virtualenv -importlib-resources==1.5.0 # via -r requirements/tox.txt, virtualenv -packaging==20.3 # via -r requirements/tox.txt, tox +packaging==20.8 # via -r requirements/tox.txt, tox pluggy==0.13.1 # via -r requirements/tox.txt, tox -py==1.8.1 # via -r requirements/tox.txt, tox +py==1.10.0 # via -r requirements/tox.txt, tox pyparsing==2.4.7 # via -r requirements/tox.txt, packaging -six==1.14.0 # via -r requirements/tox.txt, packaging, tox, virtualenv -toml==0.10.0 # via -r requirements/tox.txt, tox +six==1.15.0 # via -r requirements/tox.txt, tox, virtualenv +toml==0.10.2 # via -r requirements/tox.txt, tox tox-travis==0.12 # via -r requirements/travis.in -tox==3.15.0 # via -r requirements/tox.txt, tox-travis -virtualenv==20.0.20 # via -r requirements/tox.txt, tox -zipp==1.2.0 # via -r requirements/tox.txt, importlib-metadata, importlib-resources +tox==3.21.2 # via -r requirements/tox.txt, tox-travis +virtualenv==20.4.0 # via -r requirements/tox.txt, tox diff --git a/setup.py b/setup.py index cb44dd0..2f10907 100644 --- a/setup.py +++ b/setup.py @@ -1,5 +1,4 @@ #!/usr/bin/env python -# -*- coding: utf-8 -*- """The setup script.""" @@ -48,7 +47,6 @@ def is_requirement(line): 'License :: OSI Approved :: GNU General Public License v3 (GPLv3)', 'Natural Language :: English', 'Programming Language :: Python :: 3', - 'Programming Language :: Python :: 3.5', 'Programming Language :: Python :: 3.8', ], description="User utilities for the Open edX platform", @@ -68,6 +66,6 @@ def is_requirement(line): test_suite='tests', tests_require=test_requirements, url='https://github.com/edx/user-util', - version='0.3.1', + version='1.0.0', zip_safe=False, ) diff --git a/tests/test_user_util.py b/tests/test_user_util.py index 66883d5..aee2b33 100644 --- a/tests/test_user_util.py +++ b/tests/test_user_util.py @@ -1,5 +1,4 @@ #!/usr/bin/env python -# -*- coding: utf-8 -*- """Tests for `user_util` package.""" @@ -100,7 +99,7 @@ def test_username_to_hash_is_normalized(salt_list): def test_unicode_username_to_hash(): - username = u'ÁĹéáŕńéŕŰśéŕŃáḿéẂíthŰńíćődé' + username = 'ÁĹéáŕńéŕŰśéŕŃáḿéẂíthŰńíćődé' retired_username = user_util.get_retired_username(username, VALID_SALT_LIST_ONE_SALT) assert retired_username != username # Since SHA1 is used, the hexadecimal digest length should be 40. @@ -168,7 +167,7 @@ def test_email_to_hash_is_normalized(salt_list): def test_unicode_email_to_hash(): - email = u'🅐.🅛🅔🅐🅡🅝🅔🅡r@example.com' + email = '🅐.🅛🅔🅐🅡🅝🅔🅡r@example.com' retired_email = user_util.get_retired_email(email, VALID_SALT_LIST_ONE_SALT) assert retired_email != email # Since SHA1 is used, the hexadecimal digest length should be 40. @@ -237,7 +236,7 @@ def test_external_key_to_hash(salt_list): def test_unicode_external_key_to_hash(): - unicode_external_key = u'🅐.🅛🅔🅐🅡🅝🅔🅡' + unicode_external_key = '🅐.🅛🅔🅐🅡🅝🅔🅡' retired_external_key= user_util.get_retired_external_key(unicode_external_key, VALID_SALT_LIST_ONE_SALT) assert retired_external_key != unicode_external_key # Since SHA1 is used, the hexadecimal digest length should be 40. diff --git a/tox.ini b/tox.ini index 9624cce..bfda85d 100644 --- a/tox.ini +++ b/tox.ini @@ -1,11 +1,10 @@ [tox] -envlist = py{35}-django{22},py{38}-django{22,30},quality +envlist = py38-django{22,30,31},quality [travis] -python = - 3.5: py35 - 3.8: py38 - quality: flake8 +python = + 3.8: py38 + quality: flake8 [testenv:quality] basepython = python @@ -13,11 +12,12 @@ deps = flake8 commands = flake8 user_util [testenv] -setenv = - PYTHONPATH = {toxinidir} -deps = - -r requirements/test.txt -commands = - pip install -U pip - python setup.py develop - py.test --basetemp={envtmpdir} +setenv = + PYTHONPATH = {toxinidir} +deps = + -r requirements/test.txt +commands = + pip install -U pip + python setup.py develop + py.test --basetemp={envtmpdir} + diff --git a/user_util/__init__.py b/user_util/__init__.py index 68e9b0b..a66eb19 100644 --- a/user_util/__init__.py +++ b/user_util/__init__.py @@ -1,5 +1,3 @@ -# -*- coding: utf-8 -*- - """Top-level package for Open edX User Utilities.""" __version__ = '0.3.1' diff --git a/user_util/cli.py b/user_util/cli.py index 43578cd..7412b4c 100644 --- a/user_util/cli.py +++ b/user_util/cli.py @@ -1,5 +1,3 @@ -# -*- coding: utf-8 -*- - """Console script for user_util.""" import json import sys @@ -28,7 +26,7 @@ def retire_user(username, email, salt): try: salt_list = json.loads(salt) except (TypeError, ValueError): - click.echo("Salt value \"{}\" is invalid JSON.".format(salt)) + click.echo(f"Salt value \"{salt}\" is invalid JSON.") raise results = {} for name in username: diff --git a/user_util/user_util.py b/user_util/user_util.py index f5d4361..c15a2ba 100644 --- a/user_util/user_util.py +++ b/user_util/user_util.py @@ -1,5 +1,3 @@ -# -*- coding: utf-8 -*- - """Main module.""" import hashlib