comparison contrib/perf-utils/perf-revlog-write-plot.py @ 52656: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 6000f5b25c9b
children
comparison
equal deleted inserted replaced
52655:5027ae0d89b3 52656:3e84e001b6c1
116 if __name__ == '__main__': 116 if __name__ == '__main__':
117 import sys 117 import sys
118 118
119 if len(sys.argv) > 1: 119 if len(sys.argv) > 1:
120 print('reading from %r' % sys.argv[1]) 120 print('reading from %r' % sys.argv[1])
121 with open(sys.argv[1], 'r') as fp: 121 with open(sys.argv[1]) as fp:
122 plot(json.load(fp), title=sys.argv[1]) 122 plot(json.load(fp), title=sys.argv[1])
123 else: 123 else:
124 print('reading from stdin') 124 print('reading from stdin')
125 plot(json.load(sys.stdin)) 125 plot(json.load(sys.stdin))