From 44117fb0e2426004b449d990e7ee0aba3f93b4b5 Mon Sep 17 00:00:00 2001 From: Place Jean-Marie Date: Fri, 17 Sep 2021 10:26:20 +0200 Subject: [PATCH] blackify + suppress cr-at-eol --- app/scodoc/sco_excel.py | 59 +++++++++++++++++++------------------ app/scodoc/sco_placement.py | 2 +- 2 files changed, 31 insertions(+), 30 deletions(-) diff --git a/app/scodoc/sco_excel.py b/app/scodoc/sco_excel.py index 52e41cc21..b6f0b873e 100644 --- a/app/scodoc/sco_excel.py +++ b/app/scodoc/sco_excel.py @@ -68,18 +68,19 @@ class COLORS(Enum): def send_from_flask(data, filename, mime=scu.XLSX_MIMETYPE): filename = scu.make_filename(filename) response = make_response(data) - response.headers['Content-Type'] = mime - response.headers['Content-Disposition'] = 'attachment; filename="%s"' % filename + response.headers["Content-Type"] = mime + response.headers["Content-Disposition"] = 'attachment; filename="%s"' % filename return response + def send_excel_file(request, data, filename, mime=scu.XLSX_MIMETYPE): """publication fichier. (on ne doit rien avoir émis avant, car ici sont générés les entetes) """ filename = ( scu.unescape_html(scu.suppress_accents(filename)) - .replace("&", "") - .replace(" ", "_") + .replace("&", "") + .replace(" ", "_") ) request.RESPONSE.setHeader("content-type", mime) request.RESPONSE.setHeader( @@ -144,16 +145,16 @@ class ScoExcelBook: def excel_make_style( - bold=False, - italic=False, - outline=False, - color: COLORS = COLORS.BLACK, - bgcolor: COLORS = None, - halign=None, - valign=None, - number_format=None, - font_name="Arial", - size=10, + bold=False, + italic=False, + outline=False, + color: COLORS = COLORS.BLACK, + bgcolor: COLORS = None, + halign=None, + valign=None, + number_format=None, + font_name="Arial", + size=10, ): """Contruit un style. Les couleurs peuvent être spécfiées soit par une valeur de COLORS, @@ -236,12 +237,12 @@ class ScoExcelSheet: self.row_dimensions = {} def excel_make_composite_style( - self, - alignment=None, - border=None, - fill=None, - number_format=None, - font=None, + self, + alignment=None, + border=None, + fill=None, + number_format=None, + font=None, ): style = {} if font is not None: @@ -384,7 +385,7 @@ class ScoExcelSheet: 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""" ws = ScoExcelSheet(sheet_name) @@ -653,13 +654,13 @@ def _excel_to_list(filelike): # we may need 'encoding' argument ? def excel_feuille_listeappel( - sem, - groupname, - lines, - partitions=None, - with_codes=False, - with_paiement=False, - server_name=None, + sem, + groupname, + lines, + partitions=None, + with_codes=False, + with_paiement=False, + server_name=None, ): """generation feuille appel""" if partitions is None: @@ -761,7 +762,7 @@ def excel_feuille_listeappel( for t in lines: n += 1 nomprenom = ( - t["civilite_str"] + " " + t["nom"] + " " + t["prenom"].lower().capitalize() + t["civilite_str"] + " " + t["nom"] + " " + t["prenom"].lower().capitalize() ) style_nom = style2t3 if with_paiement: diff --git a/app/scodoc/sco_placement.py b/app/scodoc/sco_placement.py index acc888ee2..763a7b675 100644 --- a/app/scodoc/sco_placement.py +++ b/app/scodoc/sco_placement.py @@ -599,7 +599,7 @@ class PlacementRunner: ws0.set_column_dimension_width("A", 750 * column_width_ratio) for col in range(nb_rangs): ws0.set_column_dimension_width( - "ABCDEFGHIJKLMNOPQRSTUVWXYZ"[col + 1: col + 2], width + "ABCDEFGHIJKLMNOPQRSTUVWXYZ"[col + 1 : col + 2], width ) SheetName1 = "Positions"