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

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,16 @@ repos:
"requirements/translate.txt",
]

- repo: https://github.com/asottile/pyupgrade
rev: v3.21.2
hooks:
- id: pyupgrade

- repo: https://github.com/adamchainz/django-upgrade
rev: "1.32.0"
hooks:
- id: django-upgrade

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: "v0.15.11"
hooks:
Expand Down Expand Up @@ -76,6 +86,7 @@ repos:
additional_dependencies:
- stylelint@16.26.1
- stylelint-config-standard-scss@13.1.0

- repo: https://github.com/gitleaks/gitleaks
rev: v8.30.0
hooks:
Expand Down
4 changes: 2 additions & 2 deletions docs/scripts/doc_macros.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def get_python_version() -> str:
version: str

try:
with open(PYTHON_VERSION_FILE, "r") as py_ver:
with open(PYTHON_VERSION_FILE) as py_ver:
version = py_ver.read()

if not valid_semver(version):
Expand All @@ -74,7 +74,7 @@ def get_node_version() -> str:
version: str

try:
with open(NVM_VERSION_FILE, "r") as nvm_ver:
with open(NVM_VERSION_FILE) as nvm_ver:
version = nvm_ver.read()

# Node version is usually in the format of "vX.X.X"
Expand Down
4 changes: 1 addition & 3 deletions hypha/apply/activity/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ def has_add_permission(self, request, obj):
return False


@admin.register(Event)
class EventAdmin(admin.ModelAdmin):
list_display = ("type", "by", "when", "source")
list_filter = ("type", "when")
Expand All @@ -23,6 +24,3 @@ def has_add_permission(self, request):

def has_delete_permission(self, *args):
return False


admin.site.register(Event, EventAdmin)
2 changes: 0 additions & 2 deletions hypha/apply/activity/migrations/0001_initial.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.11.8 on 2018-02-28 11:03
from __future__ import unicode_literals

from django.conf import settings
from django.db import migrations, models
Expand Down
2 changes: 0 additions & 2 deletions hypha/apply/activity/migrations/0002_activity_type.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.11.8 on 2018-03-01 15:49
from __future__ import unicode_literals

from django.db import migrations, models

Expand Down
2 changes: 0 additions & 2 deletions hypha/apply/activity/migrations/0003_activity_visibility.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.11.8 on 2018-03-06 11:52
from __future__ import unicode_literals

from django.db import migrations, models

Expand Down
2 changes: 1 addition & 1 deletion hypha/apply/activity/tests/test_messaging.py
Original file line number Diff line number Diff line change
Expand Up @@ -749,7 +749,7 @@ def test_activity_lead_change_from_none(self):
)
self.assertEqual(Activity.objects.count(), 1)
activity = Activity.objects.first()
self.assertIn(str("Unassigned"), activity.message)
self.assertIn("Unassigned", activity.message)
self.assertIn(str(project.lead), activity.message)

def test_activity_created(self):
Expand Down
2 changes: 0 additions & 2 deletions hypha/apply/categories/migrations/0001_initial.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.11.8 on 2018-01-09 17:52
from __future__ import unicode_literals

from django.db import migrations, models
import django.db.models.deletion
Expand Down
6 changes: 2 additions & 4 deletions hypha/apply/funds/admin_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,8 @@ def custom_admin_round_copy_view(request, page):
messages.info(
request,
_(
(
"Please select the date in the copied page. "
"Newly copied pages have NONE value for the start and end date"
)
"Please select the date in the copied page. "
"Newly copied pages have NONE value for the start and end date"
),
)

Expand Down
2 changes: 0 additions & 2 deletions hypha/apply/funds/migrations/0001_initial.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.11.7 on 2017-12-22 09:28
from __future__ import unicode_literals

from django.db import migrations, models
import django.db.models.deletion
Expand Down
2 changes: 0 additions & 2 deletions hypha/apply/funds/migrations/0002_fundpage_workflow.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.11.7 on 2017-12-22 10:12
from __future__ import unicode_literals

from django.db import migrations, models

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.11.7 on 2018-01-04 11:42
from __future__ import unicode_literals

from django.db import migrations, models
import django.db.models.deletion
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.11.8 on 2018-01-17 11:54
from __future__ import unicode_literals

from django.db import migrations
import hypha.apply.categories.blocks
Expand Down
2 changes: 0 additions & 2 deletions hypha/apply/funds/migrations/0005_applicationsubmission.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.11.8 on 2018-01-22 09:40
from __future__ import unicode_literals

import django.contrib.postgres.fields.jsonb
from django.db import migrations, models
Expand Down
2 changes: 0 additions & 2 deletions hypha/apply/funds/migrations/0006_update_block_definitions.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.11.8 on 2018-01-23 15:18
from __future__ import unicode_literals

from django.db import migrations
import hypha.apply.categories.blocks
Expand Down
2 changes: 0 additions & 2 deletions hypha/apply/funds/migrations/0007_round.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.11.8 on 2018-01-18 15:59
from __future__ import unicode_literals

from django.db import migrations, models
import django.db.models.deletion
Expand Down
2 changes: 0 additions & 2 deletions hypha/apply/funds/migrations/0008_add_date_to_round.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.11.8 on 2018-01-18 16:24
from __future__ import unicode_literals

import datetime
from django.db import migrations, models
Expand Down
2 changes: 0 additions & 2 deletions hypha/apply/funds/migrations/0009_update_date_fields.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.11.8 on 2018-01-19 11:30
from __future__ import unicode_literals

import datetime
from django.db import migrations, models
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.11.8 on 2018-01-24 15:00
from __future__ import unicode_literals

from django.db import migrations
import hypha.apply.categories.blocks
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.11.8 on 2018-01-24 22:09
from __future__ import unicode_literals

import django.contrib.postgres.fields.jsonb
import django.core.serializers.json
Expand Down
2 changes: 0 additions & 2 deletions hypha/apply/funds/migrations/0012_create_lab_models.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.11.8 on 2018-01-25 12:09
from __future__ import unicode_literals

from django.db import migrations, models
import django.db.models.deletion
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.11.8 on 2018-01-25 12:28
from __future__ import unicode_literals

from django.db import migrations, models
import django.db.models.deletion
Expand Down
2 changes: 0 additions & 2 deletions hypha/apply/funds/migrations/0014_add_meta_names.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.11.8 on 2018-01-25 13:08
from __future__ import unicode_literals

from django.db import migrations

Expand Down
2 changes: 0 additions & 2 deletions hypha/apply/funds/migrations/0015_link_user_to_application.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.11.8 on 2018-02-01 16:45
from __future__ import unicode_literals

from django.conf import settings
from django.db import migrations, models
Expand Down
2 changes: 0 additions & 2 deletions hypha/apply/funds/migrations/0016_roundform.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.11.8 on 2018-02-07 11:48
from __future__ import unicode_literals

from django.db import migrations, models
import django.db.models.deletion
Expand Down
2 changes: 0 additions & 2 deletions hypha/apply/funds/migrations/0017_round_workflow.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.11.8 on 2018-02-08 07:58
from __future__ import unicode_literals

from django.db import migrations, models

Expand Down
2 changes: 0 additions & 2 deletions hypha/apply/funds/migrations/0018_add_addressfield.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.11.8 on 2018-02-05 11:53
from __future__ import unicode_literals

from django.db import migrations
import hypha.apply.categories.blocks
Expand Down
2 changes: 0 additions & 2 deletions hypha/apply/funds/migrations/0019_protect_submission.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.11.8 on 2018-02-08 15:52
from __future__ import unicode_literals

from django.db import migrations, models
import django.db.models.deletion
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.11.8 on 2018-02-14 11:29
from __future__ import unicode_literals

from django.db import migrations, models

Expand Down
2 changes: 0 additions & 2 deletions hypha/apply/funds/migrations/0021_rename_workflow_field.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.11.8 on 2018-02-14 11:41
from __future__ import unicode_literals

from django.db import migrations, models

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.11.8 on 2018-02-13 15:10
from __future__ import unicode_literals

from django.db import migrations
import hypha.apply.categories.blocks
Expand Down
2 changes: 0 additions & 2 deletions hypha/apply/funds/migrations/0023_round_lead.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.11.8 on 2018-02-14 17:21
from __future__ import unicode_literals

from django.conf import settings
from django.db import migrations, models
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.11.8 on 2018-02-16 16:29
from __future__ import unicode_literals

from django.db import migrations, models

Expand Down
2 changes: 0 additions & 2 deletions hypha/apply/funds/migrations/0025_update_with_file_blocks.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.11.8 on 2018-02-21 15:14
from __future__ import unicode_literals

from django.db import migrations
import hypha.apply.categories.blocks
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.11.8 on 2018-03-02 17:08
from __future__ import unicode_literals

from django.conf import settings
from django.db import migrations, models
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.11.8 on 2018-03-08 11:02
from __future__ import unicode_literals

from django.db import migrations, models

Expand Down
4 changes: 2 additions & 2 deletions hypha/apply/funds/models/applications.py
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ def serve(self, request):
# Manually do what the login_required decorator does so that we can check settings
if not request.user.is_authenticated and settings.FORCE_LOGIN_FOR_APPLICATION:
return redirect(
"%s?next=%s" % (settings.WAGTAIL_FRONTEND_LOGIN_URL, request.path)
"{}?next={}".format(settings.WAGTAIL_FRONTEND_LOGIN_URL, request.path)
)

if hasattr(request, "is_preview") or not self.open_round:
Expand Down Expand Up @@ -739,7 +739,7 @@ def serve(self, request, *args, **kwargs):
# Manually do what the login_required decorator does so that we can check settings
if not request.user.is_authenticated and settings.FORCE_LOGIN_FOR_APPLICATION:
return redirect(
"%s?next=%s" % (settings.WAGTAIL_FRONTEND_LOGIN_URL, request.path)
"{}?next={}".format(settings.WAGTAIL_FRONTEND_LOGIN_URL, request.path)
)

if request.method == "POST":
Expand Down
6 changes: 3 additions & 3 deletions hypha/apply/funds/models/co_applicants.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,11 @@ class CoApplicantInvite(models.Model):
status = models.CharField(
_("status"),
max_length=20,
choices=CoApplicantInviteStatus.choices,
choices=CoApplicantInviteStatus,
default=CoApplicantInviteStatus.PENDING,
)
role = models.CharField(
_("role"), choices=CoApplicantRole.choices, default=CoApplicantRole.VIEW
_("role"), choices=CoApplicantRole, default=CoApplicantRole.VIEW
)
project_permission = models.JSONField(blank=True, null=True, default=list)
responded_on = models.DateTimeField(blank=True, null=True)
Expand Down Expand Up @@ -80,7 +80,7 @@ class CoApplicant(models.Model):
CoApplicantInvite, on_delete=models.CASCADE, related_name="co_applicant"
)
role = models.CharField(
_("role"), choices=CoApplicantRole.choices, default=CoApplicantRole.VIEW
_("role"), choices=CoApplicantRole, default=CoApplicantRole.VIEW
)
project_permission = models.JSONField(blank=True, null=True, default=list)
created_at = models.DateTimeField(auto_now_add=True, null=True)
Expand Down
8 changes: 2 additions & 6 deletions hypha/apply/funds/tables.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,9 +115,7 @@ def order_last_update(self, qs, desc):
return qs, True

def get_column_class_names(self, classes_set, bound_column):
classes_set = super(SubmissionsTable, self).get_column_class_names(
classes_set, bound_column
)
classes_set = super().get_column_class_names(classes_set, bound_column)
classes_set.add(bound_column.name)
return classes_set

Expand Down Expand Up @@ -445,9 +443,7 @@ def order_progress(self, qs, desc):
return qs.order_by(self._field_order("progress", desc)), True

def get_column_class_names(self, classes_set, bound_column):
classes_set = super(RoundsTable, self).get_column_class_names(
classes_set, bound_column
)
classes_set = super().get_column_class_names(classes_set, bound_column)
classes_set.add(bound_column.name)
return classes_set

Expand Down
4 changes: 2 additions & 2 deletions hypha/apply/funds/views/co_applicants.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def dispatch(self, request, *args, **kwargs):
if not permission:
messages.warning(self.request, reason)
return HttpResponseRedirect(self.submission.get_absolute_url())
return super(CoApplicantInviteView, self).dispatch(request, *args, **kwargs)
return super().dispatch(request, *args, **kwargs)

def get(self, *args, **kwargs):
invite_form = InviteCoApplicantForm(
Expand Down Expand Up @@ -211,7 +211,7 @@ def dispatch(self, request, *args, **kwargs):
object=self.invite,
raise_exception=True,
)
return super(EditCoApplicantView, self).dispatch(request, *args, **kwargs)
return super().dispatch(request, *args, **kwargs)

def get(self, request, *args, **kwargs):
if self.invite.status == CoApplicantInviteStatus.ACCEPTED:
Expand Down
2 changes: 1 addition & 1 deletion hypha/apply/funds/views/reminders.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def dispatch(self, request, *args, **kwargs):
if not permission:
messages.warning(self.request, reason)
return HttpResponseRedirect(self.submission.get_absolute_url())
return super(ReminderCreateView, self).dispatch(request, *args, **kwargs)
return super().dispatch(request, *args, **kwargs)

def get(self, *args, **kwargs):
reminder_form = CreateReminderForm(instance=self.submission)
Expand Down
Loading