Commit 0888a49e authored by Etienne Nadji's avatar Etienne Nadji
Browse files

common: Black reformat

	modifié :         math.py
	modifié :         xml.py
parent 4bdb67b6
......@@ -30,7 +30,7 @@ import enum
__author__ = "Etienne Nadji <etnadji@eml.cc>"
# 1 pica point = 25,4/72 milimeters
PICA_TO_MM = (25.4 / 72)
PICA_TO_MM = 25.4 / 72
INCH_TO_MM = 25.4
......@@ -45,8 +45,9 @@ class FloatEnum(enum.Enum):
def __float__(self):
if isinstance(self.value, float):
return self.value
else:
return float(self.value)
return float(self.value)
# Fonctions =============================================================#
......@@ -63,8 +64,8 @@ def necessary_float(f: float):
if float(f) == int(f):
return int(f)
else:
return float(f)
return float(f)
def mm(milimeters):
......@@ -77,4 +78,5 @@ def mm(milimeters):
return float(milimeters) / PICA_TO_MM
# vim:set shiftwidth=4 softtabstop=4:
......@@ -54,7 +54,7 @@ alignment = {
"center": "1",
"right": "2",
"justify-left": "3",
"justify": "4"
"justify": "4",
}
# Classes ===============================================================#
......@@ -235,6 +235,7 @@ class OrphanElement(PyScribusElement):
def __str__(self):
return "<{}/>".format(self.tag)
# Fonctions =============================================================#
# NOTE
......@@ -264,8 +265,8 @@ def float_or_int_string(f):
if float(f) == int(f):
return str(int(f))
else:
return str(f)
return str(f)
def str_or_nonestr(v: str):
......@@ -277,8 +278,8 @@ def str_or_nonestr(v: str):
if v:
return v
else:
return "None"
return "None"
def bool_to_num(b: bool):
......@@ -287,11 +288,7 @@ def bool_to_num(b: bool):
:rtype: str
"""
if b:
return "1"
else:
return "0"
return {True: "1", False: "0"}[bool(b)]
def bool_or_else_to_num(b):
......@@ -303,8 +300,8 @@ def bool_or_else_to_num(b):
if b:
return str(b)
else:
return "0"
return "0"
def none_or_str(v):
......@@ -316,8 +313,9 @@ def none_or_str(v):
if v is None:
return ""
else:
return str(v)
return str(v)
# From XML to PyScribus ========================================#
......@@ -328,11 +326,8 @@ def num_to_bool(n: str):
:rtype: bool
"""
return n == "1"
if n == "1":
return True
else:
return False
# Undocumented attributes ======================================#
......@@ -368,7 +363,8 @@ def undocumented_to_python(xml: ET._Element, attributes: list):
def undocumented_to_xml(
xml: ET._Element, undocumented: dict, no_none: bool = False):
xml: ET._Element, undocumented: dict, no_none: bool = False
):
"""
Function to manage the export of undocumented
XML/SLA attributes.
......@@ -440,8 +436,13 @@ def all_undocumented_to_python(xml: ET._Element):
def all_undocumented_to_xml(
xml: ET._Element, undocumented: dict,
report: bool = True, msg: str = "", passattr: list = [], logger=False):
xml: ET._Element,
undocumented: dict,
report: bool = True,
msg: str = "",
passattr: list = [],
logger=False,
):
"""
Function to manage the export of undocumented
XML/SLA attributes.
......@@ -500,4 +501,5 @@ def all_undocumented_to_xml(
return [xml, undoc_attribs]
# vim:set shiftwidth=4 softtabstop=4 spl=en:
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment