From d8b64c4f1367e21ffea0c68d987e22480f5e8899 Mon Sep 17 00:00:00 2001 From: lassulus Date: Fri, 28 Jan 2022 23:13:07 +0100 Subject: krebsdance: make flake8 happy --- krebs/5pkgs/simple/krebsdance/default.nix | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'krebs/5pkgs/simple/krebsdance') diff --git a/krebs/5pkgs/simple/krebsdance/default.nix b/krebs/5pkgs/simple/krebsdance/default.nix index f200625c9..cdfe23ef2 100644 --- a/krebs/5pkgs/simple/krebsdance/default.nix +++ b/krebs/5pkgs/simple/krebsdance/default.nix @@ -1,5 +1,5 @@ { writers }: -writers.writePython3Bin "krebsdance" {} '' +writers.writePython3Bin "krebsdance" { flakeIgnore = [ "E501" ]; } '' import argparse import random import itertools @@ -80,12 +80,16 @@ writers.writePython3Bin "krebsdance" {} '' yield f'{claw["up"]} {body["left"]}{eye}{mouth}{eye}{body["right"]} {claw["up"]}' + def escape_graph(text): + return text.replace("\\", "\\\\") + + def krebs_graph() -> str: - return "\n".join( - ["digraph {"] - + [f'"{krebs}"->"{generate(seed=krebs)}"' for krebs in all_krebses()] - + ["}"] - ) + return "\n".join(itertools.chain( + ["digraph {"], + [escape_graph(f'"{krebs}"->"{generate(seed=krebs)}"') for krebs in all_krebses()], + "}", + )) def generate(*, seed: str, dancing: bool = False) -> str: -- cgit v1.2.3