pyupgrade and prettifier doing their job

This commit is contained in:
Oliver Falk
2025-10-22 14:05:44 +02:00
parent b4f224cd4d
commit d9c3c512f4
68 changed files with 365 additions and 375 deletions

View File

@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
"""
Configuration overrides for settings.py
"""

View File

@@ -1,3 +1,2 @@
# -*- coding: utf-8 -*-
# Test configuration to verify LOGS_DIR override
LOGS_DIR = "/tmp/ivatar_test_logs"

View File

@@ -1,5 +1,4 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Import the whole libravatar export
"""

View File

@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
"""
Module init
"""

View File

@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
"""
Default: useful variables for the base page templates.
"""

View File

@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
"""
File upload security utilities for ivatar
"""

View File

@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
"""
Module init
"""
app_label = __name__ # pylint: disable=invalid-name

View File

@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
"""
Register models in admin
"""
from django.contrib import admin
from .models import Photo, ConfirmedEmail, UnconfirmedEmail

View File

@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
from social_core.backends.open_id_connect import OpenIdConnectAuth
from ivatar.ivataraccount.models import ConfirmedEmail, Photo

View File

@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
"""
Classes for our ivatar.ivataraccount.forms
"""
from urllib.parse import urlsplit, urlunsplit
from django import forms

View File

@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
"""
Helper method to fetch Gravatar image
"""
from ssl import SSLError
from urllib.request import HTTPError, URLError
from ivatar.utils import urlopen

View File

@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
# Generated by Django 2.0.5 on 2018-05-07 07:13
from django.conf import settings

View File

@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
# Generated by Django 2.0.5 on 2018-05-07 07:23
from django.db import migrations, models

View File

@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
# Generated by Django 2.0.5 on 2018-05-08 06:37
import datetime

View File

@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
# Generated by Django 2.0.5 on 2018-05-08 07:42
from django.db import migrations, models

View File

@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
# Generated by Django 2.0.5 on 2018-05-22 11:55
from django.db import migrations, models

View File

@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
# Generated by Django 2.0.6 on 2018-06-26 14:45
from django.db import migrations, models

View File

@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
# Generated by Django 2.0.6 on 2018-06-27 06:24
from django.db import migrations, models

View File

@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
# pylint: disable=invalid-name,missing-docstring
# Generated by Django 2.0.6 on 2018-07-04 12:32

View File

@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
# Generated by Django 2.0.6 on 2018-07-05 11:52
from django.db import migrations, models

View File

@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
# Generated by Django 2.0.6 on 2018-07-05 12:01
from django.db import migrations, models

View File

@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
# Generated by Django 2.1.3 on 2018-11-07 15:50
from django.db import migrations, models

View File

@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
# Generated by Django 2.1.3 on 2018-11-07 17:32
from django.db import migrations, models

View File

@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
# Generated by Django 2.1.3 on 2018-12-03 14:21
from django.db import migrations, models

View File

@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
# Generated by Django 2.1.5 on 2019-02-18 16:02
from django.db import migrations

View File

@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
# Generated by Django 3.0.3 on 2020-02-25 09:34
from django.db import migrations, models

View File

@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
# Generated by Django 3.1.7 on 2021-04-13 09:04
from django.db import migrations, models

View File

@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
# Generated by Django 3.2.3 on 2021-05-28 13:14
from django.db import migrations, models

View File

@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
# Generated by Django 5.0 on 2024-05-31 15:00
from django.db import migrations, models

View File

@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
# Generated by Django 5.1.5 on 2025-01-27 10:54
from django.db import migrations, models

View File

@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
# Generated by Django 5.1.5 on 2025-01-27 13:33
from django.db import migrations, models

View File

@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
# Generated manually for performance optimization
from typing import Any, List, Tuple, Optional

View File

@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
"""
Our models for ivatar.ivataraccount
"""
@@ -404,7 +403,7 @@ class ConfirmedEmail(BaseAccountModel):
logger.debug("Successfully cleaned up cached page: %s" % cache_key)
except Exception as exc:
logger.warning(
"Failed to clean up cached page %s: %s" % (cache_key, exc)
"Failed to clean up cached page {}: {}".format(cache_key, exc)
)
# Invalidate Bluesky avatar URL cache if bluesky_handle changed
@@ -455,9 +454,7 @@ class UnconfirmedEmail(BaseAccountModel):
+ self.user.username.encode("utf-8") # pylint: disable=no-member
) # pylint: disable=no-member
self.verification_key = hash_object.hexdigest()
super(UnconfirmedEmail, self).save(
force_insert, force_update, using, update_fields
)
super().save(force_insert, force_update, using, update_fields)
def send_confirmation_mail(self, url=SECURE_BASE_URL):
"""
@@ -602,7 +599,7 @@ class ConfirmedOpenId(BaseAccountModel):
logger.debug("Successfully cleaned up cached page: %s" % cache_key)
except Exception as exc:
logger.warning(
"Failed to clean up cached page %s: %s" % (cache_key, exc)
"Failed to clean up cached page {}: {}".format(cache_key, exc)
)
# Invalidate Bluesky avatar URL cache if bluesky_handle exists

View File

@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
"""
Reading libravatar export
"""

View File

@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
from unittest import mock
from django.test import TestCase

View File

@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
"""
Test our views in ivatar.ivataraccount.views and ivatar.views
"""
@@ -53,9 +52,9 @@ class Tester(TestCase): # pylint: disable=too-many-public-methods
user = None
username = random_string()
password = random_string()
email = "%s@%s.org" % (username, random_string())
email = "{}@{}.org".format(username, random_string())
# Dunno why random tld doesn't work, but I'm too lazy now to investigate
openid = "http://%s.%s.%s/" % (username, random_string(), "org")
openid = "http://{}.{}.{}/".format(username, random_string(), "org")
first_name = random_string()
last_name = random_string()

View File

@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
"""
Test our views in ivatar.ivataraccount.views and ivatar.views
"""
@@ -37,9 +36,9 @@ class Tester(TestCase): # pylint: disable=too-many-public-methods
user = None
username = random_string()
password = random_string()
email = "%s@%s.%s" % (username, random_string(), random_string(2))
email = "{}@{}.{}".format(username, random_string(), random_string(2))
# Dunno why random tld doesn't work, but I'm too lazy now to investigate
openid = "http://%s.%s.%s/" % (username, random_string(), "org")
openid = "http://{}.{}.{}/".format(username, random_string(), "org")
first_name = random_string()
last_name = random_string()
bsky_test_account = "libravatar.org"

View File

@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
"""
URLs for ivatar.ivataraccount
"""
from django.urls import path, re_path
from django.contrib.auth.views import LogoutView

View File

@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
"""
View classes for ivatar/ivataraccount/
"""
@@ -140,7 +139,7 @@ class PasswordSetView(SuccessMessageMixin, FormView):
success_url = reverse_lazy("profile")
def get_form_kwargs(self):
kwargs = super(PasswordSetView, self).get_form_kwargs()
kwargs = super().get_form_kwargs()
kwargs["user"] = self.request.user
return kwargs
@@ -712,7 +711,9 @@ class RemoveUnconfirmedOpenIDView(View):
)
openid.delete()
messages.success(request, _("ID removed"))
except self.model.DoesNotExist: # pragma: no cover pylint: disable=no-member,line-too-long
except (
self.model.DoesNotExist
): # pragma: no cover pylint: disable=no-member,line-too-long
messages.error(request, _("ID does not exist"))
return HttpResponseRedirect(reverse_lazy("profile"))
@@ -766,7 +767,9 @@ class RedirectOpenIDView(View):
unconfirmed = self.model.objects.get( # pylint: disable=no-member
user=request.user, id=kwargs["openid_id"]
)
except self.model.DoesNotExist: # pragma: no cover pylint: disable=no-member,line-too-long
except (
self.model.DoesNotExist
): # pragma: no cover pylint: disable=no-member,line-too-long
messages.error(request, _("ID does not exist"))
return HttpResponseRedirect(reverse_lazy("profile"))
@@ -1321,7 +1324,7 @@ class ExportView(SuccessMessageMixin, TemplateView):
def xml_account(user):
escaped_username = saxutils.quoteattr(user.username)
escaped_password = saxutils.quoteattr(user.password)
return " <account username=%s password=%s/>\n" % (
return " <account username={} password={}/>\n".format(
escaped_username,
escaped_password,
)
@@ -1387,8 +1390,8 @@ class ExportView(SuccessMessageMixin, TemplateView):
bytesobj.seek(0)
response = HttpResponse(content_type="application/gzip")
response[
"Content-Disposition"
] = f'attachment; filename="libravatar-export_{user.username}.xml.gz"'
response["Content-Disposition"] = (
f'attachment; filename="libravatar-export_{user.username}.xml.gz"'
)
response.write(bytesobj.read())
return response

View File

@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
"""
Middleware classes
"""

View File

@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
"""
OpenTelemetry configuration for ivatar project.

View File

@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
"""
OpenTelemetry middleware and custom instrumentation for ivatar.
@@ -94,9 +93,9 @@ class OpenTelemetryMiddleware(MiddlewareMixin):
span.set_attributes(
{
"http.status_code": response.status_code,
"http.response_size": len(response.content)
if hasattr(response, "content")
else 0,
"http.response_size": (
len(response.content) if hasattr(response, "content") else 0
),
"http.request.duration": duration,
}
)

View File

@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
"""
Django settings for ivatar project.
"""

View File

@@ -260,7 +260,8 @@ th {
@font-face {
font-family: "Glyphicons Halflings";
src: url(../fonts/glyphicons-halflings-regular.eot);
src: url(../fonts/glyphicons-halflings-regular.eot?#iefix)
src:
url(../fonts/glyphicons-halflings-regular.eot?#iefix)
format("embedded-opentype"),
url(../fonts/glyphicons-halflings-regular.woff2) format("woff2"),
url(../fonts/glyphicons-halflings-regular.woff) format("woff"),
@@ -2651,17 +2652,24 @@ output {
border-radius: 4px;
-webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
-webkit-transition: border-color ease-in-out 0.15s,
-webkit-transition:
border-color ease-in-out 0.15s,
-webkit-box-shadow ease-in-out 0.15s;
-o-transition: border-color ease-in-out 0.15s, box-shadow ease-in-out 0.15s;
transition: border-color ease-in-out 0.15s, box-shadow ease-in-out 0.15s;
-o-transition:
border-color ease-in-out 0.15s,
box-shadow ease-in-out 0.15s;
transition:
border-color ease-in-out 0.15s,
box-shadow ease-in-out 0.15s;
}
.form-control:focus {
border-color: #66afe9;
outline: 0;
-webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075),
-webkit-box-shadow:
inset 0 1px 1px rgba(0, 0, 0, 0.075),
0 0 8px rgba(102, 175, 233, 0.6);
box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075),
box-shadow:
inset 0 1px 1px rgba(0, 0, 0, 0.075),
0 0 8px rgba(102, 175, 233, 0.6);
}
.form-control::-moz-placeholder {
@@ -2923,8 +2931,12 @@ textarea.input-lg {
}
.has-success .form-control:focus {
border-color: #2b542c;
-webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 6px #67b168;
box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 6px #67b168;
-webkit-box-shadow:
inset 0 1px 1px rgba(0, 0, 0, 0.075),
0 0 6px #67b168;
box-shadow:
inset 0 1px 1px rgba(0, 0, 0, 0.075),
0 0 6px #67b168;
}
.has-success .input-group-addon {
color: #3c763d;
@@ -2953,8 +2965,12 @@ textarea.input-lg {
}
.has-warning .form-control:focus {
border-color: #66512c;
-webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 6px #c0a16b;
box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 6px #c0a16b;
-webkit-box-shadow:
inset 0 1px 1px rgba(0, 0, 0, 0.075),
0 0 6px #c0a16b;
box-shadow:
inset 0 1px 1px rgba(0, 0, 0, 0.075),
0 0 6px #c0a16b;
}
.has-warning .input-group-addon {
color: #8a6d3b;
@@ -2983,8 +2999,12 @@ textarea.input-lg {
}
.has-error .form-control:focus {
border-color: #843534;
-webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 6px #ce8483;
box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 6px #ce8483;
-webkit-box-shadow:
inset 0 1px 1px rgba(0, 0, 0, 0.075),
0 0 6px #ce8483;
box-shadow:
inset 0 1px 1px rgba(0, 0, 0, 0.075),
0 0 6px #ce8483;
}
.has-error .input-group-addon {
color: #a94442;
@@ -4470,9 +4490,11 @@ textarea.input-group-sm > .input-group-btn > .btn {
margin-left: -15px;
border-top: 1px solid transparent;
border-bottom: 1px solid transparent;
-webkit-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1),
-webkit-box-shadow:
inset 0 1px 0 rgba(255, 255, 255, 0.1),
0 1px 0 rgba(255, 255, 255, 0.1);
box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1),
box-shadow:
inset 0 1px 0 rgba(255, 255, 255, 0.1),
0 1px 0 rgba(255, 255, 255, 0.1);
}
@media (min-width: 768px) {

View File

@@ -4,7 +4,9 @@
font-style: normal;
font-weight: 300;
src: url("../fonts/lato-v15-latin-300.eot"); /* IE9 Compat Modes */
src: local("Lato Light"), local("Lato-Light"),
src:
local("Lato Light"),
local("Lato-Light"),
url("../fonts/LatoLatin-Light.eot?#iefix") format("embedded-opentype"),
/* IE6-IE8 */ url("../fonts/LatoLatin-Light.woff2") format("woff2"),
/* Super Modern Browsers */ url("../fonts/LatoLatin-Light.woff")
@@ -19,7 +21,9 @@
font-style: normal;
font-weight: 400;
src: url("../fonts/lato-v15-latin-regular.eot"); /* IE9 Compat Modes */
src: local("Lato Regular"), local("Lato-Regular"),
src:
local("Lato Regular"),
local("Lato-Regular"),
url("../fonts/LatoLatin-Regular.eot?#iefix") format("embedded-opentype"),
/* IE6-IE8 */ url("../fonts/LatoLatin-Regular.woff2") format("woff2"),
/* Super Modern Browsers */ url("../fonts/LatoLatin-Regular.woff")
@@ -35,7 +39,9 @@
font-style: normal;
font-weight: 700;
src: url("../fonts/lato-v15-latin-700.eot"); /* IE9 Compat Modes */
src: local("Lato Bold"), local("Lato-Bold"),
src:
local("Lato Bold"),
local("Lato-Bold"),
url("../fonts/LatoLatin-Bold.eot?#iefix") format("embedded-opentype"),
/* IE6-IE8 */ url("../fonts/LatoLatin-Bold.woff2") format("woff2"),
/* Super Modern Browsers */ url("../fonts/LatoLatin-Bold.woff")
@@ -50,7 +56,9 @@
font-style: normal;
font-weight: 400;
src: url("../fonts/open-sans-v16-latin-regular.eot"); /* IE9 Compat Modes */
src: local("Open Sans Regular"), local("OpenSans-Regular"),
src:
local("Open Sans Regular"),
local("OpenSans-Regular"),
url("../fonts/open-sans-v16-latin-regular.eot?#iefix")
format("embedded-opentype"),
/* IE6-IE8 */ url("../fonts/open-sans-v16-latin-regular.woff2")

View File

@@ -12,7 +12,8 @@
? (module.exports = e())
: "function" == typeof define && define.amd
? define(e)
: ((t = "undefined" != typeof globalThis ? globalThis : t || self).Cropper =
: ((t =
"undefined" != typeof globalThis ? globalThis : t || self).Cropper =
e());
})(this, function () {
"use strict";
@@ -50,7 +51,11 @@
: Object.getOwnPropertyDescriptors
? Object.defineProperties(a, Object.getOwnPropertyDescriptors(n))
: C(Object(n)).forEach(function (t) {
Object.defineProperty(a, t, Object.getOwnPropertyDescriptor(n, t));
Object.defineProperty(
a,
t,
Object.getOwnPropertyDescriptor(n, t),
);
});
}
return a;

View File

@@ -821,9 +821,11 @@
: "$=" === r
? i && t.slice(-i.length) === i
: "~=" === r
? -1 < (" " + t.replace(v, " ") + " ").indexOf(i)
? -1 <
(" " + t.replace(v, " ") + " ").indexOf(i)
: "|=" === r &&
(t === i || t.slice(0, i.length + 1) === i + "-"));
(t === i ||
t.slice(0, i.length + 1) === i + "-"));
};
},
CHILD: function (d, e, t, h, g) {
@@ -4119,7 +4121,8 @@
: (e = kt(t)).length
? this.each(function () {
if (
((r = Ct(this)), (n = 1 === this.nodeType && " " + Tt(r) + " "))
((r = Ct(this)),
(n = 1 === this.nodeType && " " + Tt(r) + " "))
) {
for (o = 0; o < e.length; o++)
(i = e[o]), n.indexOf(" " + i + " ") < 0 && (n += i + " ");
@@ -4171,7 +4174,8 @@
this.each(function () {
if (s)
for (o = ce(this), i = 0; i < e.length; i++)
(r = e[i]), o.hasClass(r) ? o.removeClass(r) : o.addClass(r);
(r = e[i]),
o.hasClass(r) ? o.removeClass(r) : o.addClass(r);
else
(void 0 !== t && "boolean" !== a) ||
((r = Ct(this)) && _.set(this, "__className__", r),
@@ -4221,7 +4225,8 @@
(this.value = t));
}))
: t
? (r = ce.valHooks[t.type] || ce.valHooks[t.nodeName.toLowerCase()]) &&
? (r =
ce.valHooks[t.type] || ce.valHooks[t.nodeName.toLowerCase()]) &&
"get" in r &&
void 0 !== (e = r.get(t, "value"))
? e

View File

@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
"""
Test various other parts of ivatar/libravatar in order
to increase the overall test coverage. Test in here, didn't

View File

@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
"""
Tests for file upload security enhancements
"""

View File

@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
"""
Tests for OpenTelemetry integration in ivatar.

View File

@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
"""
Test our views in ivatar.ivataraccount.views and ivatar.views
"""
# pylint: disable=too-many-lines
import os
import django
@@ -25,9 +25,9 @@ class Tester(TestCase): # pylint: disable=too-many-public-methods
user = None
username = random_string()
password = random_string()
email = "%s@%s.%s" % (username, random_string(), random_string(2))
email = "{}@{}.{}".format(username, random_string(), random_string(2))
# Dunno why random tld doesn't work, but I'm too lazy now to investigate
openid = "http://%s.%s.%s/" % (username, random_string(), "org")
openid = "http://{}.{}.{}/".format(username, random_string(), "org")
def login(self):
"""

View File

@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
"""
Test our utils from ivatar.utils
"""

View File

@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
"""
Test our views in ivatar.ivataraccount.views and ivatar.views
"""
@@ -31,9 +30,9 @@ class Tester(TestCase): # pylint: disable=too-many-public-methods
user = None
username = random_string()
password = random_string()
email = "%s@%s.%s" % (username, random_string(), random_string(2))
email = "{}@{}.{}".format(username, random_string(), random_string(2))
# Dunno why random tld doesn't work, but I'm too lazy now to investigate
openid = "http://%s.%s.%s/" % (username, random_string(), "org")
openid = "http://{}.{}.{}/".format(username, random_string(), "org")
def login(self):
"""

View File

@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
"""
Test our StatsView in ivatar.views
"""

View File

@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
"""
Unit tests for WSGI
"""
import unittest
import os

View File

@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
"""
Classes for our ivatar.tools.forms
"""
from django import forms
from django.utils.translation import gettext_lazy as _
from django.core.exceptions import ValidationError

View File

@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
"""
Test our views in ivatar.ivataraccount.views and ivatar.views
"""
# pylint: disable=too-many-lines
import os
import django
@@ -28,9 +28,9 @@ class Tester(TestCase): # pylint: disable=too-many-public-methods
user = None
username = random_string()
password = random_string()
email = "%s@%s.%s" % (username, random_string(), random_string(2))
email = "{}@{}.{}".format(username, random_string(), random_string(2))
# Dunno why random tld doesn't work, but I'm too lazy now to investigate
openid = "http://%s.%s.%s/" % (username, random_string(), "org")
openid = "http://{}.{}.{}/".format(username, random_string(), "org")
def login(self):
"""

View File

@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
"""
ivatar/tools URL configuration
"""

View File

@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
"""
View classes for ivatar/tools/
"""
from socket import inet_ntop, AF_INET6
import hashlib
import random

View File

@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
"""
ivatar URL configuration
"""

View File

@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
"""
Simple module providing reusable random_string function
"""

View File

@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
"""
views under /
"""
@@ -762,9 +761,9 @@ class StatsView(TemplateView, JsonResponse):
)
retval["photo_size_stats"] = {
"average_size_bytes": round(avg_size_bytes, 2)
if avg_size_bytes
else 0,
"average_size_bytes": (
round(avg_size_bytes, 2) if avg_size_bytes else 0
),
"average_size_kb": avg_size_kb,
"average_size_mb": avg_size_mb,
"total_photos_analyzed": photo_count,
@@ -839,7 +838,7 @@ def _get_git_info_from_files():
if not path.exists(head_file):
return None
with open(head_file, "r") as f:
with open(head_file) as f:
head_content = f.read().strip()
# Parse HEAD content
@@ -851,7 +850,7 @@ def _get_git_info_from_files():
# Read the commit hash from the ref
ref_file = path.join(git_dir, branch_ref)
if path.exists(ref_file):
with open(ref_file, "r") as f:
with open(ref_file) as f:
commit_hash = f.read().strip()
else:
return None

View File

@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
"""
WSGI config for ivatar project.

View File

@@ -1,5 +1,4 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import urllib.request
import sys

View File

@@ -1,5 +1,4 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import sys

View File

@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
from setuptools import setup, find_packages
setup(