1
0
Fork 0
mirror of https://github.com/putnam/binmerge.git synced 2025-04-19 08:28:06 +02:00

use raw strings for regexes, avoids syntax warnings in 3.12

This commit is contained in:
Chris Putnam 2023-12-11 19:51:17 -06:00
parent 3802aaff10
commit 557632253f

View file

@ -108,7 +108,7 @@ def read_cue_file(cue_path):
f = open(cue_path, 'r')
for line in f:
m = re.search('FILE "?(.*?)"? BINARY', line)
m = re.search(r'FILE "?(.*?)"? BINARY', line)
if m:
this_path = os.path.join(os.path.dirname(cue_path), m.group(1))
if not (os.path.isfile(this_path) or os.access(this_path, os.R_OK)):
@ -119,13 +119,13 @@ def read_cue_file(cue_path):
files.append(this_file)
continue
m = re.search('TRACK (\d+) ([^\s]*)', line)
m = re.search(r'TRACK (\d+) ([^\s]*)', line)
if m and this_file:
this_track = Track(int(m.group(1)), m.group(2))
this_file.tracks.append(this_track)
continue
m = re.search('INDEX (\d+) (\d+:\d+:\d+)', line)
m = re.search(r'INDEX (\d+) (\d+:\d+:\d+)', line)
if m and this_track:
this_track.indexes.append({'id': int(m.group(1)), 'stamp': m.group(2), 'file_offset':cuestamp_to_sectors(m.group(2))})
continue
@ -166,7 +166,7 @@ def sectors_to_cuestamp(sectors):
def cuestamp_to_sectors(stamp):
# 75 sectors per second
m = re.match("(\d+):(\d+):(\d+)", stamp)
m = re.match(r"(\d+):(\d+):(\d+)", stamp)
minutes = int(m.group(1))
seconds = int(m.group(2))
fields = int(m.group(3))