comparison doc/gendoc.py @ 52681:3e84e001b6c1

pyupgrade: drop redundant `open()` modes On one hand, this gets rid of some py2 cruft (like `U` and `t` modes). OTOH, I like being explict. But there's no way to disable individual transformations (and this change is part of `_fix_tokens()`, which is even harder to selectively use locally), and I'd rather have less noise when using `pyupgrade`. Warning: `contrib/synthrepo.py` appears not to have been updated to py3, as it's passing str to `error.Abort`. But since it was opening the file in unicode on py2, this change is a no-op.
author Matt Harbison <matt_harbison@yahoo.com>
date Tue, 07 Jan 2025 17:28:46 -0500
parents 0e11e532c958
children
comparison
equal deleted inserted replaced
52680:5027ae0d89b3 52681:3e84e001b6c1
359 return shortdoc.lstrip(), longdoc.lstrip() 359 return shortdoc.lstrip(), longdoc.lstrip()
360 360
361 361
362 def _rendertpl(tplname, data): 362 def _rendertpl(tplname, data):
363 tplpath = os.path.join(os.path.dirname(__file__), 'templates', tplname) 363 tplpath = os.path.join(os.path.dirname(__file__), 'templates', tplname)
364 with open(tplpath, 'r') as f: 364 with open(tplpath) as f:
365 tpl = f.read() 365 tpl = f.read()
366 366
367 if isinstance(tpl, bytes): 367 if isinstance(tpl, bytes):
368 tpl = tpl.decode() 368 tpl = tpl.decode()
369 for k in data: 369 for k in data: