Skip to content

Commit

Permalink
BOM-2130
Browse files Browse the repository at this point in the history
Upgrading drf version.

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`
  • Loading branch information
awais786 committed Jan 19, 2021
1 parent 179f947 commit 956611e
Show file tree
Hide file tree
Showing 30 changed files with 174 additions and 202 deletions.
19 changes: 8 additions & 11 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,20 @@ language: python
dist: latest

python:
- 3.5
- 3.8

- '3.8'
env:
- TOXENV=django22-drf311
- TOXENV=django22-drf312
- TOXENV=django22-drflatest
- TOXENV=quality
- TOXENV=docs

- TOXENV=django22-drf312
- TOXENV=django22-drflatest
- TOXENV=django30-drf312
install:
- pip install -r requirements/travis.txt
script:
- tox
after_success:
after_success:
- codecov

# Set password via "travis encrypt --add deploy.password"; for details, see
# https://docs.travis-ci.com/user/deployment/pypi
deploy:
Expand All @@ -30,5 +27,5 @@ deploy:
secure: BlYK3lplRoPiNfzqslxyReJZrC1QUT9Ls1A1xIxc3IHxKl9WEkqC2xO5vBvQDFKtMyooq8bGeN/gfksaZpRYqBmrO7hPITiz0FH0wPFdjoIikI4NTqKVxjhqUho0ZWmpxNXrX/iMd9Y2R4uZRXZGaWaTSRHfF9fPVlkbo66s7vw=
on:
tags: true
python: 3.5
condition: "$TOXENV = django22-drflatest"
python: 3.8
condition: $TOXENV = django22-drflatest
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ clean: ## Remove generated byte code, coverage reports, and build artifacts
rm -fr dist/
rm -fr *.egg-info

docs: ## generate Sphinx HTML documentation
docs: ## generate Sphinx HTML documentation
python setup.py build_sphinx

dev_requirements: ## Install Dev Requirements
Expand Down Expand Up @@ -64,7 +64,7 @@ diff_cover: test ## Generate diff coverage report

test_quality: ## Run Quality checks
pylint submissions
isort --check-only --recursive submissions manage.py setup.py settings.py
isort --check-only submissions manage.py setup.py settings.py
pycodestyle . --config=pycodestyle

##################
Expand Down
18 changes: 8 additions & 10 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
#
# edx-submissions documentation build configuration file, created by
# sphinx-quickstart on Fri Jun 6 06:18:54 2014.
Expand All @@ -12,7 +11,6 @@
# All configuration values have a default; values that are commented out
# serve to show the default.

from __future__ import absolute_import

import os
import sys
Expand Down Expand Up @@ -49,8 +47,8 @@
master_doc = 'index'

# General information about the project.
project = u'edx-submissions'
copyright = u'2014, edX'
project = 'edx-submissions'
copyright = '2014, edX'

# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
Expand Down Expand Up @@ -202,8 +200,8 @@
# (source start file, target name, title,
# author, documentclass [howto, manual, or own class]).
latex_documents = [
('index', 'edx-submissions.tex', u'edx-submissions Documentation',
u'edX', 'manual'),
('index', 'edx-submissions.tex', 'edx-submissions Documentation',
'edX', 'manual'),
]

# The name of an image file (relative to this directory) to place at the top of
Expand Down Expand Up @@ -232,8 +230,8 @@
# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [
('index', 'edx-submissions', u'edx-submissions Documentation',
[u'edX'], 1)
('index', 'edx-submissions', 'edx-submissions Documentation',
['edX'], 1)
]

# If true, show URL addresses after external links.
Expand All @@ -246,8 +244,8 @@
# (source start file, target name, title, author,
# dir menu entry, description, category)
texinfo_documents = [
('index', 'edx-submissions', u'edx-submissions Documentation',
u'edX', 'edx-submissions', 'One line description of project.',
('index', 'edx-submissions', 'edx-submissions Documentation',
'edX', 'edx-submissions', 'One line description of project.',
'Miscellaneous'),
]

Expand Down
1 change: 0 additions & 1 deletion manage.py
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#!/usr/bin/env python
from __future__ import absolute_import

import os
import sys
Expand Down
2 changes: 1 addition & 1 deletion requirements/base.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ django-model-utils==4.1.0 # via -r requirements/base.in
django==2.2.17 # via -c requirements/constraints.txt, -r requirements/base.in, django-model-utils, djangorestframework, jsonfield2
djangorestframework==3.12.2 # via -r requirements/base.in
jsonfield2==3.0.3 # via -c requirements/constraints.txt, -r requirements/base.in
pytz==2020.4 # via -r requirements/base.in, django
pytz==2020.5 # via -r requirements/base.in, django
sqlparse==0.4.1 # via django
4 changes: 2 additions & 2 deletions requirements/constraints.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
# pin when possible. Writing an issue against the offending project and
# linking to it here is good.

# Stay on an LTS release
Django<2.3
# This file contains all common constraints for edx-repos
-c https://raw.githubusercontent.com/edx/edx-lint/master/edx_lint/files/common_constraints.txt

#jsonfield2 version 3.1.0 drops support for python3.5
jsonfield2==3.0.3
Expand Down
7 changes: 4 additions & 3 deletions requirements/pip-tools.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@
#
# make upgrade
#
click==7.1.2 # via pip-tools
pip-tools==5.4.0 # via -r requirements/pip-tools.in
six==1.15.0 # via pip-tools
click==7.1.2
# 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
1 change: 0 additions & 1 deletion settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
Settings for the submissions app.
"""

from __future__ import absolute_import

import warnings

Expand Down
1 change: 0 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#!/usr/bin/env python
from __future__ import absolute_import, print_function

import os
import sys
Expand Down
11 changes: 5 additions & 6 deletions submissions/admin.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
""" Submissions Admin Views. """
from __future__ import absolute_import

from django.contrib import admin
from django.urls import reverse
Expand All @@ -8,7 +7,7 @@
from submissions.models import Score, ScoreSummary, StudentItem, Submission, TeamSubmission


class StudentItemAdminMixin(object): # pylint: disable=useless-object-inheritance
class StudentItemAdminMixin:
"""Mix this class into anything that has a student_item fkey."""
search_fields = (
'student_item__course_id',
Expand All @@ -35,7 +34,7 @@ def student_item_id(self, obj):
'admin:submissions_studentitem_change',
args=[obj.student_item.id]
)
return format_html(u'<a href="{}">{}</a>'.format(url, obj.student_item.id))
return format_html(f'<a href="{url}">{obj.student_item.id}</a>')

student_item_id.admin_order_field = 'student_item__id'
student_item_id.short_description = 'S.I. ID'
Expand Down Expand Up @@ -114,7 +113,7 @@ class ScoreAdmin(admin.ModelAdmin, StudentItemAdminMixin):
search_fields = ('id', ) + StudentItemAdminMixin.search_fields

def points(self, score):
return u"{}/{}".format(score.points_earned, score.points_possible)
return f"{score.points_earned}/{score.points_possible}"


class ScoreSummaryAdmin(admin.ModelAdmin, StudentItemAdminMixin):
Expand All @@ -134,15 +133,15 @@ def highest_link(self, score_summary):
url = reverse(
'admin:submissions_score_change', args=[score_summary.highest.id]
)
return format_html(u'<a href="{}">{}</a>'.format(url, score_summary.highest))
return format_html(f'<a href="{url}">{score_summary.highest}</a>')

highest_link.short_description = 'Highest'

def latest_link(self, score_summary):
url = reverse(
'admin:submissions_score_change', args=[score_summary.latest.id]
)
return format_html(u'<a href="{}">{}</a>'.format(url, score_summary.latest))
return format_html(f'<a href="{url}">{score_summary.latest}</a>')

latest_link.short_description = 'Latest'

Expand Down
Loading

0 comments on commit 956611e

Please sign in to comment.