misc: import pre-commit configuration from authentic
gitea/authentic2-cut/pipeline/head This commit looks good Details

This commit is contained in:
Benjamin Dauvergne 2023-10-19 10:46:55 +02:00
parent 62a963157b
commit eac6a4be92
19 changed files with 127 additions and 126 deletions

View File

@ -5,21 +5,31 @@ repos:
rev: v4.4.0
hooks:
- id: double-quote-string-fixer
- repo: https://github.com/asottile/pyupgrade
rev: v3.3.1
hooks:
- id: pyupgrade
args: ['--keep-percent-format', '--py39-plus']
- repo: https://github.com/adamchainz/django-upgrade
rev: 1.13.0
hooks:
- id: django-upgrade
args: ['--target-version', '3.2']
- repo: https://github.com/psf/black
rev: 22.3.0
rev: 23.1.0
hooks:
- id: black
args: ['--target-version', 'py37', '--skip-string-normalization', '--line-length', '110']
args: ['--target-version', 'py39', '--skip-string-normalization', '--line-length', '110']
- repo: https://github.com/PyCQA/isort
rev: 5.12.0
hooks:
- id: isort
args: ['--profile', 'black', '--line-length', '110']
- repo: https://github.com/asottile/pyupgrade
rev: v2.20.0
- repo: https://github.com/rtts/djhtml
rev: '3.0.5'
hooks:
- id: pyupgrade
args: ['--keep-percent-format', '--py37-plus']
- id: djhtml
args: ['--tabwidth', '2']
- repo: https://git.entrouvert.org/pre-commit-debian.git
rev: v0.3
hooks:

View File

@ -14,5 +14,3 @@
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
default_app_config = 'authentic2_cut.apps.AppConfig'

View File

@ -50,7 +50,7 @@ A2_CUT_PARTNERS = [
SESSION_ENGINE = 'django.contrib.sessions.backends.cache'
# 48h pour les mails de reset de mot de passe
PASSWORD_RESET_TIMEOUT_DAYS = 2
PASSWORD_RESET_TIMEOUT = 60 * 60 * 24 * 2
A2_EMAIL_CHANGE_TOKEN_LIFETIME = 3600 * 24 * 2
ACCOUNT_ACTIVATION_DAYS = 2

View File

@ -27,7 +27,6 @@ class Command(BaseCommand):
with atomic():
validation_request = ValidationRequest.objects.create(user=user, origin=oidc_client)
for path in paths:
with open(path) as file_object:
filename = os.path.basename(path)
f = ContentFile(file_object.read(), name=filename)

View File

@ -3,7 +3,6 @@ from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]

View File

@ -3,7 +3,6 @@ from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('authentic2_cut', '0001_initial'),
]

View File

@ -3,7 +3,6 @@ from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('contenttypes', '0002_remove_content_type_name'),
migrations.swappable_dependency(settings.AUTH_USER_MODEL),

View File

@ -3,7 +3,6 @@ from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('authentic2_cut', '0003_auto_20180423_1532'),
]

View File

@ -6,7 +6,6 @@ from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('authentic2_cut', '0004_auto_20180801_1147'),
]

View File

@ -4,7 +4,6 @@ from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('authentic2_cut', '0005_auto_20200515_1616'),
]

View File

@ -15,7 +15,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import django_tables2 as tables
from django.utils.translation import ugettext_lazy as _
from django.utils.translation import gettext_lazy as _
from . import models

View File

@ -16,35 +16,35 @@
from authentic2.decorators import required
from authentic2.manager.utils import manager_login_required
from django.conf.urls import url
from django.urls import path, re_path
from . import api_views, views
urlpatterns = required(
manager_login_required,
[
url('^accounts/edit-core/$', views.edit_core, name='cut-edit-core'),
url('^accounts/edit-crown/$', views.edit_crown, name='cut-edit-crown'),
url(r'^manage/users/(?P<pk>\d+)/$', views.manager_user_detail, name='a2-manager-user-detail'),
url(
path('accounts/edit-core/', views.edit_core, name='cut-edit-core'),
path('accounts/edit-crown/', views.edit_crown, name='cut-edit-crown'),
path('manage/users/<int:pk>/', views.manager_user_detail, name='a2-manager-user-detail'),
re_path(
r'^manage/users/uuid:(?P<slug>[a-z0-9]+)/$',
views.manager_user_detail,
name='a2-manager-user-by-uuid-detail',
),
url(
r'^manage/users/(?P<pk>\d+)/edit-core/$',
path(
'manage/users/<int:pk>/edit-core/',
views.manager_user_edit_core,
name='cut-manager-user-edit-core',
),
url('^manage/validation/$', views.validation_homepage, name='cut-manager-user-validation'),
url('^manage/validation/next/$', views.next_validation, name='cut-manager-user-next-validation'),
url(r'^manage/validation/(?P<pk>\d+)/$', views.validation, name='cut-manager-user-validation'),
url(
path('manage/validation/', views.validation_homepage, name='cut-manager-user-validation'),
path('manage/validation/next/', views.next_validation, name='cut-manager-user-next-validation'),
path('manage/validation/<int:pk>/', views.validation, name='cut-manager-user-validation'),
re_path(
r'^manage/validation/attachment/(?P<pk>\d*)/(?P<filename>.*)$',
views.validation_attachment,
name='cut-manager-user-validation-attachment',
),
url(
re_path(
r'^manage/validation/attachment-thumbnail/(?P<pk>\d*)/(?P<filename>.*)$',
views.validation_attachment_thumbnail,
name='cut-manager-user-validation-attachment-thumbnail',
@ -53,6 +53,6 @@ urlpatterns = required(
)
urlpatterns += [
url('^cgu/$', views.cgu, name='cut-cgu'),
url('^api/validate/$', api_views.validate, name='api-cut-validate'),
path('cgu/', views.cgu, name='cut-cgu'),
path('api/validate/', api_views.validate, name='api-cut-validate'),
]

View File

@ -27,7 +27,7 @@ from django.core.exceptions import PermissionDenied
from django.db.transaction import atomic
from django.http import Http404, HttpResponse, HttpResponseRedirect
from django.utils.timezone import now
from django.utils.translation import ugettext_lazy as _
from django.utils.translation import gettext_lazy as _
from django.views.generic.base import TemplateView
from . import forms, models, tables, utils

View File

@ -4,7 +4,7 @@ ALLOWED_HOSTS = ['localhost']
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'ENGINE': 'django.db.backends.postgresql',
'NAME': 'authentic2-cut',
}
}

View File

@ -3,7 +3,7 @@ import uuid
import pytest
from django.contrib.auth import get_user_model
from django.utils.encoding import force_text
from django.utils.encoding import force_str
from utils import login
from authentic2_cut import models
@ -60,7 +60,7 @@ def helper_test_validation_image(glc_app, john, image_file, extension):
'external_id': external_id,
'justificatifs': [
{
'b64_content': force_text(base64.b64encode(image_file)),
'b64_content': force_str(base64.b64encode(image_file)),
}
],
},
@ -109,13 +109,13 @@ def test_many_attachments(app, admin, glc_app, john, png_file, jpeg_file, pdf_fi
'external_id': external_id,
'justificatifs': [
{
'b64_content': force_text(base64.b64encode(png_file)),
'b64_content': force_str(base64.b64encode(png_file)),
},
{
'b64_content': force_text(base64.b64encode(jpeg_file)),
'b64_content': force_str(base64.b64encode(jpeg_file)),
},
{
'b64_content': force_text(base64.b64encode(pdf_file)),
'b64_content': force_str(base64.b64encode(pdf_file)),
},
],
},