From 774ff3c8a19baf7071d00ff09dc86c9ec7d78581 Mon Sep 17 00:00:00 2001 From: Geir Arne Hjelle Date: Wed, 15 Jan 2025 12:14:58 +0100 Subject: [PATCH] Update date (#626) --- replace-string-python/transcript_basic.py | 8 ++++---- replace-string-python/transcript_multiple_replace.py | 10 +++++----- replace-string-python/transcript_reduce.py | 10 +++++----- replace-string-python/transcript_regex.py | 8 ++++---- replace-string-python/transcript_regex_callback.py | 8 ++++---- 5 files changed, 22 insertions(+), 22 deletions(-) diff --git a/replace-string-python/transcript_basic.py b/replace-string-python/transcript_basic.py index 570f524925..4fee00592a 100644 --- a/replace-string-python/transcript_basic.py +++ b/replace-string-python/transcript_basic.py @@ -1,8 +1,8 @@ transcript = """ -[support_tom] 2022-08-24T10:02:23+00:00 : What can I help you with? -[johndoe] 2022-08-24T10:03:15+00:00 : I CAN'T CONNECT TO MY BLASTED ACCOUNT -[support_tom] 2022-08-24T10:03:30+00:00 : Are you sure it's not your caps lock? -[johndoe] 2022-08-24T10:04:03+00:00 : Blast! You're right! +[support_tom] 2025-01-24T10:02:23+00:00 : What can I help you with? +[johndoe] 2025-01-24T10:03:15+00:00 : I CAN'T CONNECT TO MY BLASTED ACCOUNT +[support_tom] 2025-01-24T10:03:30+00:00 : Are you sure it's not your caps lock? +[johndoe] 2025-01-24T10:04:03+00:00 : Blast! You're right! """ print(transcript.replace("BLASTED", "😤")) diff --git a/replace-string-python/transcript_multiple_replace.py b/replace-string-python/transcript_multiple_replace.py index 9fd1190ba6..104e3c9db2 100644 --- a/replace-string-python/transcript_multiple_replace.py +++ b/replace-string-python/transcript_multiple_replace.py @@ -1,17 +1,17 @@ REPLACEMENTS = [ ("BLASTED", "😤"), ("Blast", "😤"), - ("2022-08-24T", ""), + ("2025-01-24T", ""), ("+00:00", ""), ("[support_tom]", "Agent "), ("[johndoe]", "Client"), ] transcript = """ -[support_tom] 2022-08-24T10:02:23+00:00 : What can I help you with? -[johndoe] 2022-08-24T10:03:15+00:00 : I CAN'T CONNECT TO MY BLASTED ACCOUNT -[support_tom] 2022-08-24T10:03:30+00:00 : Are you sure it's not your caps lock? -[johndoe] 2022-08-24T10:04:03+00:00 : Blast! You're right! +[support_tom] 2025-01-24T10:02:23+00:00 : What can I help you with? +[johndoe] 2025-01-24T10:03:15+00:00 : I CAN'T CONNECT TO MY BLASTED ACCOUNT +[support_tom] 2025-01-24T10:03:30+00:00 : Are you sure it's not your caps lock? +[johndoe] 2025-01-24T10:04:03+00:00 : Blast! You're right! """ for old, new in REPLACEMENTS: diff --git a/replace-string-python/transcript_reduce.py b/replace-string-python/transcript_reduce.py index 70d13ee120..4018b44e37 100644 --- a/replace-string-python/transcript_reduce.py +++ b/replace-string-python/transcript_reduce.py @@ -3,17 +3,17 @@ REPLACEMENTS = [ ("BLASTED", "😤"), ("Blast", "😤"), - ("2022-08-24T", ""), + ("2025-01-24T", ""), ("+00:00", ""), ("[support_tom]", "Agent "), ("[johndoe]", "Client"), ] transcript = """ -[support_tom] 2022-08-24T10:02:23+00:00 : What can I help you with? -[johndoe] 2022-08-24T10:03:15+00:00 : I CAN'T CONNECT TO MY BLASTED ACCOUNT -[support_tom] 2022-08-24T10:03:30+00:00 : Are you sure it's not your caps lock? -[johndoe] 2022-08-24T10:04:03+00:00 : Blast! You're right! +[support_tom] 2025-01-24T10:02:23+00:00 : What can I help you with? +[johndoe] 2025-01-24T10:03:15+00:00 : I CAN'T CONNECT TO MY BLASTED ACCOUNT +[support_tom] 2025-01-24T10:03:30+00:00 : Are you sure it's not your caps lock? +[johndoe] 2025-01-24T10:04:03+00:00 : Blast! You're right! """ print(reduce(lambda acc, item: acc.replace(*item), REPLACEMENTS, transcript)) diff --git a/replace-string-python/transcript_regex.py b/replace-string-python/transcript_regex.py index 33c46dd7b0..2ce9d62623 100644 --- a/replace-string-python/transcript_regex.py +++ b/replace-string-python/transcript_regex.py @@ -8,10 +8,10 @@ ] transcript = """ -[support_tom] 2022-08-24T10:02:23+00:00 : What can I help you with? -[johndoe] 2022-08-24T10:03:15+00:00 : I CAN'T CONNECT TO MY BLASTED ACCOUNT -[support_tom] 2022-08-24T10:03:30+00:00 : Are you sure it's not your caps lock? -[johndoe] 2022-08-24T10:04:03+00:00 : Blast! You're right! +[support_tom] 2025-01-24T10:02:23+00:00 : What can I help you with? +[johndoe] 2025-01-24T10:03:15+00:00 : I CAN'T CONNECT TO MY BLASTED ACCOUNT +[support_tom] 2025-01-24T10:03:30+00:00 : Are you sure it's not your caps lock? +[johndoe] 2025-01-24T10:04:03+00:00 : Blast! You're right! """ for new, old in REGEX_REPLACEMENTS: diff --git a/replace-string-python/transcript_regex_callback.py b/replace-string-python/transcript_regex_callback.py index 70a2bd3935..8cc7a752e1 100644 --- a/replace-string-python/transcript_regex_callback.py +++ b/replace-string-python/transcript_regex_callback.py @@ -31,10 +31,10 @@ def sanitize_message(match): transcript = """ -[support_tom] 2022-08-24T10:02:23+00:00 : What can I help you with? -[johndoe] 2022-08-24T10:03:15+00:00 : I CAN'T CONNECT TO MY BLASTED ACCOUNT -[support_tom] 2022-08-24T10:03:30+00:00 : Are you sure it's not your caps lock? -[johndoe] 2022-08-24T10:04:03+00:00 : Blast! You're right! +[support_tom] 2025-01-24T10:02:23+00:00 : What can I help you with? +[johndoe] 2025-01-24T10:03:15+00:00 : I CAN'T CONNECT TO MY BLASTED ACCOUNT +[support_tom] 2025-01-24T10:03:30+00:00 : Are you sure it's not your caps lock? +[johndoe] 2025-01-24T10:04:03+00:00 : Blast! You're right! """ print(re.sub(ENTRY_PATTERN, sanitize_message, transcript))