diff options
author | Philip Sargent <philip.sargent@klebos.com> | 2022-11-17 01:24:39 +0000 |
---|---|---|
committer | Philip Sargent <philip.sargent@klebos.com> | 2022-11-17 01:24:39 +0000 |
commit | 725c5ad0cde2dc610781ab033c723f8de9e996b7 (patch) | |
tree | db46259844284db1a106c1d6c2fb8d84c661b5dd /parsers/caves.py | |
parent | 0b89979418d76b3ef8f4af55730ddf4b99ea4d68 (diff) | |
download | troggle-725c5ad0cde2dc610781ab033c723f8de9e996b7.tar.gz troggle-725c5ad0cde2dc610781ab033c723f8de9e996b7.tar.bz2 troggle-725c5ad0cde2dc610781ab033c723f8de9e996b7.zip |
Updating comments
Diffstat (limited to 'parsers/caves.py')
-rw-r--r-- | parsers/caves.py | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/parsers/caves.py b/parsers/caves.py index 478eb71..361d950 100644 --- a/parsers/caves.py +++ b/parsers/caves.py @@ -88,7 +88,7 @@ def do_pending_cave(k, url, area): ''' def get_survex_file(k): '''Guesses at and finds a survex file for this pending cave. - Convoluted. Sorry. Needs rewriting + Convoluted. Needs rewriting ''' if k[0:3] == "162": id = Path(k[5:]) @@ -199,6 +199,9 @@ def do_pending_cave(k, url, area): def readentrance(filename): + '''Reads an enrance description from the .html file + Convoluted. Sorry.This is as I inherited it and I haven't fiddled with it. Needs rewriting + ''' global entrances_xslug global caves_xslug global areas_xslug @@ -296,7 +299,9 @@ def readentrance(filename): # print(message) def readcave(filename): - '''Assumes any area it hasn't seen before is a subarea of 1623 + '''Reads an enrance description from the .html file + Convoluted. Sorry.This is as I inherited it and I haven't fiddled with it. Needs rewriting + Assumes any area it hasn't seen before is a subarea of 1623 ''' global entrances_xslug global caves_xslug @@ -447,6 +452,8 @@ def readcave(filename): print(message) def getXML(text, itemname, minItems = 1, maxItems = None, printwarnings = True, context = ""): + """Reads a single XML tag + """ items = re.findall("<%(itemname)s>(.*?)</%(itemname)s>" % {"itemname": itemname}, text, re.S) if len(items) < minItems and printwarnings: message = " ! %(count)i x %(itemname)s found, at least %(min)i expected. Load ABORT. " % {"count": len(items), |