aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorEgor Tensin <Egor.Tensin@gmail.com>2023-07-12 12:12:00 +0200
committerEgor Tensin <Egor.Tensin@gmail.com>2023-07-12 12:16:02 +0200
commitbd6676c58af7a97a1e813b5c412e2a50ea65f75e (patch)
treeb60e5e8658ed55c9772fa559cf25c558248d8680
parentMakefile: move the prelude to prelude.mk (diff)
downloadcgitize-bd6676c58af7a97a1e813b5c412e2a50ea65f75e.tar.gz
cgitize-bd6676c58af7a97a1e813b5c412e2a50ea65f75e.zip
cgitize.git: use raw string literals where appropriate
-rw-r--r--cgitize/git.py14
1 files changed, 7 insertions, 7 deletions
diff --git a/cgitize/git.py b/cgitize/git.py
index 35b2e1e..769b624 100644
--- a/cgitize/git.py
+++ b/cgitize/git.py
@@ -82,9 +82,9 @@ class Config:
def format_name(self):
name = self.name
# Escape the backslashes:
- name = name.replace('\\', '\\\\')
+ name = name.replace('\\', r'\\')
# Escape the quotes:
- name = name.replace('"', '\\"')
+ name = name.replace('"', r'\"')
# Put in quotes:
return f'"{name}"'
@@ -121,13 +121,13 @@ class Config:
def format_value(self):
value = self.value
# Escape the backslashes:
- value = value.replace('\\', '\\\\')
+ value = value.replace('\\', r'\\')
# Escape the supported escape sequences (\n, \t and \b):
- value = value.replace('\n', '\\n')
- value = value.replace('\t', '\\t')
- value = value.replace('\b', '\\b')
+ value = value.replace('\n', r'\n')
+ value = value.replace('\t', r'\t')
+ value = value.replace('\b', r'\b')
# Escape the quotes:
- value = value.replace('"', '\\"')
+ value = value.replace('"', r'\"')
# Put in quotes:
value = f'"{value}"'
return value