diff options
author | Eli Schwartz <eschwartz@archlinux.org> | 2021-03-04 17:02:31 -0500 |
---|---|---|
committer | Eli Schwartz <eschwartz@archlinux.org> | 2021-03-04 17:11:26 -0500 |
commit | 4340bf34faca7eed8076ba4c388fbe15355f2183 (patch) | |
tree | 6082548a6cb79091d1059a73e7b3b9f59657f6d9 /mesonbuild/rewriter.py | |
parent | 76df995ba69ef5d790462856b3edbd42b28b906a (diff) | |
download | meson-4340bf34faca7eed8076ba4c388fbe15355f2183.zip meson-4340bf34faca7eed8076ba4c388fbe15355f2183.tar.gz meson-4340bf34faca7eed8076ba4c388fbe15355f2183.tar.bz2 |
various python neatness cleanups
All changes were created by running
"pyupgrade --py3-only --keep-percent-format"
and committing the results. I have not touched string formatting for
now.
- use set literals
- simplify .format() parameter naming
- remove __future__
- remove default "r" mode for open()
- use OSError rather than compatibility aliases
- remove stray parentheses in function(generator) scopes
Diffstat (limited to 'mesonbuild/rewriter.py')
-rw-r--r-- | mesonbuild/rewriter.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/mesonbuild/rewriter.py b/mesonbuild/rewriter.py index 9cd9ad0..8585833 100644 --- a/mesonbuild/rewriter.py +++ b/mesonbuild/rewriter.py @@ -820,7 +820,7 @@ class Rewriter: if not os.path.exists(fpath): with open(fpath, 'w'): pass - with open(fpath, 'r') as fp: + with open(fpath) as fp: fdata = fp.read() # Generate line offsets numbers @@ -923,7 +923,7 @@ def generate_def_opts(options) -> T.List[dict]: def generate_cmd(options) -> T.List[dict]: if os.path.exists(options.json): - with open(options.json, 'r') as fp: + with open(options.json) as fp: return json.load(fp) else: return json.loads(options.json) |