Rewrite some strings using raw string syntax.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
This commit is contained in:
Anders Kaseorg 2020-04-18 03:37:30 -07:00 committed by Tim Abbott
parent e30b3b094b
commit d68437d5f5
4 changed files with 31 additions and 31 deletions

View file

@ -52,7 +52,7 @@ def process_lines(raw_lines, file_name):
lines = []
for line in raw_lines:
# Add any filtering or modification code here
if re.match(".*upstream timed out.*while reading upstream.*", line):
if re.match(r".*upstream timed out.*while reading upstream.*", line):
continue
lines.append(line)

View file

@ -338,7 +338,7 @@ def setP4ExecBit(file, mode):
if not isModeExec(mode):
p4Type = getP4OpenedType(file)
p4Type = re.sub('^([cku]?)x(.*)', '\\1\\2', p4Type)
p4Type = re.sub(r'^([cku]?)x(.*)', '\\1\\2', p4Type)
p4Type = re.sub(r'(.*?\+.*?)x(.*?)', '\\1\\2', p4Type)
if p4Type[-1] == "+":
p4Type = p4Type[0:-1]
@ -817,7 +817,7 @@ def wildcard_encode(path):
return path
def wildcard_present(path):
m = re.search("[*#@%]", path)
m = re.search(r"[*#@%]", path)
return m is not None
class Command:
@ -1979,7 +1979,7 @@ class P4Sync(Command, P4UserMap):
# Preserve everything in relative path name except leading
# //depot/; just look at first prefix as they all should
# be in the same depot.
depot = re.sub("^(//[^/]+/).*", r'\1', prefixes[0])
depot = re.sub(r"^(//[^/]+/).*", r'\1', prefixes[0])
if p4PathStartsWith(path, depot):
path = path[len(depot):]
@ -3049,7 +3049,7 @@ class P4Rebase(Command):
die("Cannot find upstream branchpoint for rebase")
# the branchpoint may be p4/foo~3, so strip off the parent
upstream = re.sub("~[0-9]+$", "", upstream)
upstream = re.sub(r"~[0-9]+$", "", upstream)
print("Rebasing the current branch onto %s" % upstream)
oldHead = read_pipe("git rev-parse HEAD").strip()
@ -3085,8 +3085,8 @@ class P4Clone(P4Sync):
def defaultDestination(self, args):
## TODO: use common prefix of args?
depotPath = args[0]
depotDir = re.sub("(@[^@]*)$", "", depotPath)
depotDir = re.sub("(#[^#]*)$", "", depotDir)
depotDir = re.sub(r"(@[^@]*)$", "", depotPath)
depotDir = re.sub(r"(#[^#]*)$", "", depotDir)
depotDir = re.sub(r"\.\.\.$", "", depotDir)
depotDir = re.sub(r"/$", "", depotDir)
return os.path.split(depotDir)[1]