🔨 Simplify scripts with pathlib (#24574)

This commit is contained in:
Scott Lahteine
2022-08-01 01:14:58 -05:00
parent c3f2586445
commit 3b30951e83
14 changed files with 182 additions and 196 deletions

View File

@ -252,7 +252,7 @@ def resolve_path(path):
while 0 <= path.find('../'):
end = path.find('../') - 1
start = path.find('/')
while 0 <= path.find('/', start) and end > path.find('/', start):
while 0 <= path.find('/', start) < end:
start = path.find('/', start) + 1
path = path[0:start] + path[end + 4:]
@ -674,7 +674,7 @@ def line_print(line_input):
if 0 == highlight[1]:
found_1 = text.find(' ')
found_tab = text.find('\t')
if found_1 < 0 or found_1 > found_tab:
if not (0 <= found_1 <= found_tab):
found_1 = found_tab
write_to_screen_queue(text[:found_1 + 1])
for highlight_2 in highlights:
@ -684,7 +684,7 @@ def line_print(line_input):
if found >= 0:
found_space = text.find(' ', found_1 + 1)
found_tab = text.find('\t', found_1 + 1)
if found_space < 0 or found_space > found_tab:
if not (0 <= found_space <= found_tab):
found_space = found_tab
found_right = text.find(']', found + 1)
write_to_screen_queue(text[found_1 + 1:found_space + 1], highlight[2])
@ -701,7 +701,7 @@ def line_print(line_input):
break
if did_something == False:
r_loc = text.find('\r') + 1
if r_loc > 0 and r_loc < len(text): # need to split this line
if 0 < r_loc < len(text): # need to split this line
text = text.split('\r')
for line in text:
if line != '':