summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorlassulus <lassulus@lassul.us>2022-01-28 23:13:07 +0100
committerlassulus <lassulus@lassul.us>2022-01-28 23:13:07 +0100
commitd8b64c4f1367e21ffea0c68d987e22480f5e8899 (patch)
treebfe492778213feb7c329cb9771ca30a456673db3
parent63bccf2200fc9bf04cbfbfbfb44dbd754224d35b (diff)
krebsdance: make flake8 happy
-rw-r--r--krebs/5pkgs/simple/krebsdance/default.nix16
1 files changed, 10 insertions, 6 deletions
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: