diff --git a/scripts/boxes b/scripts/boxes index 01ecff28a..71b272995 100755 --- a/scripts/boxes +++ b/scripts/boxes @@ -63,8 +63,7 @@ def run_generator(name, args): box.render() box.close() else: - msg = ('Unknown generator \'{}\'. Use boxes --list to get a list of ' - 'available commands.\n').format(name) + msg = f'Unknown generator \'{name}\'. Use boxes --list to get a list of available commands.\n' sys.stderr.write(msg) diff --git a/scripts/boxes2inkscape b/scripts/boxes2inkscape index 72b1fa746..f40719333 100755 --- a/scripts/boxes2inkscape +++ b/scripts/boxes2inkscape @@ -33,8 +33,7 @@ class Boxes2INX: self.groups_by_name = boxes.generators.ui_groups_by_name for name, box in self.boxes.items(): - self.groups_by_name.get(box.ui_group, - self.groups_by_name["Misc"]).add(box) + self.groups_by_name.get(box.ui_group, self.groups_by_name["Misc"]).add(box) def arg2inx(self, a, prefix): name = a.option_strings[0].replace("-", "") @@ -50,17 +49,15 @@ class Boxes2INX: return a.type.inx(name, viewname, a) # see boxes.__init__.py elif a.dest == "layout": return "" - val = a.default.split("\n") - input = """""" % \ - (name, max(len(l) for l in val) + 10, len(val) + 1, a.default) + # val = a.default.split("\n") + # input = f"""""" elif a.choices: uniqueChoices = [] for e in a.choices: if e not in uniqueChoices: uniqueChoices.append(e) - return (''' \n''' - % (name, viewname, quoteattr(a.help or viewname)) + - "".join(' \n' % (e, e) for e in uniqueChoices) + ' \n') + return (f'''\n''' + + "".join(f'\n' for e in uniqueChoices) + ' \n') else: default = a.default if isinstance(a.type, boxes.BoolArg): @@ -77,18 +74,18 @@ class Boxes2INX: }.get(a.type, '"string"') if t == '"int"' or t == '"float" precision="2"': - return ''' %s\n''' % (name, t, viewname, quoteattr(a.help or viewname), default) + return f'''{default}\n''' else: - return ''' %s\n''' % (name, t, viewname, quoteattr(a.help or viewname), default) + return f'''{default}\n''' def generator2inx(self, name, box): - result = [""" + result = [f""" -%s -info.festi.boxes.py.%s -%s -""" % (name, name, name.lower())] +{name} +info.festi.boxes.py.{name} +{name.lower()} +"""] groupid = 0 for group in box.argparser._action_groups: if not group._group_actions: @@ -107,32 +104,28 @@ class Boxes2INX: if self.arg2inx(a, prefix) != "": pageParams.append(self.arg2inx(a, prefix)) if len(pageParams) > 0: - result.append(""" - -""" % (groupid, title)) + result.append(f"""""") result.extend(pageParams) - result.append(" ") + result.append("\n") groupid += 1 - result.append(""" - -""" % (groupid)) - result.append(" ./" + name + "-thumb.jpg\n") - result.append(" \n") - result.append(""" - + result.append(f"""\n""") + result.append(f"""./{name}-thumb.jpg\n""") + result.append("\n") + result.append(f""" + all - + -""" % self.groups_by_name[box.ui_group].title) +""") return b''.join(s.encode("utf-8") for s in result) def writeINX(self, name, box, path): diff --git a/scripts/boxes2pot b/scripts/boxes2pot index d9d5a53c1..91599697f 100755 --- a/scripts/boxes2pot +++ b/scripts/boxes2pot @@ -65,8 +65,7 @@ class Boxes2pot: def _readEdgeDescriptions(self): for char, descr in edges.getDescriptions().items(): self.add(descr, f"{char} edge description", "boxes/edges.py") - self.add(f"{char} {descr}", f"{char} edge description", - "boxes/edges.py") + self.add(f"{char} {descr}", f"{char} edge description", "boxes/edges.py") def addBoxParams(self, name, box, location=None): for group in box.argparser._action_groups: diff --git a/scripts/boxesserver b/scripts/boxesserver index 80d6f0330..47a187523 100755 --- a/scripts/boxesserver +++ b/scripts/boxesserver @@ -657,7 +657,7 @@ class BServer: http_headers = [('Content-type', 'image/png')] http_headers.append(('X-Robots-Tag', 'noindex,nofollow')) qr_format = "png" - fn = (box.__class__.__name__) + fn = box.__class__.__name__ start_response(status, http_headers) qrcode = get_qrcode(box.metadata["url_short"], qr_format) return (qrcode,)