blackify + suppress cr-at-eol

This commit is contained in:
Jean-Marie Place 2021-09-17 10:26:20 +02:00
parent 42ef9f795f
commit 44117fb0e2
2 changed files with 31 additions and 30 deletions

View File

@ -68,18 +68,19 @@ class COLORS(Enum):
def send_from_flask(data, filename, mime=scu.XLSX_MIMETYPE): def send_from_flask(data, filename, mime=scu.XLSX_MIMETYPE):
filename = scu.make_filename(filename) filename = scu.make_filename(filename)
response = make_response(data) response = make_response(data)
response.headers['Content-Type'] = mime response.headers["Content-Type"] = mime
response.headers['Content-Disposition'] = 'attachment; filename="%s"' % filename response.headers["Content-Disposition"] = 'attachment; filename="%s"' % filename
return response return response
def send_excel_file(request, data, filename, mime=scu.XLSX_MIMETYPE): def send_excel_file(request, data, filename, mime=scu.XLSX_MIMETYPE):
"""publication fichier. """publication fichier.
(on ne doit rien avoir émis avant, car ici sont générés les entetes) (on ne doit rien avoir émis avant, car ici sont générés les entetes)
""" """
filename = ( filename = (
scu.unescape_html(scu.suppress_accents(filename)) scu.unescape_html(scu.suppress_accents(filename))
.replace("&", "") .replace("&", "")
.replace(" ", "_") .replace(" ", "_")
) )
request.RESPONSE.setHeader("content-type", mime) request.RESPONSE.setHeader("content-type", mime)
request.RESPONSE.setHeader( request.RESPONSE.setHeader(
@ -144,16 +145,16 @@ class ScoExcelBook:
def excel_make_style( def excel_make_style(
bold=False, bold=False,
italic=False, italic=False,
outline=False, outline=False,
color: COLORS = COLORS.BLACK, color: COLORS = COLORS.BLACK,
bgcolor: COLORS = None, bgcolor: COLORS = None,
halign=None, halign=None,
valign=None, valign=None,
number_format=None, number_format=None,
font_name="Arial", font_name="Arial",
size=10, size=10,
): ):
"""Contruit un style. """Contruit un style.
Les couleurs peuvent être spécfiées soit par une valeur de COLORS, Les couleurs peuvent être spécfiées soit par une valeur de COLORS,
@ -236,12 +237,12 @@ class ScoExcelSheet:
self.row_dimensions = {} self.row_dimensions = {}
def excel_make_composite_style( def excel_make_composite_style(
self, self,
alignment=None, alignment=None,
border=None, border=None,
fill=None, fill=None,
number_format=None, number_format=None,
font=None, font=None,
): ):
style = {} style = {}
if font is not None: if font is not None:
@ -384,7 +385,7 @@ class ScoExcelSheet:
def excel_simple_table( def excel_simple_table(
titles=None, lines=None, sheet_name=b"feuille", titles_styles=None, comments=None titles=None, lines=None, sheet_name=b"feuille", titles_styles=None, comments=None
): ):
"""Export simple type 'CSV': 1ere ligne en gras, le reste tel quel""" """Export simple type 'CSV': 1ere ligne en gras, le reste tel quel"""
ws = ScoExcelSheet(sheet_name) ws = ScoExcelSheet(sheet_name)
@ -653,13 +654,13 @@ def _excel_to_list(filelike): # we may need 'encoding' argument ?
def excel_feuille_listeappel( def excel_feuille_listeappel(
sem, sem,
groupname, groupname,
lines, lines,
partitions=None, partitions=None,
with_codes=False, with_codes=False,
with_paiement=False, with_paiement=False,
server_name=None, server_name=None,
): ):
"""generation feuille appel""" """generation feuille appel"""
if partitions is None: if partitions is None:
@ -761,7 +762,7 @@ def excel_feuille_listeappel(
for t in lines: for t in lines:
n += 1 n += 1
nomprenom = ( nomprenom = (
t["civilite_str"] + " " + t["nom"] + " " + t["prenom"].lower().capitalize() t["civilite_str"] + " " + t["nom"] + " " + t["prenom"].lower().capitalize()
) )
style_nom = style2t3 style_nom = style2t3
if with_paiement: if with_paiement:

View File

@ -599,7 +599,7 @@ class PlacementRunner:
ws0.set_column_dimension_width("A", 750 * column_width_ratio) ws0.set_column_dimension_width("A", 750 * column_width_ratio)
for col in range(nb_rangs): for col in range(nb_rangs):
ws0.set_column_dimension_width( ws0.set_column_dimension_width(
"ABCDEFGHIJKLMNOPQRSTUVWXYZ"[col + 1: col + 2], width "ABCDEFGHIJKLMNOPQRSTUVWXYZ"[col + 1 : col + 2], width
) )
SheetName1 = "Positions" SheetName1 = "Positions"