1
0
forked from ScoDoc/ScoDoc

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):
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:

View File

@ -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"