ajouter le hook double-quote-string-fixer (#79788) #2

Merged
vdeniaud merged 3 commits from wip/79788-single-quotes into main 2023-08-16 11:57:26 +02:00
4 changed files with 23 additions and 17 deletions

2
.git-blame-ignore-revs Normal file
View File

@ -0,0 +1,2 @@
# misc: apply double-quote-string-fixer (#79788)
35617254f017a1f5b0e957acfc8dd07325108a5e

View File

@ -1,6 +1,10 @@
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
- id: double-quote-string-fixer
- repo: https://github.com/asottile/pyupgrade
rev: v3.1.0
hooks:

View File

@ -40,18 +40,18 @@ from passerelle.utils.api import endpoint
from passerelle.utils.jsonresponse import APIError
GENERATE_BATCH_SCHEMA = {
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "Generate batch",
"description": "",
"type": "object",
"properties": {
"batch_date": {
"description": "Bacth date",
"type": "string",
'$schema': 'http://json-schema.org/draft-04/schema#',
'title': 'Generate batch',
'description': '',
'type': 'object',
'properties': {
'batch_date': {
'description': 'Bacth date',
'type': 'string',
},
"force": {
"description": "Force",
"type": "boolean",
'force': {
'description': 'Force',
'type': 'boolean',
},
},
}
@ -392,7 +392,7 @@ query getDossiers($demarcheNumber: Int!, $createdSince: ISO8601DateTime, $first:
with transaction.atomic():
entreprise.save()
except Exception:
self.logger.error("Partial upsert on dossier %s" % ds_dossier.pk)
self.logger.error('Partial upsert on dossier %s' % ds_dossier.pk)
return res
@ -443,7 +443,7 @@ query getDossiers($demarcheNumber: Int!, $createdSince: ISO8601DateTime, $first:
pseudo_buffer = Echo()
writer = csv.writer(pseudo_buffer)
response = FileResponse((writer.writerow(row) for row in get_rows()), content_type="text/csv")
response = FileResponse((writer.writerow(row) for row in get_rows()), content_type='text/csv')
response['Content-Disposition'] = 'attachment; filename="somefilename.csv"'
return response
@ -498,7 +498,7 @@ query getDossiers($demarcheNumber: Int!, $createdSince: ISO8601DateTime, $first:
batch_file = BatchFile.objects.get(pk=batchfile_pk)
except BatchFile.DoesNotExist:
raise APIError('Unkwon batch file identifier')
response = HttpResponse(batch_file.csv_file.read(), content_type="text/csv")
response = HttpResponse(batch_file.csv_file.read(), content_type='text/csv')
response['Content-Disposition'] = 'attachment; filename="%s"' % batch_file.csv_filename
return response
@ -588,7 +588,7 @@ query getDossiers($demarcheNumber: Int!, $createdSince: ISO8601DateTime, $first:
continue
date_raw = form['workflow']['fields']['date_avis_favorable']
if not date_raw:
raise APIError("Missing date")
raise APIError('Missing date')
date_obj = parse_date(date_raw)
if date_obj is None:
raise APIError("Can't parse date")
@ -611,7 +611,7 @@ query getDossiers($demarcheNumber: Int!, $createdSince: ISO8601DateTime, $first:
# write data
form_fields = form['fields']
workflow_fields = form['workflow']['fields']
sequence = "%s-%s" % (code_region, form['display_id'])
sequence = '%s-%s' % (code_region, form['display_id'])
period = 'MARS-VOLET2'
siren = form_fields['siren']
nom1 = (

View File

@ -8,7 +8,7 @@ DATABASES = {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'TEST': {
'NAME': 'passerelle-reunion-fsn-test-%s'
% os.environ.get("BRANCH_NAME", "").replace('/', '-')[:63],
% os.environ.get('BRANCH_NAME', '').replace('/', '-')[:63],
},
}
}