Commit 9a70628f authored by Guilhem Saurel's avatar Guilhem Saurel
Browse files

pyupgrade

parent 12b9ebf0
......@@ -25,3 +25,9 @@ repos:
rev: 4.0.1
hooks:
- id: flake8
- repo: https://github.com/asottile/pyupgrade
rev: v2.34.0
hooks:
- id: pyupgrade
args:
- --py37-plus
# -*- coding: utf-8 -*-
# Generated by Django 1.10.5 on 2017-02-05 23:41
from __future__ import unicode_literals
import adhesions.models
from django.conf import settings
......
# -*- coding: utf-8 -*-
# Generated by Django 1.10.5 on 2017-02-06 22:58
from __future__ import unicode_literals
from django.db import migrations
......
# -*- coding: utf-8 -*-
# Generated by Django 1.10.5 on 2017-02-11 00:30
from __future__ import unicode_literals
from django.db import migrations, models
......
# -*- coding: utf-8 -*-
# Generated by Django 1.11 on 2017-05-17 21:01
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
......
# -*- coding: utf-8 -*-
# Generated by Django 1.11 on 2017-05-26 16:58
from __future__ import unicode_literals
from django.db import migrations, models
......
# -*- coding: utf-8 -*-
# Generated by Django 1.11.2 on 2017-06-07 21:06
from __future__ import unicode_literals
from django.db import migrations, models
......
......@@ -16,9 +16,9 @@ class ViewsTestCase(TestCase):
)
def test_auth(self):
self.assertEquals(self.client.get(reverse("login")).status_code, 200)
self.assertEquals(self.client.get(reverse("password_reset")).status_code, 200)
self.assertEquals(
self.assertEqual(self.client.get(reverse("login")).status_code, 200)
self.assertEqual(self.client.get(reverse("password_reset")).status_code, 200)
self.assertEqual(
self.client.get(reverse("password_reset_done")).status_code, 200
)
......@@ -32,9 +32,9 @@ class ViewsTestCase(TestCase):
self.assertTrue(self.client.login(username="user@example.net", password="user"))
def test_login_logout(self):
self.assertEquals(self.client.get(reverse("login")).status_code, 200)
self.assertEqual(self.client.get(reverse("login")).status_code, 200)
self.client.login(username="user", password="user")
self.assertEquals(
self.assertEqual(
self.client.get(reverse("adhesion-detail-user")).status_code, 200
)
self.assertRedirects(
......@@ -68,8 +68,8 @@ class ViewsTestCase(TestCase):
response = self.client.post(reverse("profile"), data)
self.assertRedirects(response, reverse("profile"))
user = User.objects.get(pk=user.pk) # refresh user
self.assertEquals(user.username, "user") # should not be modified
self.assertEquals(user.first_name, "first") # should not be modified
self.assertEquals(user.last_name, "last") # should not be modified
self.assertEquals(user.email, "user@example.org")
self.assertEquals(user.profile.address, "221B Baker Street")
self.assertEqual(user.username, "user") # should not be modified
self.assertEqual(user.first_name, "first") # should not be modified
self.assertEqual(user.last_name, "last") # should not be modified
self.assertEqual(user.email, "user@example.org")
self.assertEqual(user.profile.address, "221B Baker Street")
......@@ -338,15 +338,11 @@ class AdhesionAdmin(AdtSearchMixin, admin.ModelAdmin):
"=id",
"notes",
)
+ tuple("user__%s" % f for f in UserAdmin.search_fields if "adhesion" not in f)
+ tuple(
["user__%s" % f for f in UserAdmin.search_fields if "adhesion" not in f]
)
+ tuple(
[
"corporation__%s" % f
for f in CorporationAdmin.search_fields
if "adhesion" not in f
]
"corporation__%s" % f
for f in CorporationAdmin.search_fields
if "adhesion" not in f
)
)
inlines = (
......
......@@ -55,15 +55,13 @@ class Command(BaseCommand):
email = adhesion.adherent.email
if not email:
continue
self.stdout.write(
"{} - {} <{}>".format(adhesion.adherent, adhesion, email)
)
self.stdout.write(f"{adhesion.adherent} - {adhesion} <{email}>")
else:
for adhesion in adhesions.order_by("pk"):
line = "{} ({}): {}".format(
adhesion, "PM" if adhesion.is_moral() else "PP", adhesion.adherent
)
if adhesion.adherent.email:
line += ", {}".format(adhesion.adherent.email)
line += ", {:%Y-%m-%d}".format(adhesion.created)
line += f", {adhesion.adherent.email}"
line += f", {adhesion.created:%Y-%m-%d}"
self.stdout.write(line)
......@@ -161,14 +161,12 @@ class Command(BaseCommand):
)
if conn.result["result"] == 0:
self.stdout.write(
self.style.SUCCESS(
"{} imported in LDAP.".format(user.adhesion)
)
self.style.SUCCESS(f"{user.adhesion} imported in LDAP.")
)
else:
self.stdout.write(
self.style.ERROR(
"Error when importing {} in LDAP.".format(user.adhesion)
f"Error when importing {user.adhesion} in LDAP."
)
)
self.stdout.write(str(conn.result))
......@@ -33,7 +33,7 @@ class Command(BaseCommand):
attributes=ALL_ATTRIBUTES,
)
self.stdout.write(
self.style.SUCCESS("{} users founnd in LDAP.".format(len(conn.entries)))
self.style.SUCCESS(f"{len(conn.entries)} users founnd in LDAP.")
)
for ldap_user in conn.entries:
delete = False
......@@ -43,7 +43,7 @@ class Command(BaseCommand):
except Adhesion.DoesNotExist:
self.stdout.write(
self.style.ERROR(
"Adhesion ADT{} inexistante".format(ldap_user.uid.value)
f"Adhesion ADT{ldap_user.uid.value} inexistante"
)
)
delete = True
......
# -*- coding: utf-8 -*-
# Generated by Django 1.10.4 on 2016-12-30 02:58
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
......
# -*- coding: utf-8 -*-
# Generated by Django 1.10.3 on 2016-12-30 17:14
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
......@@ -28,6 +26,6 @@ class Migration(migrations.Migration):
),
migrations.AlterUniqueTogether(
name="adherent",
unique_together=set([("adherent_type", "adherent_id")]),
unique_together={("adherent_type", "adherent_id")},
),
]
# -*- coding: utf-8 -*-
# Generated by Django 1.10.4 on 2017-01-01 03:55
from __future__ import unicode_literals
from django.db import migrations, models
......
# -*- coding: utf-8 -*-
# Generated by Django 1.10 on 2017-01-10 23:40
from __future__ import unicode_literals
from django.db import migrations, models
......
# -*- coding: utf-8 -*-
# Generated by Django 1.10.5 on 2017-02-05 23:39
from __future__ import unicode_literals
from django.db import migrations
......
# -*- coding: utf-8 -*-
# Generated by Django 1.10.5 on 2017-02-11 01:34
from __future__ import unicode_literals
from django.db import migrations, models
......
# -*- coding: utf-8 -*-
# Generated by Django 1.10.5 on 2017-03-01 13:29
from __future__ import unicode_literals
from django.db import migrations
......
# -*- coding: utf-8 -*-
# Generated by Django 1.10.7 on 2017-04-15 21:07
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment