Mercurial > hgrepos > Python > apps > py-cutils
changeset 340:cfa544fbb9f9
treesum: allow parsing of files again where sizes are printed with grouping with standard separators out of "., '_"
| author | Franz Glasner <fzglas.hg@dom66.de> |
|---|---|
| date | Mon, 31 Mar 2025 14:51:32 +0200 |
| parents | 9c7a03199092 |
| children | 728ad9c639f2 |
| files | cutils/treesum.py |
| diffstat | 1 files changed, 8 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/cutils/treesum.py Mon Mar 31 14:39:01 2025 +0200 +++ b/cutils/treesum.py Mon Mar 31 14:51:32 2025 +0200 @@ -1643,8 +1643,8 @@ PATTERN0 = re.compile(br"\A[ \t]*\r?\n\Z") # empty lines PATTERN1 = re.compile(br"\A(VERSION|FSENCODING|FLAGS|TIMESTAMP|ISOTIMESTAMP|CRC32)[ \t]*=[ \t]*([^ \t]+)[ \t]*\r?\n\Z") # noqa: E501 line too long PATTERN2 = re.compile(br"\A(ROOT|COMMENT|ERROR|GENERATOR|FNMATCH|ACCEPT-TREESUM)[ \t]*\((.*)\)[ \t]*\r?\n\Z") # noqa: E501 line too long - PATTERN3 = re.compile(br"\ASIZE[ \t]*\((.*)\)([ \t]*=[ \t]*(\d+))?[ \t]*\r?\n\Z") # noqa: E501 line too long - PATTERN4 = re.compile(br"\A([A-Za-z0-9_-]+)[ \t]*\((.*)\)([ \t]*=[ \t]*([A-Za-z0-9=+/]+)?(,(\d+)?)?)?[ \t]*\r?\n\Z") # noqa: E501 line too long + PATTERN3 = re.compile(br"\ASIZE[ \t]*\((.*)\)([ \t]*=[ \t]*([0-9., '_]*[0-9]))?[ \t]*\r?\n\Z") # noqa: E501 line too long + PATTERN4 = re.compile(br"\A([A-Za-z0-9_-]+)[ \t]*\((.*)\)([ \t]*=[ \t]*([A-Za-z0-9=+/]+)?(,([0-9., '_]*[0-9])?)?)?[ \t]*\r?\n\Z") # noqa: E501 line too long def __init__(self, _fp, _filename, _own_fp): self._fp = _fp @@ -1783,7 +1783,9 @@ self._update_crc(line) if mo.group(2): return ("SIZE", mo.group(1), - int(util.n(mo.group(3)), 10)) + int(util.n(mo.group(3)) + .translate(None, "., '_"), + 10)) else: return ("SIZE", mo.group(1), None) else: @@ -1804,7 +1806,9 @@ digest = None if mo.group(5): if mo.group(6): - size = int(util.n(mo.group(6)), 10) + size = int(util.n(mo.group(6)) + .translate(None, "., '_"), + 10) else: size = None else:
