raw strings fix

This commit is contained in:
Peter Howell 2025-08-29 23:54:10 +00:00
parent d49e0d0c17
commit eec0c342d8
2 changed files with 21 additions and 22 deletions

View File

@ -157,7 +157,7 @@ def setup_table(table='requests'):
for L in open('cache/request_table.txt','r').readlines(): for L in open('cache/request_table.txt','r').readlines():
L = L.strip() L = L.strip()
#print(L) #print(L)
(col,type) = re.split("\s\s\s\s",L) (col,type) = re.split(r"\s\s\s\s",L)
if not first: if not first:
q += ",\n" q += ",\n"
first = 0 first = 0
@ -1159,13 +1159,13 @@ def guess_dept(t):
method = 2 # xlisted takes dept first listed method = 2 # xlisted takes dept first listed
if method==1: if method==1:
p = "^([A-Z/]+)\d+" p = r"^([A-Z/]+)\d+"
m = re.search(p, t['code']) m = re.search(p, t['code'])
if m: if m:
return m.group(1) return m.group(1)
return '?' return '?'
if method==2: if method==2:
p = "^([A-Z]+)[\d/]+" p = r"^([A-Z]+)[\d/]+"
m = re.search(p, t['code']) m = re.search(p, t['code'])
if m: if m:
return m.group(1) return m.group(1)
@ -1700,7 +1700,7 @@ ORDER BY u.sortablename;"""
def build_db_schedule(): def build_db_schedule():
# from the schedule json files # from the schedule json files
target = "\_sched\_expanded\.json" target = r"\_sched\_expanded\.json"
def finder(st): def finder(st):
return re.search(target,st) return re.search(target,st)
@ -2132,4 +2132,3 @@ if __name__ == "__main__":
# Call the function in the options dict # Call the function in the options dict
options[ int(resp)][1]() options[ int(resp)][1]()

View File

@ -203,17 +203,17 @@ def homepage():
def orgline(L): def orgline(L):
L.strip() L.strip()
if re.search("^\s*$", L): return "" if re.search(r"^\s*$", L): return ""
a = re.search( '^\*\s(.*)$', L) a = re.search( r'^\*\s(.*)$', L)
if a: return "<h2>%s</h2>\n" % a.group(1) if a: return "<h2>%s</h2>\n" % a.group(1)
b = re.search( 'TODO\s\[\#A\](.*)$', L) b = re.search( r'TODO\s\[\#A\](.*)$', L)
if b: return "<b><i>Todo - Priority 1</i>: %s</b>" % b.group(1) + br + nl if b: return "<b><i>Todo - Priority 1</i>: %s</b>" % b.group(1) + br + nl
d = re.search( '^\*\*\*\s(.*)$', L) d = re.search( r'^\*\*\*\s(.*)$', L)
if d: return d.group(1) if d: return d.group(1)
d = re.search( '^\*\*\s(.*)$', L) d = re.search( r'^\*\*\s(.*)$', L)
if d: L = d.group(1) if d: L = d.group(1)
return L + br + nl return L + br + nl
@ -450,7 +450,7 @@ def lectures():
#print(f) #print(f)
with tag('item'): with tag('item'):
name = f.split('.')[0] name = f.split('.')[0]
ff = re.sub('\s','%20',f) ff = re.sub(r'\s','%20',f)
with tag('title'): text(name) with tag('title'): text(name)
with tag('guid'): text(f) with tag('guid'): text(f)
b = os.path.getsize(LECPATH+f) b = os.path.getsize(LECPATH+f)
@ -521,7 +521,7 @@ def staff_dir(search=''):
def find_goo(n): def find_goo(n):
g = re.search('00(\d\d\d\d\d\d)', n) g = re.search(r'00(\d{6})', n)
if g: if g:
return g.groups()[0] return g.groups()[0]