diff --git a/Client/worker.py b/Client/worker.py index e2f3c4a..7205101 100644 --- a/Client/worker.py +++ b/Client/worker.py @@ -779,7 +779,7 @@ def scale_time_control(workload, scale_factor, branch): time_control = workload['test'][branch]['time_control'] # Searching for Nodes or Depth time controls ("N=", "D=") - pattern = '(?P((N))|(D))=(?P(\d+))' + pattern = r'(?P((N))|(D))=(?P(\d+))' results = re.search(pattern, time_control.upper()) # No scaling is needed for fixed nodes or fixed depth games @@ -788,7 +788,7 @@ def scale_time_control(workload, scale_factor, branch): return 'tc=inf %s=%s' % ({'N' : 'nodes', 'D' : 'depth'}[mode], value) # Searching for MoveTime or Fixed Time Controls ("MT=") - pattern = '(?P(MT))=(?P(\d+))' + pattern = r'(?P(MT))=(?P(\d+))' results = re.search(pattern, time_control.upper()) # Scale the time based on this machine's NPS. Add a time Margin to avoid time losses. @@ -797,7 +797,7 @@ def scale_time_control(workload, scale_factor, branch): return 'st=%.2f timemargin=250' % ((float(value) * scale_factor / 1000)) # Searching for "X/Y+Z" time controls - pattern = '(?P(\d+/)?)(?P\d*(\.\d+)?)(?P\+(\d+\.)?\d+)?' + pattern = r'(?P(\d+/)?)(?P\d*(\.\d+)?)(?P\+(\d+\.)?\d+)?' results = re.search(pattern, time_control) moves, base, inc = results.group('moves', 'base', 'inc') diff --git a/OpenBench/utils.py b/OpenBench/utils.py index 194443e..1303e94 100644 --- a/OpenBench/utils.py +++ b/OpenBench/utils.py @@ -65,13 +65,13 @@ class TimeControl(object): } # Searching for "nodes=", "depth=", and "movetime=" time controls - pattern = '(?P((N)|(D)|(MT)|(nodes)|(depth)|(movetime)))=(?P(\d+))' + pattern = r'(?P((N)|(D)|(MT)|(nodes)|(depth)|(movetime)))=(?P(\d+))' if results := re.search(pattern, time_str.upper()): mode, value = results.group('mode', 'value') return '%s=%s' % (conversion[mode], value) # Searching for "X/Y+Z" time controls, where "X/" is optional - pattern = '(?P(\d+/)?)(?P\d*(\.\d+)?)(?P\+(\d+\.)?\d+)?' + pattern = r'(?P(\d+/)?)(?P\d*(\.\d+)?)(?P\+(\d+\.)?\d+)?' if results := re.search(pattern, time_str): moves, base, inc = results.group('moves', 'base', 'inc') @@ -135,13 +135,13 @@ def path_join(*args): def extract_option(options, option): - match = re.search('(?<={0}=")[^"]*'.format(option), options) + match = re.search(r'(?<={0}=")[^"]*'.format(option), options) if match: return match.group() - match = re.search('(?<={0}=\')[^\']*'.format(option), options) + match = re.search(r'(?<={0}=\')[^\']*'.format(option), options) if match: return match.group() - match = re.search('(?<={0}=)[^ ]*'.format(option), options) + match = re.search(r'(?<={0}=)[^ ]*'.format(option), options) if match: return match.group()