From ad45147f87345ea78f546c47ef1f658ecdc17de4 Mon Sep 17 00:00:00 2001 From: Hameed Gifford Date: Sat, 18 Jan 2020 13:24:21 -0500 Subject: [PATCH 01/23] Test python 3.8 and Django 3.0 Aligns the doc specs to match tested versions --- .circleci/config.yml | 116 +++++++++++++++--- README.md | 5 +- pinax/notifications/conf.py | 2 - pinax/notifications/engine.py | 2 +- pinax/notifications/lockfile.py | 2 - .../notifications/migrations/0001_initial.py | 2 - .../migrations/0002_auto_20171003_2006.py | 2 - pinax/notifications/models.py | 6 +- pinax/notifications/tests/test_models.py | 2 +- setup.py | 14 ++- tox.ini | 13 +- 11 files changed, 122 insertions(+), 44 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 68359996..09e3efd4 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -38,36 +38,36 @@ jobs: environment: - TOXENV=checkqa - UPLOAD_COVERAGE=0 - py27dj111: + py35dj111: <<: *common docker: - - image: circleci/python:2.7 + - image: circleci/python:3.5 environment: - TOXENV=py27-dj111 - py34dj111: + TOXENV=py35-dj111 + py35dj20: <<: *common docker: - - image: circleci/python:3.4 + - image: circleci/python:3.5 environment: - TOXENV=py34-dj111 - py34dj20: + TOXENV=py35-dj20 + py35dj21: <<: *common docker: - - image: circleci/python:3.4 + - image: circleci/python:3.5 environment: - TOXENV=py34-dj20 - py35dj111: + TOXENV=py35-dj21 + py35dj22: <<: *common docker: - image: circleci/python:3.5 environment: - TOXENV=py35-dj111 - py35dj20: + TOXENV=py35-dj22 + py35dj30: <<: *common docker: - image: circleci/python:3.5 environment: - TOXENV=py35-dj20 + TOXENV=py35-dj30 py36dj111: <<: *common docker: @@ -80,16 +80,100 @@ jobs: - image: circleci/python:3.6 environment: TOXENV=py36-dj20 + py36dj21: + <<: *common + docker: + - image: circleci/python:3.6 + environment: + TOXENV=py36-dj21 + py36dj22: + <<: *common + docker: + - image: circleci/python:3.6 + environment: + TOXENV=py36-dj22 + py36dj30: + <<: *common + docker: + - image: circleci/python:3.6 + environment: + TOXENV=py36-dj30 + py37dj111: + <<: *common + docker: + - image: circleci/python:3.7 + environment: + TOXENV=py37-dj111 + py37dj20: + <<: *common + docker: + - image: circleci/python:3.7 + environment: + TOXENV=py37-dj20 + py37dj21: + <<: *common + docker: + - image: circleci/python:3.7 + environment: + TOXENV=py37-dj21 + py37dj22: + <<: *common + docker: + - image: circleci/python:3.7 + environment: + TOXENV=py37-dj22 + py37dj30: + <<: *common + docker: + - image: circleci/python:3.7 + environment: + TOXENV=py37-dj30 + py38dj20: + <<: *common + docker: + - image: circleci/python:3.8 + environment: + TOXENV=py38-dj20 + py38dj21: + <<: *common + docker: + - image: circleci/python:3.8 + environment: + TOXENV=py38-dj21 + py38dj22: + <<: *common + docker: + - image: circleci/python:3.8 + environment: + TOXENV=py38-dj22 + py38dj30: + <<: *common + docker: + - image: circleci/python:3.8 + environment: + TOXENV=py38-dj30 workflows: version: 2 test: jobs: - lint - - py27dj111 - - py34dj111 - - py34dj20 - py35dj111 - py35dj20 + - py35dj21 + - py35dj22 + - py35dj30 - py36dj111 - py36dj20 + - py36dj21 + - py36dj22 + - py36dj30 + - py37dj111 + - py37dj20 + - py37dj21 + - py37dj22 + - py37dj30 + - py38dj20 + - py38dj21 + - py38dj22 + - py38dj30 diff --git a/README.md b/README.md index bc283e6b..281b1d80 100644 --- a/README.md +++ b/README.md @@ -59,10 +59,11 @@ configurable options as to how those notifications are to be received. `pinax-no #### Supported Django and Python versions -Django \ Python | 2.7 | 3.4 | 3.5 | 3.6 +Django / Python | 3.5 | 3.6 | 3.7 | 3.8 --------------- | --- | --- | --- | --- 1.11 | * | * | * | * -2.0 | | * | * | * +2.x | * | * | * | * +3.0 | | * | * | * ## Documentation diff --git a/pinax/notifications/conf.py b/pinax/notifications/conf.py index 8b9ec90b..50a775a7 100644 --- a/pinax/notifications/conf.py +++ b/pinax/notifications/conf.py @@ -1,5 +1,3 @@ -from __future__ import unicode_literals - import importlib from django.apps import apps as django_apps diff --git a/pinax/notifications/engine.py b/pinax/notifications/engine.py index 4f0bf525..c592d5f5 100644 --- a/pinax/notifications/engine.py +++ b/pinax/notifications/engine.py @@ -1,5 +1,6 @@ import base64 import logging +import pickle import sys import time import traceback @@ -7,7 +8,6 @@ from django.contrib.auth import get_user_model from django.contrib.sites.models import Site from django.core.mail import mail_admins -from django.utils.six.moves import cPickle as pickle # pylint: disable-msg=F from . import models as notification from .conf import settings diff --git a/pinax/notifications/lockfile.py b/pinax/notifications/lockfile.py index cd882976..9e3a985d 100644 --- a/pinax/notifications/lockfile.py +++ b/pinax/notifications/lockfile.py @@ -47,8 +47,6 @@ NotMyLock - File was locked but not by the current thread/process """ -from __future__ import division - import errno import os import socket diff --git a/pinax/notifications/migrations/0001_initial.py b/pinax/notifications/migrations/0001_initial.py index c1bae04a..cf083838 100644 --- a/pinax/notifications/migrations/0001_initial.py +++ b/pinax/notifications/migrations/0001_initial.py @@ -1,7 +1,5 @@ # -*- coding: utf-8 -*- # Generated by Django 1.9.2 on 2016-03-19 11:36 -from __future__ import unicode_literals - from django.conf import settings from django.db import migrations, models import django.db.models.deletion diff --git a/pinax/notifications/migrations/0002_auto_20171003_2006.py b/pinax/notifications/migrations/0002_auto_20171003_2006.py index 1d0db5c0..3fb99846 100644 --- a/pinax/notifications/migrations/0002_auto_20171003_2006.py +++ b/pinax/notifications/migrations/0002_auto_20171003_2006.py @@ -1,7 +1,5 @@ # -*- coding: utf-8 -*- # Generated by Django 1.11.5 on 2017-10-03 20:06 -from __future__ import unicode_literals - from django.db import migrations, models import django.db.models.deletion diff --git a/pinax/notifications/models.py b/pinax/notifications/models.py index 1ffb299f..9bb62bce 100644 --- a/pinax/notifications/models.py +++ b/pinax/notifications/models.py @@ -1,14 +1,11 @@ -from __future__ import print_function, unicode_literals - import base64 +import pickle from django.contrib.contenttypes.fields import GenericForeignKey from django.contrib.contenttypes.models import ContentType from django.core.exceptions import ImproperlyConfigured from django.db import models from django.db.models.query import QuerySet -from django.utils.encoding import python_2_unicode_compatible -from django.utils.six.moves import cPickle as pickle # pylint: disable-msg=F from django.utils.translation import ugettext_lazy as _ from django.utils.translation import activate, get_language @@ -23,7 +20,6 @@ class LanguageStoreNotAvailable(Exception): pass -@python_2_unicode_compatible class NoticeType(models.Model): label = models.CharField(_("label"), max_length=40) diff --git a/pinax/notifications/tests/test_models.py b/pinax/notifications/tests/test_models.py index 7b0a5556..9fd64748 100644 --- a/pinax/notifications/tests/test_models.py +++ b/pinax/notifications/tests/test_models.py @@ -1,11 +1,11 @@ import base64 +import pickle from django.contrib.auth import get_user_model from django.contrib.sites.models import Site from django.core import mail from django.test import TestCase from django.test.utils import override_settings -from django.utils.six.moves import cPickle as pickle from . import get_backend_id from ..conf import settings diff --git a/setup.py b/setup.py index ff9e158b..c0e11fd1 100644 --- a/setup.py +++ b/setup.py @@ -52,11 +52,13 @@ ------------------------------------ +-----------------+-----+-----+-----+-----+ -| Django / Python | 2.7 | 3.4 | 3.5 | 3.6 | +| Django / Python | 3.5 | 3.6 | 3.7 | 3.8 | +=================+=====+=====+=====+=====+ | 1.11 | * | * | * | * | +-----------------+-----+-----+-----+-----+ -| 2.0 | | * | * | * | +| 2.x | * | * | * | * | ++-----------------+-----+-----+-----+-----+ +| 3.0 | | * | * | * | +-----------------+-----+-----+-----+-----+ """ @@ -82,16 +84,18 @@ "Framework :: Django", 'Framework :: Django :: 1.11', 'Framework :: Django :: 2.0', + 'Framework :: Django :: 2.1', + 'Framework :: Django :: 2.2', + 'Framework :: Django :: 3.0', "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python", - 'Programming Language :: Python :: 2', - 'Programming Language :: Python :: 2.7', 'Programming Language :: Python :: 3', - 'Programming Language :: Python :: 3.4', 'Programming Language :: Python :: 3.5', 'Programming Language :: Python :: 3.6', + 'Programming Language :: Python :: 3.7', + 'Programming Language :: Python :: 3.8', "Topic :: Software Development :: Libraries :: Python Modules", ], install_requires=[ diff --git a/tox.ini b/tox.ini index 4e6e2d12..77339ed6 100644 --- a/tox.ini +++ b/tox.ini @@ -9,7 +9,7 @@ inline-quotes = double multi_line_output=3 known_django=django known_third_party=appconf,pinax -sections=FUTURE,STDLIB,DJANGO,THIRDPARTY,FIRSTPARTY,LOCALFOLDER +sections=STDLIB,DJANGO,THIRDPARTY,FIRSTPARTY,LOCALFOLDER include_trailing_comma=True skip_glob=**/*/migrations/* @@ -28,10 +28,8 @@ show_missing = True [tox] envlist = checkqa, - py27-dj{111} - py34-dj{111,20} - py35-dj{111,20} - py36-dj{111,20} + py{35,36,37,38}-dj{111,20,21,22} + py{36,37,38}-dj30 [testenv] passenv = CI CIRCLECI CIRCLE_* @@ -39,7 +37,10 @@ deps = coverage codecov dj111: Django>=1.11,<1.12 - dj20: Django<2.1 + dj20: Django>=2.0,<2.1 + dj21: Django>=2.1,<2.2 + dj22: Django>=2.2,<3.0 + dj30: Django>=3.0,<3.1 master: https://github.com/django/django/tarball/master usedevelop = True From 45d0e3da276c3fe10378b18949286be0e5122812 Mon Sep 17 00:00:00 2001 From: Katherine Michel Date: Wed, 22 Jan 2020 16:38:49 -0600 Subject: [PATCH 02/23] Dropping support for django 2.0 and 2.1 --- .circleci/config.yml | 79 +------------------------------------------- Makefile | 4 +-- README.md | 10 +++--- setup.py | 21 +++++------- tox.ini | 8 ++--- 5 files changed, 20 insertions(+), 102 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 09e3efd4..1912cee9 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -34,58 +34,16 @@ jobs: lint: <<: *common docker: - - image: circleci/python:3.6 + - image: circleci/python:3.8 environment: - TOXENV=checkqa - UPLOAD_COVERAGE=0 - py35dj111: - <<: *common - docker: - - image: circleci/python:3.5 - environment: - TOXENV=py35-dj111 - py35dj20: - <<: *common - docker: - - image: circleci/python:3.5 - environment: - TOXENV=py35-dj20 - py35dj21: - <<: *common - docker: - - image: circleci/python:3.5 - environment: - TOXENV=py35-dj21 - py35dj22: - <<: *common - docker: - - image: circleci/python:3.5 - environment: - TOXENV=py35-dj22 - py35dj30: - <<: *common - docker: - - image: circleci/python:3.5 - environment: - TOXENV=py35-dj30 py36dj111: <<: *common docker: - image: circleci/python:3.6 environment: TOXENV=py36-dj111 - py36dj20: - <<: *common - docker: - - image: circleci/python:3.6 - environment: - TOXENV=py36-dj20 - py36dj21: - <<: *common - docker: - - image: circleci/python:3.6 - environment: - TOXENV=py36-dj21 py36dj22: <<: *common docker: @@ -104,18 +62,6 @@ jobs: - image: circleci/python:3.7 environment: TOXENV=py37-dj111 - py37dj20: - <<: *common - docker: - - image: circleci/python:3.7 - environment: - TOXENV=py37-dj20 - py37dj21: - <<: *common - docker: - - image: circleci/python:3.7 - environment: - TOXENV=py37-dj21 py37dj22: <<: *common docker: @@ -128,18 +74,6 @@ jobs: - image: circleci/python:3.7 environment: TOXENV=py37-dj30 - py38dj20: - <<: *common - docker: - - image: circleci/python:3.8 - environment: - TOXENV=py38-dj20 - py38dj21: - <<: *common - docker: - - image: circleci/python:3.8 - environment: - TOXENV=py38-dj21 py38dj22: <<: *common docker: @@ -158,22 +92,11 @@ workflows: test: jobs: - lint - - py35dj111 - - py35dj20 - - py35dj21 - - py35dj22 - - py35dj30 - py36dj111 - - py36dj20 - - py36dj21 - py36dj22 - py36dj30 - py37dj111 - - py37dj20 - - py37dj21 - py37dj22 - py37dj30 - - py38dj20 - - py38dj21 - py38dj22 - py38dj30 diff --git a/Makefile b/Makefile index 5aff318c..e1d45554 100644 --- a/Makefile +++ b/Makefile @@ -2,9 +2,9 @@ all: init test init: python setup.py develop - pip install detox coverage + # pip install tox coverage<5 test: coverage erase - detox + tox --parallel coverage html diff --git a/README.md b/README.md index 281b1d80..d0b9fb49 100644 --- a/README.md +++ b/README.md @@ -59,11 +59,11 @@ configurable options as to how those notifications are to be received. `pinax-no #### Supported Django and Python versions -Django / Python | 3.5 | 3.6 | 3.7 | 3.8 ---------------- | --- | --- | --- | --- -1.11 | * | * | * | * -2.x | * | * | * | * -3.0 | | * | * | * +Django \ Python | 3.6 | 3.7 | 3.8 +--------------- | --- | --- | --- +1.11 | * | * | +2.2 | * | * | * +3.0 | * | * | * ## Documentation diff --git a/setup.py b/setup.py index c0e11fd1..7f73593b 100644 --- a/setup.py +++ b/setup.py @@ -51,15 +51,15 @@ Supported Django and Python Versions ------------------------------------ -+-----------------+-----+-----+-----+-----+ -| Django / Python | 3.5 | 3.6 | 3.7 | 3.8 | -+=================+=====+=====+=====+=====+ -| 1.11 | * | * | * | * | -+-----------------+-----+-----+-----+-----+ -| 2.x | * | * | * | * | -+-----------------+-----+-----+-----+-----+ -| 3.0 | | * | * | * | -+-----------------+-----+-----+-----+-----+ ++-----------------+-----+-----+-----+ +| Django / Python | 3.6 | 3.7 | 3.8 | ++=================+=====+=====+=====+ +| 1.11 | * | * | | ++-----------------+-----+-----+-----+ +| 2.2 | * | * | * | ++-----------------+-----+-----+-----+ +| 3.0 | * | * | * | ++-----------------+-----+-----+-----+ """ setup( @@ -83,8 +83,6 @@ "Environment :: Web Environment", "Framework :: Django", 'Framework :: Django :: 1.11', - 'Framework :: Django :: 2.0', - 'Framework :: Django :: 2.1', 'Framework :: Django :: 2.2', 'Framework :: Django :: 3.0', "Intended Audience :: Developers", @@ -92,7 +90,6 @@ "Operating System :: OS Independent", "Programming Language :: Python", 'Programming Language :: Python :: 3', - 'Programming Language :: Python :: 3.5', 'Programming Language :: Python :: 3.6', 'Programming Language :: Python :: 3.7', 'Programming Language :: Python :: 3.8', diff --git a/tox.ini b/tox.ini index 77339ed6..fae2e8d8 100644 --- a/tox.ini +++ b/tox.ini @@ -28,17 +28,15 @@ show_missing = True [tox] envlist = checkqa, - py{35,36,37,38}-dj{111,20,21,22} - py{36,37,38}-dj30 + py{36,37}-dj{111,22,30} + py38-dj{22,30} [testenv] passenv = CI CIRCLECI CIRCLE_* deps = - coverage + coverage<5 codecov dj111: Django>=1.11,<1.12 - dj20: Django>=2.0,<2.1 - dj21: Django>=2.1,<2.2 dj22: Django>=2.2,<3.0 dj30: Django>=3.0,<3.1 master: https://github.com/django/django/tarball/master From cd8e83ee284747b5ceccab9ea499e944cd5f737f Mon Sep 17 00:00:00 2001 From: Katherine Michel Date: Wed, 22 Jan 2020 22:57:55 -0600 Subject: [PATCH 03/23] Making checksum correction --- .circleci/config.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.circleci/config.yml b/.circleci/config.yml index 1912cee9..81116de8 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -7,6 +7,7 @@ common: &common - restore_cache: keys: - v2-deps-{{ .Environment.CIRCLE_JOB }}-{{ checksum "setup.py" }}-{{ checksum "tox.ini" }} + - v2-deps- - run: name: install dependencies command: pip install --user tox From 9f93ff87b91c4dc9b3b258a3b179637a75c0c2a8 Mon Sep 17 00:00:00 2001 From: Katherine Michel Date: Fri, 24 Jan 2020 20:22:33 -0600 Subject: [PATCH 04/23] Removing contributing doc --- CONTRIBUTING.md | 161 ------------------------------------------------ 1 file changed, 161 deletions(-) delete mode 100644 CONTRIBUTING.md diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md deleted file mode 100644 index 0b7d055c..00000000 --- a/CONTRIBUTING.md +++ /dev/null @@ -1,161 +0,0 @@ -# How to Contribute - -There are many ways you can help contribute to pinax-notifications. Contributing -code, writing documentation, reporting bugs, as well as reading and providing -feedback on issues and pull requests, all are valid and necessary ways to -help. - -## Committing Code - -The great thing about using a distributed versioning control system like git -is that everyone becomes a committer. When other people write good patches -it makes it very easy to include their fixes/features and give them proper -credit for the work. - -We recommend that you do all your work in a separate branch. When you -are ready to work on a bug or a new feature create yourself a new branch. The -reason why this is important is you can commit as often you like. When you are -ready you can merge in the change. Let's take a look at a common workflow: - - git checkout -b task-566 - ... fix and git commit often ... - git push origin task-566 - -The reason we have created two new branches is to stay off of `master`. -Keeping master clean of only upstream changes makes yours and ours lives -easier. You can then send us a pull request for the fix/feature. Then we can -easily review it and merge it when ready. - - -### Writing Commit Messages - -Writing a good commit message makes it simple for us to identify what your -commit does from a high-level. There are some basic guidelines we'd like to -ask you to follow. - -A critical part is that you keep the **first** line as short and sweet -as possible. This line is important because when git shows commits and it has -limited space or a different formatting option is used the first line becomes -all someone might see. If your change isn't something non-trivial or there -reasoning behind the change is not obvious, then please write up an extended -message explaining the fix, your rationale, and anything else relevant for -someone else that might be reviewing the change. Lastly, if there is a -corresponding issue in Github issues for it, use the final line to provide -a message that will link the commit message to the issue and auto-close it -if appropriate. - - Add ability to travel back in time - - You need to be driving 88 miles per hour to generate 1.21 gigawatts of - power to properly use this feature. - - Fixes #88 - - -## Coding style - -When writing code to be included in pinax-notifications keep our style in mind: - -* Follow [PEP8](http://www.python.org/dev/peps/pep-0008/) there are some - cases where we do not follow PEP8. It is an excellent starting point. -* Follow [Django's coding style](http://docs.djangoproject.com/en/dev/internals/contributing/#coding-style) - we're pretty much in agreement on Django style outlined there. - -We would like to enforce a few more strict guides not outlined by PEP8 or -Django's coding style: - -* PEP8 tries to keep line length at 80 characters. We follow it when we can, - but not when it makes a line harder to read. It is okay to go a little bit - over 80 characters if not breaking the line improves readability. -* Use double quotes not single quotes. Single quotes are allowed in cases - where a double quote is needed in the string. This makes the code read - cleaner in those cases. -* Blank lines should contain no whitespace. -* Docstrings always use three double quotes on a line of their own, so, for - example, a single line docstring should take up three lines not one. -* Imports are grouped specifically and ordered alphabetically. This is shown - in the example below. -* Always use `reverse` and never `@models.permalink`. -* Tuples should be reserved for positional data structures and not used - where a list is more appropriate. -* URL patterns should use the `url()` function rather than a tuple. - -Here is an example of these rules applied: -``` - # first set of imports are stdlib imports - # non-from imports go first then from style import in their own group - import csv - - # second set of imports are Django imports with contrib in their own - # group. - from django.db import models - from django.utils import timezone - from django.utils.translation import ugettext_lazy as _ - - from django.contrib.auth.models import User - - # third set of imports are external apps (if applicable) - from tagging.fields import TagField - - # fourth set of imports are local apps - from .compat import reverse - from .fields import MarkupField - - - class Task(models.Model): - """ - A model for storing a task. - """ - - creator = models.ForeignKey(User) - created = models.DateTimeField(default=timezone.now) - modified = models.DateTimeField(default=timezone.now) - - objects = models.Manager() - - class Meta: - verbose_name = _("task") - verbose_name_plural = _("tasks") - - def __unicode__(self): - return self.summary - - def save(self, **kwargs): - self.modified = datetime.now() - super(Task, self).save(**kwargs) - - def get_absolute_url(self): - return reverse("task_detail", kwargs={"task_id": self.pk}) - - # custom methods - - - class TaskComment(models.Model): - # ... you get the point ... - pass -``` - -## Pull Requests - -Please keep your pull requests focused on one specific thing only. If you -have a number of contributions to make, then please send seperate pull -requests. It is much easier on maintainers to receive small, well defined, -pull requests, than it is to have a single large one that batches up a -lot of unrelated commits. - -If you ended up making multiple commits for one logical change, please -rebase into a single commit. - - git rebase -i HEAD~10 # where 10 is the number of commits back you need - -This will pop up an editor with your commits and some instructions you want -to squash commits down by replacing 'pick' with 's' to have it combined with -the commit before it. You can squash multiple ones at the same time. - -When you save and exit the text editor where you were squashing commits, git -will squash them down and then present you with another editor with commit -messages. Choose the one to apply to the squashed commit (or write a new -one entirely.) Save and exit will complete the rebase. Use a forced push to -your fork. - - git push -f From 6b0e48586faaa395f658601ce2564f9a14c70c3f Mon Sep 17 00:00:00 2001 From: Katherine Michel Date: Fri, 24 Jan 2020 21:42:43 -0600 Subject: [PATCH 05/23] Fixing team email --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 7f73593b..fcf7af48 100644 --- a/setup.py +++ b/setup.py @@ -64,7 +64,7 @@ setup( author="Pinax Team", - author_email="team@pinaxprojects.com", + author_email="team@pinaxproject.com", description="User notification management for the Django web framework", name="pinax-notifications", long_description=LONG_DESCRIPTION, From 9137facfec99a0a82ad12a939c54012c66e53054 Mon Sep 17 00:00:00 2001 From: KatherineMichel Date: Mon, 17 Feb 2020 20:27:39 -0600 Subject: [PATCH 06/23] Fix forward slash and license date --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index d0b9fb49..87a673e2 100644 --- a/README.md +++ b/README.md @@ -59,7 +59,7 @@ configurable options as to how those notifications are to be received. `pinax-no #### Supported Django and Python versions -Django \ Python | 3.6 | 3.7 | 3.8 +Django / Python | 3.6 | 3.7 | 3.8 --------------- | --- | --- | --- 1.11 | * | * | 2.2 | * | * | * @@ -613,4 +613,4 @@ and check out our [Pinax Project blog](http://blog.pinaxproject.com). ## License -Copyright (c) 2012-2019 James Tauber and contributors under the [MIT license](https://opensource.org/licenses/MIT). +Copyright (c) 2012-present James Tauber and contributors under the [MIT license](https://opensource.org/licenses/MIT). From 1b531865b907ca01c32d7a790b1d5f48cd6f3925 Mon Sep 17 00:00:00 2001 From: KatherineMichel Date: Mon, 17 Feb 2020 20:28:12 -0600 Subject: [PATCH 07/23] Fix license date --- LICENSE | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/LICENSE b/LICENSE index f4607aef..c9d23959 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) 2012-2019 James Tauber and contributors +Copyright (c) 2012-present James Tauber and contributors Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal From 935127911645cd8059acda4959bf4b6e026654ad Mon Sep 17 00:00:00 2001 From: Katherine Michel Date: Fri, 21 Feb 2020 16:02:08 -0600 Subject: [PATCH 08/23] Update CircleCI version --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 81116de8..352a17a1 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,4 +1,4 @@ -version: 2.0 +version: 2.1 common: &common working_directory: ~/repo From 4372319d16865388601c2810f332d6166c992320 Mon Sep 17 00:00:00 2001 From: Katherine Michel Date: Fri, 21 Feb 2020 16:04:59 -0600 Subject: [PATCH 09/23] Remove setup.cfg --- setup.cfg | 2 -- 1 file changed, 2 deletions(-) delete mode 100644 setup.cfg diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index 2a9acf13..00000000 --- a/setup.cfg +++ /dev/null @@ -1,2 +0,0 @@ -[bdist_wheel] -universal = 1 From 77ec1b3d58548505845eae3a770a03c941504c2b Mon Sep 17 00:00:00 2001 From: Katherine Michel Date: Fri, 21 Feb 2020 16:06:06 -0600 Subject: [PATCH 10/23] Update tox deps versions --- tox.ini | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tox.ini b/tox.ini index fae2e8d8..03cbd216 100644 --- a/tox.ini +++ b/tox.ini @@ -51,6 +51,6 @@ commands = flake8 pinax isort --recursive --check-only --diff pinax -sp tox.ini deps = - flake8 == 3.4.1 - flake8-quotes == 0.11.0 - isort == 4.2.15 + flake8 == 3.7.9 + flake8-quotes == 2.1.1 + isort == 4.3.21 From 64560598a542a23295d1a9237dc596231e5bddbc Mon Sep 17 00:00:00 2001 From: Katherine Michel Date: Fri, 21 Feb 2020 16:14:54 -0600 Subject: [PATCH 11/23] Bumping version --- README.md | 2 ++ setup.py | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 87a673e2..06ed7a06 100644 --- a/README.md +++ b/README.md @@ -475,6 +475,8 @@ urlpatterns = [ ## Change Log +### 6.0.0 + ### 5.0.2 * Remove unneeded compatibility diff --git a/setup.py b/setup.py index fcf7af48..79e42dde 100644 --- a/setup.py +++ b/setup.py @@ -1,6 +1,6 @@ from setuptools import find_packages, setup -VERSION = "5.0.3" +VERSION = "6.0.0" LONG_DESCRIPTION = """ .. image:: http://pinaxproject.com/pinax-design/patches/pinax-notifications.svg :target: https://pypi.python.org/pypi/pinax-notifications/ From 4e39ed3fbb3ded7df899881cc250134cbbbc023c Mon Sep 17 00:00:00 2001 From: Hameed Gifford Date: Tue, 3 Mar 2020 15:53:44 -0500 Subject: [PATCH 12/23] Update `setup.py` classifiers Co-Authored-By: Charlie Denton --- setup.py | 1 + 1 file changed, 1 insertion(+) diff --git a/setup.py b/setup.py index 79e42dde..c7e3af3f 100644 --- a/setup.py +++ b/setup.py @@ -90,6 +90,7 @@ "Operating System :: OS Independent", "Programming Language :: Python", 'Programming Language :: Python :: 3', + 'Programming Language :: Python :: 3 :: Only', 'Programming Language :: Python :: 3.6', 'Programming Language :: Python :: 3.7', 'Programming Language :: Python :: 3.8', From 2ca56070c7c0ee11fc26e1c8d2e590f7de8e7627 Mon Sep 17 00:00:00 2001 From: Katherine Michel Date: Sat, 7 Mar 2020 15:45:35 -0600 Subject: [PATCH 13/23] Updating Makefile --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index e1d45554..70f09ad9 100644 --- a/Makefile +++ b/Makefile @@ -2,9 +2,9 @@ all: init test init: python setup.py develop - # pip install tox coverage<5 + pip install tox "coverage<5" test: coverage erase - tox --parallel + tox --parallel--safe-build coverage html From 0c3f2dd410b24467b60fc77bf665adbca326d9be Mon Sep 17 00:00:00 2001 From: Katherine Michel Date: Sat, 7 Mar 2020 15:46:56 -0600 Subject: [PATCH 14/23] Consolidating dependency installation in CircleCI config --- .circleci/config.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 352a17a1..65cc62d7 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -10,7 +10,7 @@ common: &common - v2-deps- - run: name: install dependencies - command: pip install --user tox + command: pip install --user tox codecov "coverage<5" - run: name: run tox command: ~/.local/bin/tox @@ -19,7 +19,6 @@ common: &common command: | if [[ "$UPLOAD_COVERAGE" != 0 ]]; then PATH=$HOME/.local/bin:$PATH - pip install --user codecov coverage xml ~/.local/bin/codecov --required -X search gcov pycov -f coverage.xml --flags $CIRCLE_JOB fi From 855866eef8538a00e54926d58c40990677b87948 Mon Sep 17 00:00:00 2001 From: Katherine Michel Date: Sat, 7 Mar 2020 16:04:49 -0600 Subject: [PATCH 15/23] Dropping Python 2.7 support and updating README.mdd --- .circleci/config.yml | 14 -------------- README.md | 36 ++++++++++++++++++++---------------- setup.py | 5 +---- tox.ini | 4 +--- 4 files changed, 22 insertions(+), 37 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 65cc62d7..6326b6bc 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -38,12 +38,6 @@ jobs: environment: - TOXENV=checkqa - UPLOAD_COVERAGE=0 - py36dj111: - <<: *common - docker: - - image: circleci/python:3.6 - environment: - TOXENV=py36-dj111 py36dj22: <<: *common docker: @@ -56,12 +50,6 @@ jobs: - image: circleci/python:3.6 environment: TOXENV=py36-dj30 - py37dj111: - <<: *common - docker: - - image: circleci/python:3.7 - environment: - TOXENV=py37-dj111 py37dj22: <<: *common docker: @@ -92,10 +80,8 @@ workflows: test: jobs: - lint - - py36dj111 - py36dj22 - py36dj30 - - py37dj111 - py37dj22 - py37dj30 - py38dj22 diff --git a/README.md b/README.md index 06ed7a06..2d53cea4 100644 --- a/README.md +++ b/README.md @@ -17,6 +17,7 @@ ## Table of Contents * [About Pinax](#about-pinax) +* [Important Links](#important-links) * [Overview](#overview) * [Features](#features) * [Supported Django and Python versions](#supported-django-and-python-versions) @@ -42,6 +43,17 @@ Pinax is an open-source platform built on the Django Web Framework. It is an eco Django apps, themes, and starter project templates. This collection can be found at http://pinaxproject.com. +## Important Links + +Where you can find what you need: +* Releases: published to [PyPI](https://pypi.org/search/?q=pinax) or tagged in app repos in the [Pinax GitHub organization](https://github.com/pinax/) +* Global documentation: [Pinax documentation website](https://pinaxproject.com/pinax/) +* App specific documentation: app repos in the [Pinax GitHub organization](https://github.com/pinax/) +* Support information: [SUPPORT.md](https://github.com/pinax/.github/blob/master/SUPPORT.md) file in the [Pinax default community health file repo](https://github.com/pinax/.github/) +* Contributing information: [CONTRIBUTING.md](https://github.com/pinax/.github/blob/master/CONTRIBUTING.md) file in the [Pinax default community health file repo](https://github.com/pinax/.github/) +* Current and historical release docs: [Pinax Wiki](https://github.com/pinax/pinax/wiki/) + + ## pinax-notifications ### Overview @@ -61,7 +73,6 @@ configurable options as to how those notifications are to be received. `pinax-no Django / Python | 3.6 | 3.7 | 3.8 --------------- | --- | --- | --- -1.11 | * | * | 2.2 | * | * | * 3.0 | * | * | * @@ -477,6 +488,11 @@ urlpatterns = [ ### 6.0.0 +* Drop Django 1.11, 2.0, and 2.1, and Python 2,7, 3.4, and 3.5 support +* Add Django 2.2 and 3.0, and Python 3.6, 3.7, and 3.8 support +* Update packaging configs +* Direct users to community resources + ### 5.0.2 * Remove unneeded compatibility @@ -588,29 +604,17 @@ across the ecosystem. ## Contribute -For an overview on how contributing to Pinax works read this [blog post](http://blog.pinaxproject.com/2016/02/26/recap-february-pinax-hangout/) -and watch the included video, or read our [How to Contribute](http://pinaxproject.com/pinax/how_to_contribute/) section. -For concrete contribution ideas, please see our -[Ways to Contribute/What We Need Help With](http://pinaxproject.com/pinax/ways_to_contribute/) section. - -In case of any questions we recommend you join our [Pinax Slack team](http://slack.pinaxproject.com) -and ping us there instead of creating an issue on GitHub. Creating issues on GitHub is of course -also valid but we are usually able to help you faster if you ping us in Slack. - -We also highly recommend reading our blog post on [Open Source and Self-Care](http://blog.pinaxproject.com/2016/01/19/open-source-and-self-care/). +[Contributing](https://github.com/pinax/.github/blob/master/CONTRIBUTING.md) information can be found in the [Pinax community health file repo](https://github.com/pinax/.github). ## Code of Conduct -In order to foster a kind, inclusive, and harassment-free community, the Pinax Project -has a [code of conduct](http://pinaxproject.com/pinax/code_of_conduct/). -We ask you to treat everyone as a smart human programmer that shares an interest in Python, Django, and Pinax with you. +In order to foster a kind, inclusive, and harassment-free community, the Pinax Project has a [Code of Conduct](https://github.com/pinax/.github/blob/master/CODE_OF_CONDUCT.md). We ask you to treat everyone as a smart human programmer that shares an interest in Python, Django, and Pinax with you. ## Connect with Pinax -For updates and news regarding the Pinax Project, please follow us on Twitter [@pinaxproject](https://twitter.com/pinaxproject) -and check out our [Pinax Project blog](http://blog.pinaxproject.com). +For updates and news regarding the Pinax Project, please follow us on Twitter [@pinaxproject](https://twitter.com/pinaxproject) and check out our [Pinax Project blog](http://blog.pinaxproject.com). ## License diff --git a/setup.py b/setup.py index c7e3af3f..4abcc0ba 100644 --- a/setup.py +++ b/setup.py @@ -54,8 +54,6 @@ +-----------------+-----+-----+-----+ | Django / Python | 3.6 | 3.7 | 3.8 | +=================+=====+=====+=====+ -| 1.11 | * | * | | -+-----------------+-----+-----+-----+ | 2.2 | * | * | * | +-----------------+-----+-----+-----+ | 3.0 | * | * | * | @@ -82,7 +80,6 @@ "Development Status :: 5 - Production/Stable", "Environment :: Web Environment", "Framework :: Django", - 'Framework :: Django :: 1.11', 'Framework :: Django :: 2.2', 'Framework :: Django :: 3.0', "Intended Audience :: Developers", @@ -97,7 +94,7 @@ "Topic :: Software Development :: Libraries :: Python Modules", ], install_requires=[ - "django>=1.11", + "django>=2.2", "django-appconf>=1.0.1", ], tests_require=[ diff --git a/tox.ini b/tox.ini index 03cbd216..230bc07a 100644 --- a/tox.ini +++ b/tox.ini @@ -28,15 +28,13 @@ show_missing = True [tox] envlist = checkqa, - py{36,37}-dj{111,22,30} - py38-dj{22,30} + py{36,37,38}-dj{22,30} [testenv] passenv = CI CIRCLECI CIRCLE_* deps = coverage<5 codecov - dj111: Django>=1.11,<1.12 dj22: Django>=2.2,<3.0 dj30: Django>=3.0,<3.1 master: https://github.com/django/django/tarball/master From bea840f69a45699813ac72dc1678d7056c93f81d Mon Sep 17 00:00:00 2001 From: Katherine Michel Date: Fri, 20 Mar 2020 23:02:53 -0500 Subject: [PATCH 16/23] Remove .coveragerc bc/can be read from tox.ini --- .coveragerc | 7 ------- .gitignore | 1 + tox.ini | 4 ++-- 3 files changed, 3 insertions(+), 9 deletions(-) delete mode 100644 .coveragerc diff --git a/.coveragerc b/.coveragerc deleted file mode 100644 index 3c50558f..00000000 --- a/.coveragerc +++ /dev/null @@ -1,7 +0,0 @@ -[run] -source = pinax -omit = pinax/notifications/tests/*,pinax/notifications/admin.py -branch = 1 - -[report] -omit = pinax/notifications/tests/*,pinax/notifications/admin.py diff --git a/.gitignore b/.gitignore index 3ea1898a..bcdb04a9 100644 --- a/.gitignore +++ b/.gitignore @@ -36,6 +36,7 @@ pip-delete-this-directory.txt htmlcov/ .tox/ .coverage +.coveragerc .cache nosetests.xml coverage.xml diff --git a/tox.ini b/tox.ini index 230bc07a..584b1bec 100644 --- a/tox.ini +++ b/tox.ini @@ -15,12 +15,12 @@ skip_glob=**/*/migrations/* [coverage:run] source = pinax -omit = **/*/conf.py,**/*/tests/*,**/*/migrations/* +omit = **/*/conf.py,**/*/tests/*,**/*/migrations/*,**/*/admin.py branch = true data_file = .coverage [coverage:report] -omit = **/*/conf.py,**/*/tests/*,**/*/migrations/* +omit = **/*/conf.py,**/*/tests/*,**/*/migrations/*,**/*/admin.py exclude_lines = coverage: omit show_missing = True From c4b7401e4b3f89f6ebb4e7829ed6d03abd803542 Mon Sep 17 00:00:00 2001 From: KatherineMichel Date: Mon, 20 Apr 2020 18:12:28 -0500 Subject: [PATCH 17/23] Fix linebreak --- README.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/README.md b/README.md index 2d53cea4..2dac2ef2 100644 --- a/README.md +++ b/README.md @@ -39,8 +39,7 @@ ## About Pinax -Pinax is an open-source platform built on the Django Web Framework. It is an ecosystem of reusable -Django apps, themes, and starter project templates. This collection can be found at http://pinaxproject.com. +Pinax is an open-source platform built on the Django Web Framework. It is an ecosystem of reusable Django apps, themes, and starter project templates. This collection can be found at http://pinaxproject.com. ## Important Links From 4813e7b5cfdd3727a463afd5ba04b273c6cd4e3f Mon Sep 17 00:00:00 2001 From: KatherineMichel Date: Mon, 20 Apr 2020 18:34:11 -0500 Subject: [PATCH 18/23] Fix capitalization --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 2dac2ef2..46ac5c69 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,7 @@ * [Important Links](#important-links) * [Overview](#overview) * [Features](#features) - * [Supported Django and Python versions](#supported-django-and-python-versions) + * [Supported Django and Python Versions](#supported-django-and-python-versions) * [Documentation](#documentation) * [Installation](#installation) * [Usage](#usage) @@ -68,7 +68,7 @@ configurable options as to how those notifications are to be received. `pinax-no * Ability to supply your own backend notification channels * Ability to scope notifications at the site level -#### Supported Django and Python versions +#### Supported Django and Python Versions Django / Python | 3.6 | 3.7 | 3.8 --------------- | --- | --- | --- From 0056b53027dadd19877db0a8823e33ecdb7f8ab1 Mon Sep 17 00:00:00 2001 From: Katherine Michel Date: Sun, 3 May 2020 21:47:27 -0500 Subject: [PATCH 19/23] Making checkqa happy --- pinax/__init__.py | 1 + pinax/notifications/__init__.py | 1 - pinax/notifications/lockfile.py | 7 ++----- pinax/notifications/models.py | 2 +- pinax/notifications/tests/test_models.py | 2 +- pinax/notifications/tests/test_views.py | 2 +- 6 files changed, 6 insertions(+), 9 deletions(-) diff --git a/pinax/__init__.py b/pinax/__init__.py index 25291961..fd1aad67 100644 --- a/pinax/__init__.py +++ b/pinax/__init__.py @@ -1,2 +1,3 @@ from pkgutil import extend_path + __path__ = extend_path(__path__, __name__) # noqa diff --git a/pinax/notifications/__init__.py b/pinax/notifications/__init__.py index afc9e434..08b8c0fd 100644 --- a/pinax/notifications/__init__.py +++ b/pinax/notifications/__init__.py @@ -1,5 +1,4 @@ import pkg_resources - default_app_config = "pinax.notifications.apps.AppConfig" __version__ = pkg_resources.get_distribution("pinax-notifications").version diff --git a/pinax/notifications/lockfile.py b/pinax/notifications/lockfile.py index 9e3a985d..453076cb 100644 --- a/pinax/notifications/lockfile.py +++ b/pinax/notifications/lockfile.py @@ -286,9 +286,7 @@ def is_locked(self): return os.path.exists(self.lock_file) def i_am_locking(self): - return (self.is_locked() and - os.path.exists(self.unique_name) and - os.stat(self.unique_name).st_nlink == 2) + return (self.is_locked() and os.path.exists(self.unique_name) and os.stat(self.unique_name).st_nlink == 2) def break_lock(self): if os.path.exists(self.lock_file): @@ -363,8 +361,7 @@ def is_locked(self): return os.path.exists(self.lock_file) def i_am_locking(self): - return (self.is_locked() and - os.path.exists(self.unique_name)) + return (self.is_locked() and os.path.exists(self.unique_name)) def break_lock(self): if os.path.exists(self.lock_file): diff --git a/pinax/notifications/models.py b/pinax/notifications/models.py index 9bb62bce..0bed5943 100644 --- a/pinax/notifications/models.py +++ b/pinax/notifications/models.py @@ -6,8 +6,8 @@ from django.core.exceptions import ImproperlyConfigured from django.db import models from django.db.models.query import QuerySet -from django.utils.translation import ugettext_lazy as _ from django.utils.translation import activate, get_language +from django.utils.translation import ugettext_lazy as _ from .conf import settings from .hooks import hookset diff --git a/pinax/notifications/tests/test_models.py b/pinax/notifications/tests/test_models.py index 9fd64748..b320c3d3 100644 --- a/pinax/notifications/tests/test_models.py +++ b/pinax/notifications/tests/test_models.py @@ -7,7 +7,6 @@ from django.test import TestCase from django.test.utils import override_settings -from . import get_backend_id from ..conf import settings from ..models import ( LanguageStoreNotAvailable, @@ -19,6 +18,7 @@ send, send_now, ) +from . import get_backend_id from .models import Language diff --git a/pinax/notifications/tests/test_views.py b/pinax/notifications/tests/test_views.py index 86216ba3..3d57aabc 100644 --- a/pinax/notifications/tests/test_views.py +++ b/pinax/notifications/tests/test_views.py @@ -2,9 +2,9 @@ from django.test import RequestFactory, TestCase from django.urls import reverse -from . import get_backend_id from ..models import NoticeSetting, NoticeType from ..views import NoticeSettingsView +from . import get_backend_id class TestViews(TestCase): From 267aa05cbd6a4578cd7d614abc5fe15410760e50 Mon Sep 17 00:00:00 2001 From: Katherine Michel Date: Sun, 17 May 2020 01:39:48 -0500 Subject: [PATCH 20/23] Update syntax to drop support --- pinax/notifications/backends/base.py | 8 ++++---- pinax/notifications/backends/email.py | 2 +- pinax/notifications/conf.py | 8 ++++---- pinax/notifications/engine.py | 12 ++++++------ pinax/notifications/hooks.py | 4 ++-- pinax/notifications/lockfile.py | 6 +++--- pinax/notifications/tests/test_models.py | 4 ++-- pinax/notifications/tests/test_views.py | 2 +- pinax/notifications/views.py | 6 +++--- 9 files changed, 26 insertions(+), 26 deletions(-) diff --git a/pinax/notifications/backends/base.py b/pinax/notifications/backends/base.py index d71ad72a..0d9381bb 100644 --- a/pinax/notifications/backends/base.py +++ b/pinax/notifications/backends/base.py @@ -5,7 +5,7 @@ from ..hooks import hookset -class BaseBackend(object): +class BaseBackend: """ The base backend. """ @@ -35,15 +35,15 @@ def get_formatted_messages(self, formats, label, context): format_templates = {} for fmt in formats: format_templates[fmt] = render_to_string(( - "pinax/notifications/{0}/{1}".format(label, fmt), - "pinax/notifications/{0}".format(fmt)), context) + f"pinax/notifications/{label}/{fmt}", + f"pinax/notifications/{fmt}"), context) return format_templates def default_context(self): use_ssl = getattr(settings, "PINAX_USE_SSL", False) default_http_protocol = "https" if use_ssl else "http" current_site = Site.objects.get_current() - base_url = "{0}://{1}".format(default_http_protocol, current_site.domain) + base_url = f"{default_http_protocol}://{current_site.domain}" return { "default_http_protocol": default_http_protocol, "current_site": current_site, diff --git a/pinax/notifications/backends/email.py b/pinax/notifications/backends/email.py index fc7cd03b..c5801b73 100644 --- a/pinax/notifications/backends/email.py +++ b/pinax/notifications/backends/email.py @@ -10,7 +10,7 @@ class EmailBackend(BaseBackend): spam_sensitivity = 2 def can_send(self, user, notice_type, scoping): - can_send = super(EmailBackend, self).can_send(user, notice_type, scoping) + can_send = super().can_send(user, notice_type, scoping) if can_send and user.email: return True return False diff --git a/pinax/notifications/conf.py b/pinax/notifications/conf.py index 50a775a7..1c0eb550 100644 --- a/pinax/notifications/conf.py +++ b/pinax/notifications/conf.py @@ -12,10 +12,10 @@ def load_model(path): return django_apps.get_model(path) except ValueError: raise ImproperlyConfigured( - "{0} must be of the form 'app_label.model_name'".format(path) + f"{path} must be of the form 'app_label.model_name'" ) except LookupError: - raise ImproperlyConfigured("{0} has not been installed".format(path)) + raise ImproperlyConfigured(f"{path} has not been installed") def load_path_attr(path): @@ -24,11 +24,11 @@ def load_path_attr(path): try: mod = importlib.import_module(module) except ImportError as e: - raise ImproperlyConfigured("Error importing {0}: '{1}'".format(module, e)) + raise ImproperlyConfigured(f"Error importing {module}: '{e}'") try: attr = getattr(mod, attr) except AttributeError: - raise ImproperlyConfigured("Module '{0}' does not define a '{1}'".format(module, attr)) + raise ImproperlyConfigured(f"Module '{module}' does not define a '{attr}'") return attr diff --git a/pinax/notifications/engine.py b/pinax/notifications/engine.py index c592d5f5..e56936fb 100644 --- a/pinax/notifications/engine.py +++ b/pinax/notifications/engine.py @@ -49,7 +49,7 @@ def send_all(*args): for user, label, extra_context, sender in notices: try: user = get_user_model().objects.get(pk=user) - logging.info("emitting notice {0} to {1}".format(label, user)) + logging.info(f"emitting notice {label} to {user}") # call this once per user to be atomic and allow for logging to # accurately show how long each takes. if notification.send_now([user], label, extra_context, sender): @@ -57,7 +57,7 @@ def send_all(*args): except get_user_model().DoesNotExist: # Ignore deleted users, just warn about them logging.warning( - "not emitting notice {0} to user {1} since it does not exist".format( + "not emitting notice {} to user {} since it does not exist".format( label, user) ) @@ -76,18 +76,18 @@ def send_all(*args): _, e, _ = sys.exc_info() # email people current_site = Site.objects.get_current() - subject = "[{0} emit_notices] {1}".format(current_site.name, e) + subject = f"[{current_site.name} emit_notices] {e}" message = "\n".join( traceback.format_exception(*sys.exc_info()) # pylint: disable-msg=W0142 ) mail_admins(subject, message, fail_silently=True) # log it as critical - logging.critical("an exception occurred: {0}".format(e)) + logging.critical(f"an exception occurred: {e}") finally: logging.debug("releasing lock...") lock.release() logging.debug("released.") logging.info("") - logging.info("{0} batches, {1} sent".format(batches, sent,)) - logging.info("done in {0:.2f} seconds".format(time.time() - start_time)) + logging.info(f"{batches} batches, {sent} sent") + logging.info("done in {:.2f} seconds".format(time.time() - start_time)) diff --git a/pinax/notifications/hooks.py b/pinax/notifications/hooks.py index 38f050e9..c6b3d6b0 100644 --- a/pinax/notifications/hooks.py +++ b/pinax/notifications/hooks.py @@ -5,7 +5,7 @@ from .utils import load_media_defaults -class DefaultHookSet(object): +class DefaultHookSet: def notice_setting_for_user(self, user, notice_type, medium, scoping=None): kwargs = { @@ -39,7 +39,7 @@ def notice_setting_for_user(self, user, notice_type, medium, scoping=None): return setting -class HookProxy(object): +class HookProxy: def __getattr__(self, attr): return getattr(settings.PINAX_NOTIFICATIONS_HOOKSET, attr) diff --git a/pinax/notifications/lockfile.py b/pinax/notifications/lockfile.py index 453076cb..94af0705 100644 --- a/pinax/notifications/lockfile.py +++ b/pinax/notifications/lockfile.py @@ -177,7 +177,7 @@ def __init__(self, path, threaded=True): tname = "" dirname = os.path.dirname(self.lock_file) self.unique_name = os.path.join(dirname, - "%s.%s%s" % (self.hostname, + "{}.{}{}".format(self.hostname, tname, self.pid)) @@ -243,7 +243,7 @@ class LinkFileLock(LockBase): def acquire(self, timeout=None): try: open(self.unique_name, "wb").close() - except IOError: + except OSError: raise LockFailed("failed to create %s" % self.unique_name) end_time = time.time() @@ -309,7 +309,7 @@ def __init__(self, path, threaded=True): # it. self.unique_name = os.path.join( self.lock_file, - "{}.{}{}".format(self.hostname, tname, self.pid) + f"{self.hostname}.{tname}{self.pid}" ) def attempt_acquire(self, timeout, end_time, wait): diff --git a/pinax/notifications/tests/test_models.py b/pinax/notifications/tests/test_models.py index b320c3d3..da539e0e 100644 --- a/pinax/notifications/tests/test_models.py +++ b/pinax/notifications/tests/test_models.py @@ -74,12 +74,12 @@ def test_for_user(self): class TestProcedures(BaseTest): def setUp(self): - super(TestProcedures, self).setUp() + super().setUp() self.lang = Language.objects.create(user=self.user, language="en_US") mail.outbox = [] def tearDown(self): - super(TestProcedures, self).tearDown() + super().tearDown() self.lang.delete() NoticeQueueBatch.objects.all().delete() diff --git a/pinax/notifications/tests/test_views.py b/pinax/notifications/tests/test_views.py index 3d57aabc..4e11020a 100644 --- a/pinax/notifications/tests/test_views.py +++ b/pinax/notifications/tests/test_views.py @@ -26,7 +26,7 @@ def test_notice_settings(self): request.user = self.user response = NoticeSettingsView.as_view()(request) self.assertEqual(response.status_code, 200) # pylint: disable-msg=E1103 - label = "setting-{0}-{1}".format( + label = "setting-{}-{}".format( notice_type_2.pk, email_id ) diff --git a/pinax/notifications/views.py b/pinax/notifications/views.py index 2f3cc559..8fb398fa 100644 --- a/pinax/notifications/views.py +++ b/pinax/notifications/views.py @@ -12,7 +12,7 @@ class NoticeSettingsView(TemplateView): @method_decorator(login_required) def dispatch(self, *args, **kwargs): - return super(NoticeSettingsView, self).dispatch(*args, **kwargs) + return super().dispatch(*args, **kwargs) @property def scoping(self): @@ -27,7 +27,7 @@ def setting_for_user(self, notice_type, medium_id): ) def form_label(self, notice_type, medium_id): - return "setting-{0}-{1}".format( + return "setting-{}-{}".format( notice_type.pk, medium_id ) @@ -72,7 +72,7 @@ def get_context_data(self, **kwargs): ], "rows": self.settings_table(), } - context = super(NoticeSettingsView, self).get_context_data(**kwargs) + context = super().get_context_data(**kwargs) context.update({ "notice_types": NoticeType.objects.all(), "notice_settings": settings From a6f154389f5e4dcb72b3dec45760ce5523264094 Mon Sep 17 00:00:00 2001 From: Katherine Michel Date: Sun, 17 May 2020 01:42:03 -0500 Subject: [PATCH 21/23] Fix tox --- tox.ini | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tox.ini b/tox.ini index 584b1bec..8348d22f 100644 --- a/tox.ini +++ b/tox.ini @@ -1,5 +1,5 @@ [flake8] -ignore = E265,E501 +ignore = E265,E501,W504 max-line-length = 100 max-complexity = 10 exclude = **/*/migrations/* @@ -9,7 +9,7 @@ inline-quotes = double multi_line_output=3 known_django=django known_third_party=appconf,pinax -sections=STDLIB,DJANGO,THIRDPARTY,FIRSTPARTY,LOCALFOLDER +sections=FUTURE,STDLIB,DJANGO,THIRDPARTY,FIRSTPARTY,LOCALFOLDER include_trailing_comma=True skip_glob=**/*/migrations/* @@ -29,7 +29,7 @@ show_missing = True envlist = checkqa, py{36,37,38}-dj{22,30} - + [testenv] passenv = CI CIRCLECI CIRCLE_* deps = From b5d89cedd2528579a87d118c0a1705353175de2d Mon Sep 17 00:00:00 2001 From: Katherine Michel Date: Sun, 17 May 2020 01:48:03 -0500 Subject: [PATCH 22/23] Fix linting --- pinax/notifications/lockfile.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/pinax/notifications/lockfile.py b/pinax/notifications/lockfile.py index 94af0705..cf61dcbc 100644 --- a/pinax/notifications/lockfile.py +++ b/pinax/notifications/lockfile.py @@ -176,10 +176,7 @@ def __init__(self, path, threaded=True): else: tname = "" dirname = os.path.dirname(self.lock_file) - self.unique_name = os.path.join(dirname, - "{}.{}{}".format(self.hostname, - tname, - self.pid)) + self.unique_name = os.path.join(dirname, "{}.{}{}".format(self.hostname, tname, self.pid)) def acquire(self, timeout=None): """ From 5c411759e5dbd3d288dc416d91688b46116bab89 Mon Sep 17 00:00:00 2001 From: Katherine Michel Date: Fri, 12 Jun 2020 11:39:56 -0500 Subject: [PATCH 23/23] Update lockfile with f-string --- pinax/notifications/lockfile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pinax/notifications/lockfile.py b/pinax/notifications/lockfile.py index cf61dcbc..3316538e 100644 --- a/pinax/notifications/lockfile.py +++ b/pinax/notifications/lockfile.py @@ -176,7 +176,7 @@ def __init__(self, path, threaded=True): else: tname = "" dirname = os.path.dirname(self.lock_file) - self.unique_name = os.path.join(dirname, "{}.{}{}".format(self.hostname, tname, self.pid)) + self.unique_name = os.path.join(dirname, f"{self.hostname}.{tname}{self.pid}") def acquire(self, timeout=None): """