Mercurial > kallithea
view scripts/source_format.py @ 8822:116151b6bfb2
celery: drop tracking of task_id - we use ignore_result=True and will never get anything back
There is thus no need for configuration of celery.result_backend .
The alternative would be to fix it. That could give better error reporting from
failing repo creations, but would require quite a bit of additional changes
before it actually works reliably.
author | Mads Kiilerich <mads@kiilerich.com> |
---|---|
date | Wed, 30 Dec 2020 00:14:57 +0100 |
parents | f8971422795e |
children |
line wrap: on
line source
#!/usr/bin/env python3 # hg files 'set:!binary()&grep("^#!.*python")' 'set:**.py' | xargs scripts/source_format.py import re import sys filenames = sys.argv[1:] for fn in filenames: with open(fn) as f: org_content = f.read() mod_name = fn[:-3] if fn.endswith('.py') else fn mod_name = mod_name[:-9] if mod_name.endswith('/__init__') else mod_name mod_name = mod_name.replace('/', '.') def f(m): return '"""\n%s\n%s\n' % (mod_name, '~' * len(mod_name)) new_content = re.sub(r'^"""\n(kallithea\..*\n)(~+\n)?', f, org_content, count=1, flags=re.MULTILINE) if new_content != org_content: with open(fn, 'w') as f: f.write(new_content)