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 /tools | |
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 'tools')
-rwxr-xr-x | tools/dircondenser.py | 2 | ||||
-rwxr-xr-x | tools/regenerate_docs.py | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/tools/dircondenser.py b/tools/dircondenser.py index 8da0ce2..b49d80f 100755 --- a/tools/dircondenser.py +++ b/tools/dircondenser.py @@ -54,7 +54,7 @@ def get_entries() -> T.List[T.Tuple[int, str]]: return entries def replace_source(sourcefile: str, replacements: T.List[T.Tuple[str, str]]) -> None: - with open(sourcefile, 'r') as f: + with open(sourcefile) as f: contents = f.read() for old_name, new_name in replacements: contents = contents.replace(old_name, new_name) diff --git a/tools/regenerate_docs.py b/tools/regenerate_docs.py index b9b994a..2765836 100755 --- a/tools/regenerate_docs.py +++ b/tools/regenerate_docs.py @@ -94,7 +94,7 @@ def get_commands_data(root_dir: Path) -> T.Dict[str, T.Any]: return out output = _get_meson_output(root_dir, ['--help']) - commands = set(c.strip() for c in re.findall(r'usage:(?:.+)?{((?:[a-z]+,*)+?)}', output, re.MULTILINE|re.DOTALL)[0].split(',')) + commands = {c.strip() for c in re.findall(r'usage:(?:.+)?{((?:[a-z]+,*)+?)}', output, re.MULTILINE|re.DOTALL)[0].split(',')} commands.remove('help') cmd_data = dict() |