From d47ea8809a8d8bcf00ee63b3ae65c85aff9549ed Mon Sep 17 00:00:00 2001 From: Alina Lenk Date: Wed, 2 Mar 2022 16:33:39 +0100 Subject: [PATCH 5/5] generate_packets.py: clean up general helper functions See osdn #44011 Signed-off-by: Alina Lenk --- common/generate_packets.py | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/common/generate_packets.py b/common/generate_packets.py index ee698c647c..76f0d907d0 100755 --- a/common/generate_packets.py +++ b/common/generate_packets.py @@ -154,12 +154,6 @@ def verbose(s): print(s) -def prefix(prefix, text): - lines = text.split("\n") - lines=map(lambda x,prefix=prefix: prefix+x,lines) - return "\n".join(lines) - - ####################### File access helper functions ####################### def write_disclaimer(f): @@ -240,12 +234,9 @@ def powerset(iterable): s = list(iterable) return chain.from_iterable(combinations(s, r) for r in range(len(s)+1)) -def without(seq, part): - result=[] - for i in seq: - if i not in part: - result.append(i) - return result +def prefix(prefix, text): + """Prepend prefix to every line of text""" + return "\n".join(prefix + line for line in text.split("\n")) # A simple container for a type alias class Type: -- 2.17.1