2
0
mirror of https://expo.survex.com/repositories/troggle/.git synced 2024-11-21 23:01:52 +00:00

python 3.12 discovered syntax issues

This commit is contained in:
Philip Sargent 2023-11-23 18:46:44 +00:00
parent 521fd20e37
commit 8fd09bef92
6 changed files with 8 additions and 8 deletions

View File

@ -75,7 +75,7 @@ sudo ln -s /etc/alternatives/python /usr/bin/python3
sudo apt dist-upgrade sudo apt dist-upgrade
# install VS code # install VS code - but ONLY on a native ubuntu install, NOT in WSL
sudo apt install software-properties-common apt-transport-https wget gpg sudo apt install software-properties-common apt-transport-https wget gpg
wget -qO- https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > packages.microsoft.gpg wget -qO- https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > packages.microsoft.gpg
sudo install -D -o root -g root -m 644 packages.microsoft.gpg /etc/apt/keyrings/packages.microsoft.gpg sudo install -D -o root -g root -m 644 packages.microsoft.gpg /etc/apt/keyrings/packages.microsoft.gpg

View File

@ -171,7 +171,7 @@ class ImportTest(TestCase):
# f.write(content) # f.write(content)
expected = [ expected = [
"Edit Logbook Entry on 1986-07-31", "Edit Logbook Entry on 1986-07-31",
"Other names \(comma separated\)", # regex so slashes need to be espcaped r"Other names \(comma separated\)", # regex match so slashes need to be espcaped
"Place: cave name, or 'plateau', 'topcamp' etc.", "Place: cave name, or 'plateau', 'topcamp' etc.",
] ]
for ph in expected: for ph in expected:

View File

@ -129,7 +129,7 @@ for FONT in [
"/usr/share/fonts/truetype/freefont/FreeSans.ttf", "/usr/share/fonts/truetype/freefont/FreeSans.ttf",
"/usr/X11R6/lib/X11/fonts/truetype/arial.ttf", "/usr/X11R6/lib/X11/fonts/truetype/arial.ttf",
"/mnt/c/windows/fonts/arial.ttf", "/mnt/c/windows/fonts/arial.ttf",
"C:\WINNT\Fonts\ARIAL.TTF", r"C:\WINNT\Fonts\ARIAL.TTF",
]: ]:
if os.path.isfile(FONT): if os.path.isfile(FONT):
break break

View File

@ -326,7 +326,7 @@ def parser_date(tripdate, year):
def parser_html(year, expedition, txt, seq=""): def parser_html(year, expedition, txt, seq=""):
"""This uses some of the more obscure capabilities of regular expressions, r"""This uses some of the more obscure capabilities of regular expressions,
see https://docs.python.org/3/library/re.html see https://docs.python.org/3/library/re.html
e.g. e.g.

View File

@ -68,13 +68,13 @@ def troggle_slugify(longname):
This function copied intact to expoweb/scripts/make-folklist.py This function copied intact to expoweb/scripts/make-folklist.py
""" """
slug = longname.strip().lower().replace(" ","-") slug = longname.strip().lower().replace(" ","-")
slug = re.sub('\([^\)]*\)','',slug) # remove nickname in brackets slug = re.sub(r'\([^\)]*\)','',slug) # remove nickname in brackets
slug = slug.replace('é', 'e') slug = slug.replace('é', 'e')
slug = slug.replace('á', 'a') slug = slug.replace('á', 'a')
slug = slug.replace('ä', 'a') slug = slug.replace('ä', 'a')
slug = slug.replace('&', '') # otherwise just remove the & slug = slug.replace('&', '') # otherwise just remove the &
slug = slug.replace(';', '') # otherwise just remove the ; slug = slug.replace(';', '') # otherwise just remove the ;
slug = re.sub('<[^>]*>','',slug) # remove <span-lang = "hu"> slug = re.sub(r'<[^>]*>','',slug) # remove <span-lang = "hu">
if len(slug) > 40: # slugfield is 50 chars if len(slug) > 40: # slugfield is 50 chars
slug = slug[:40] slug = slug[:40]

View File

@ -2428,9 +2428,9 @@ def FindAndLoadSurvex():
ff = survexblock.survexfile ff = survexblock.survexfile
if comment: if comment:
# print(f"FIX {survexblock} {altitude} {comment}") # print(f"FIX {survexblock} {altitude} {comment}")
if re.match("(?i)[^s]*srtm[\s\S]*", comment.lower()): if re.match(r"(?i)[^s]*srtm[\s\S]*", comment.lower()):
print(f"SRTM {ff}.svx::{survexblock} - {spath}.svx - alt={altitude} '{comment}'") print(f"SRTM {ff}.svx::{survexblock} - {spath}.svx - alt={altitude} '{comment}'")
if re.match("(?i)[^s]*radost[\s\S]*", comment.lower()): if re.match(r"(?i)[^s]*radost[\s\S]*", comment.lower()):
print(f"RDST {ff}.svx::{survexblock} - {spath}.svx - alt={altitude} '{comment}'") print(f"RDST {ff}.svx::{survexblock} - {spath}.svx - alt={altitude} '{comment}'")
svx_load = None svx_load = None