diff options
| author | Eli Schwartz <eschwartz@archlinux.org> | 2021-08-15 11:08:26 -0400 |
|---|---|---|
| committer | Eli Schwartz <eschwartz@archlinux.org> | 2021-10-04 16:29:30 -0400 |
| commit | e8a85fa8a2cdbbcd5dcefd9152be67e4416338ca (patch) | |
| tree | 83ed77c6e7372b73fc7f84cb326fd95808335be8 /test cases | |
| parent | 2d65472c725f18b343aee00bf91b9ac98c08b95f (diff) | |
| download | meson-e8a85fa8a2cdbbcd5dcefd9152be67e4416338ca.tar.gz | |
various python neatness cleanups
All changes were created by running
"pyupgrade --py3-only"
and committing the results. Although this has been performed in the
past, newer versions of pyupgrade can automatically catch more
opportunities, notably list comprehensions can use generators instead,
in the following cases:
- unpacking into function arguments as function(*generator)
- unpacking into assignments of the form x, y = generator
- as the argument to some builtin functions such as min/max/sorted
Also catch a few creeping cases of new code added using older styles.
Diffstat (limited to 'test cases')
| -rw-r--r-- | test cases/common/22 object extraction/check-obj.py | 4 | ||||
| -rwxr-xr-x | test cases/cython/2 generated sources/generator.py | 2 |
2 files changed, 3 insertions, 3 deletions
diff --git a/test cases/common/22 object extraction/check-obj.py b/test cases/common/22 object extraction/check-obj.py index d2df930b9..d6afbcc27 100644 --- a/test cases/common/22 object extraction/check-obj.py +++ b/test cases/common/22 object extraction/check-obj.py @@ -9,9 +9,9 @@ output = None # Only the ninja backend produces compile_commands.json if sys.argv[1] == 'ninja': - with open('compile_commands.json', 'r') as f: + with open('compile_commands.json') as f: cc = json.load(f) - output = set((x['output'] for x in cc)) + output = {x['output'] for x in cc} for obj in sys.argv[2:]: if not os.path.exists(obj): diff --git a/test cases/cython/2 generated sources/generator.py b/test cases/cython/2 generated sources/generator.py index 77de85569..9b0d94a14 100755 --- a/test cases/cython/2 generated sources/generator.py +++ b/test cases/cython/2 generated sources/generator.py @@ -8,5 +8,5 @@ parser.add_argument('input') parser.add_argument('output') args = parser.parse_args() -with open(args.input, 'r') as i, open(args.output, 'w') as o: +with open(args.input) as i, open(args.output, 'w') as o: o.write(i.read()) |
