Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 76bf129

Browse files
Reformat code according to black code style
1 parent e5bc174 commit 76bf129

38 files changed

+364
-304
lines changed

‎.fussyfox.yml‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
- bandit
2+
- black
23
- flake8
34
- isort
45
- pydocstyle

‎docs/conf.py‎

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,30 +6,32 @@
66
from pkg_resources import get_distribution
77

88
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "tests.testapp.settings")
9-
sys.path.insert(0, os.path.abspath('..'))
9+
sys.path.insert(0, os.path.abspath(".."))
1010
django.setup()
1111

1212
project = "Django Mail Auth"
1313
copyright = "2019, Johannes Hoppe"
14-
release = get_distribution('django-mail-auth').version
15-
version = '.'.join(release.split('.')[:2])
14+
release = get_distribution("django-mail-auth").version
15+
version = ".".join(release.split(".")[:2])
1616

17-
master_doc = 'index'
17+
master_doc = "index"
1818

1919
extensions = [
20-
'sphinx.ext.autodoc',
21-
'sphinx.ext.napoleon',
22-
'sphinx.ext.intersphinx',
23-
'sphinx.ext.doctest',
20+
"sphinx.ext.autodoc",
21+
"sphinx.ext.napoleon",
22+
"sphinx.ext.intersphinx",
23+
"sphinx.ext.doctest",
2424
]
2525

2626
intersphinx_mapping = {
27-
'python': ('https://docs.python.org/3', None),
28-
'django': ('https://docs.djangoproject.com/en/stable/',
29-
'https://docs.djangoproject.com/en/stable/_objects/'),
27+
"python": ("https://docs.python.org/3", None),
28+
"django": (
29+
"https://docs.djangoproject.com/en/stable/",
30+
"https://docs.djangoproject.com/en/stable/_objects/",
31+
),
3032
}
3133

3234

3335
autodoc_default_options = {
34-
'show-inheritance': True,
36+
"show-inheritance": True,
3537
}

‎mailauth/backends.py‎

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ class MailAuthBackend(ModelBackend):
1515
signer = signing.UserSigner()
1616

1717
def authenticate(self, request, token=None):
18-
max_age = getattr(settings, 'LOGIN_URL_TIMEOUT', 60 * 15)
19-
single_use = getattr(settings, 'LOGIN_TOKEN_SINGLE_USE', True)
18+
max_age = getattr(settings, "LOGIN_URL_TIMEOUT", 60 * 15)
19+
single_use = getattr(settings, "LOGIN_TOKEN_SINGLE_USE", True)
2020

2121
try:
2222
user = self.signer.unsign(token, max_age=max_age, single_use=single_use)
@@ -44,7 +44,4 @@ def get_token(cls, user):
4444

4545
@staticmethod
4646
def get_login_url(token):
47-
return reverse(
48-
'mailauth:login-token',
49-
kwargs={'token': token}
50-
)
47+
return reverse("mailauth:login-token", kwargs={"token": token})

‎mailauth/contrib/admin/__init__.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
default_app_config = 'mailauth.contrib.admin.apps.MailAuthAdmin'
1+
default_app_config = "mailauth.contrib.admin.apps.MailAuthAdmin"

‎mailauth/contrib/admin/apps.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22

33

44
class MailAuthAdmin(AppConfig):
5-
name = 'mailauth.contrib.admin'
6-
label = 'mailauth_admin'
5+
name = "mailauth.contrib.admin"
6+
label = "mailauth_admin"

‎mailauth/contrib/admin/views.py‎

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,24 @@
66

77

88
class AdminLoginView(LoginView):
9-
template_name = 'mailauth_admin/login.html'
9+
template_name = "mailauth_admin/login.html"
1010
site = None
1111

1212
def get_context_data(self, **kwargs):
1313
context = super().get_context_data(**kwargs)
14-
context.update({
15-
**self.site.each_context(self.request),
16-
'title': _('Log in'),
17-
'app_path': self.request.get_full_path(),
18-
'username': self.request.user.get_username(),
19-
})
20-
if (REDIRECT_FIELD_NAME not in self.request.GET and
21-
REDIRECT_FIELD_NAME not in self.request.POST):
14+
context.update(
15+
{
16+
**self.site.each_context(self.request),
17+
"title": _("Log in"),
18+
"app_path": self.request.get_full_path(),
19+
"username": self.request.user.get_username(),
20+
}
21+
)
22+
if (
23+
REDIRECT_FIELD_NAME not in self.request.GET
24+
and REDIRECT_FIELD_NAME not in self.request.POST
25+
):
2226
context[REDIRECT_FIELD_NAME] = reverse(
23-
'admin:index', current_app=self.site.name
27+
"admin:index", current_app=self.site.name
2428
)
2529
return context

‎mailauth/contrib/user/__init__.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
default_app_config = 'mailauth.contrib.user.apps.AuthConfig'
1+
default_app_config = "mailauth.contrib.user.apps.AuthConfig"

‎mailauth/contrib/user/admin.py‎

Lines changed: 23 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -6,22 +6,29 @@
66

77
@admin.register(models.EmailUser)
88
class EmailUserAdmin(admin.ModelAdmin):
9-
app_label = 'asdf'
10-
list_display = ('email', 'first_name', 'last_name', 'is_staff')
11-
list_filter = ('is_staff', 'is_superuser', 'is_active', 'groups')
12-
search_fields = ('first_name', 'last_name', 'email')
13-
ordering = ('email',)
14-
filter_horizontal = ('groups', 'user_permissions',)
9+
app_label = "asdf"
10+
list_display = ("email", "first_name", "last_name", "is_staff")
11+
list_filter = ("is_staff", "is_superuser", "is_active", "groups")
12+
search_fields = ("first_name", "last_name", "email")
13+
ordering = ("email",)
14+
filter_horizontal = (
15+
"groups",
16+
"user_permissions",
17+
)
1518

1619
fieldsets = (
17-
(None, {
18-
'fields': (('email', 'is_active'), ('first_name', 'last_name'))
19-
}),
20-
(Group._meta.verbose_name_plural, {
21-
'fields': ('groups',),
22-
}),
23-
(Permission._meta.verbose_name_plural, {
24-
'classes': ('collapse',),
25-
'fields': (('is_staff', 'is_superuser'), 'user_permissions'),
26-
}),
20+
(None, {"fields": (("email", "is_active"), ("first_name", "last_name"))}),
21+
(
22+
Group._meta.verbose_name_plural,
23+
{
24+
"fields": ("groups",),
25+
},
26+
),
27+
(
28+
Permission._meta.verbose_name_plural,
29+
{
30+
"classes": ("collapse",),
31+
"fields": (("is_staff", "is_superuser"), "user_permissions"),
32+
},
33+
),
2734
)

‎mailauth/contrib/user/apps.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22

33

44
class AuthConfig(AppConfig):
5-
name = 'mailauth.contrib.user'
6-
label = 'mailauth_user'
5+
name = "mailauth.contrib.user"
6+
label = "mailauth_user"

‎mailauth/contrib/user/migrations/0001_initial.py‎

Lines changed: 95 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -11,33 +11,110 @@ class Migration(migrations.Migration):
1111
initial = True
1212

1313
dependencies = [
14-
('auth', '0006_require_contenttypes_0002'),
14+
("auth", "0006_require_contenttypes_0002"),
1515
]
1616

1717
operations = [
1818
migrations.CreateModel(
19-
name='EmailUser',
19+
name="EmailUser",
2020
fields=[
21-
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
22-
('last_login', models.DateTimeField(blank=True, null=True, verbose_name='last login')),
23-
('is_superuser', models.BooleanField(default=False, help_text='Designates that this user has all permissions without explicitly assigning them.', verbose_name='superuser status')),
24-
('first_name', models.CharField(blank=True, max_length=30, verbose_name='first name')),
25-
('last_name', models.CharField(blank=True, max_length=150, verbose_name='last name')),
26-
('is_staff', models.BooleanField(default=False, help_text='Designates whether the user can log into this admin site.', verbose_name='staff status')),
27-
('is_active', models.BooleanField(default=True, help_text='Designates whether this user should be treated as active. Unselect this instead of deleting accounts.', verbose_name='active')),
28-
('date_joined', models.DateTimeField(default=django.utils.timezone.now, verbose_name='date joined')),
29-
('email', models.EmailField(db_index=True, max_length=254, unique=True, verbose_name='email address')),
30-
('groups', models.ManyToManyField(blank=True, help_text='The groups this user belongs to. A user will get all permissions granted to each of their groups.', related_name='user_set', related_query_name='user', to='auth.Group', verbose_name='groups')),
31-
('user_permissions', models.ManyToManyField(blank=True, help_text='Specific permissions for this user.', related_name='user_set', related_query_name='user', to='auth.Permission', verbose_name='user permissions')),
21+
(
22+
"id",
23+
models.AutoField(
24+
auto_created=True,
25+
primary_key=True,
26+
serialize=False,
27+
verbose_name="ID",
28+
),
29+
),
30+
(
31+
"last_login",
32+
models.DateTimeField(
33+
blank=True, null=True, verbose_name="last login"
34+
),
35+
),
36+
(
37+
"is_superuser",
38+
models.BooleanField(
39+
default=False,
40+
help_text="Designates that this user has all permissions without explicitly assigning them.",
41+
verbose_name="superuser status",
42+
),
43+
),
44+
(
45+
"first_name",
46+
models.CharField(
47+
blank=True, max_length=30, verbose_name="first name"
48+
),
49+
),
50+
(
51+
"last_name",
52+
models.CharField(
53+
blank=True, max_length=150, verbose_name="last name"
54+
),
55+
),
56+
(
57+
"is_staff",
58+
models.BooleanField(
59+
default=False,
60+
help_text="Designates whether the user can log into this admin site.",
61+
verbose_name="staff status",
62+
),
63+
),
64+
(
65+
"is_active",
66+
models.BooleanField(
67+
default=True,
68+
help_text="Designates whether this user should be treated as active. Unselect this instead of deleting accounts.",
69+
verbose_name="active",
70+
),
71+
),
72+
(
73+
"date_joined",
74+
models.DateTimeField(
75+
default=django.utils.timezone.now, verbose_name="date joined"
76+
),
77+
),
78+
(
79+
"email",
80+
models.EmailField(
81+
db_index=True,
82+
max_length=254,
83+
unique=True,
84+
verbose_name="email address",
85+
),
86+
),
87+
(
88+
"groups",
89+
models.ManyToManyField(
90+
blank=True,
91+
help_text="The groups this user belongs to. A user will get all permissions granted to each of their groups.",
92+
related_name="user_set",
93+
related_query_name="user",
94+
to="auth.Group",
95+
verbose_name="groups",
96+
),
97+
),
98+
(
99+
"user_permissions",
100+
models.ManyToManyField(
101+
blank=True,
102+
help_text="Specific permissions for this user.",
103+
related_name="user_set",
104+
related_query_name="user",
105+
to="auth.Permission",
106+
verbose_name="user permissions",
107+
),
108+
),
32109
],
33110
options={
34-
'verbose_name': 'user',
35-
'verbose_name_plural': 'users',
36-
'abstract': False,
37-
'swappable': 'AUTH_USER_MODEL',
111+
"verbose_name": "user",
112+
"verbose_name_plural": "users",
113+
"abstract": False,
114+
"swappable": "AUTH_USER_MODEL",
38115
},
39116
managers=[
40-
('objects', mailauth.contrib.user.models.EmailUserManager()),
117+
("objects", mailauth.contrib.user.models.EmailUserManager()),
41118
],
42119
),
43120
]

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /