diff --git a/docs/extensions/refman_links.py b/docs/extensions/refman_links.py index e25ce6170..9a178d515 100644 --- a/docs/extensions/refman_links.py +++ b/docs/extensions/refman_links.py @@ -38,7 +38,7 @@ class RefmanLinksExtension(Extension): # Add Arguments with `group.add_argument(...)` group.add_argument( - f'--refman-data-file', + '--refman-data-file', help="JSON file with the mappings to replace", default=None, ) diff --git a/docs/jsonvalidator.py b/docs/jsonvalidator.py index 46d6167ba..5ab9b5266 100755 --- a/docs/jsonvalidator.py +++ b/docs/jsonvalidator.py @@ -165,7 +165,7 @@ def main() -> int: 'returned': list, 'modules': dict, } - assert_has_typed_keys(f'root.objects_by_type', refs, expected) + assert_has_typed_keys('root.objects_by_type', refs, expected) assert not refs, f'root.objects_by_type has extra keys: {refs.keys()}' assert all(isinstance(x, str) for x in root['objects_by_type']['elementary']) assert all(isinstance(x, str) for x in root['objects_by_type']['builtins']) diff --git a/docs/refman/generatorprint.py b/docs/refman/generatorprint.py index b1ed37558..3b7a036ea 100644 --- a/docs/refman/generatorprint.py +++ b/docs/refman/generatorprint.py @@ -2,7 +2,7 @@ # Copyright 2021 The Meson development team from .generatorbase import GeneratorBase -from .model import ReferenceManual, Object, Function, DataTypeInfo, Type, ObjectType +from .model import Object, Function, DataTypeInfo, Type, ObjectType from mesonbuild import mlog import typing as T diff --git a/docs/refman/loaderyaml.py b/docs/refman/loaderyaml.py index ed6e7d837..553b3d91a 100644 --- a/docs/refman/loaderyaml.py +++ b/docs/refman/loaderyaml.py @@ -252,7 +252,7 @@ class LoaderYAML(LoaderBase): def _load_object(self, obj_type: ObjectType, path: Path) -> Object: path_label = path.relative_to(self.yaml_dir).as_posix() - mlog.log(f'Loading', mlog.bold(path_label)) + mlog.log('Loading', mlog.bold(path_label)) raw = self._load(self.read_file(path), self.template.s_object, label=path_label) def as_methods(mlist: T.List[Function]) -> T.List[Method]: diff --git a/mesonbuild/mesonlib.py b/mesonbuild/mesonlib.py index 89b3a1ca4..459b05b40 100644 --- a/mesonbuild/mesonlib.py +++ b/mesonbuild/mesonlib.py @@ -6,7 +6,6 @@ """Helper functions and classes.""" -import os from .utils.core import * from .utils.vsenv import * diff --git a/packaging/mpackage.py b/packaging/mpackage.py index e457e5580..9da8f57d2 100755 --- a/packaging/mpackage.py +++ b/packaging/mpackage.py @@ -4,7 +4,7 @@ # This script only works on Jussi's private release machine. -import os, sys, subprocess, re, shutil +import os, sys, subprocess, shutil import tarfile from glob import glob import pathlib diff --git a/run_meson_command_tests.py b/run_meson_command_tests.py index a5e5a2e5a..609eb18ba 100755 --- a/run_meson_command_tests.py +++ b/run_meson_command_tests.py @@ -6,7 +6,6 @@ import os import tempfile import unittest import subprocess -import zipapp import sysconfig from pathlib import Path diff --git a/run_tests.py b/run_tests.py index 2e375cbd7..6919bd0e1 100755 --- a/run_tests.py +++ b/run_tests.py @@ -10,9 +10,7 @@ from mesonbuild import _pathlib import sys sys.modules['pathlib'] = _pathlib -import collections import os -import time import shutil import subprocess import platform @@ -38,7 +36,6 @@ from mesonbuild.tooldetect import detect_ninja from mesonbuild.coredata import version as meson_version from mesonbuild.options import backendlist from mesonbuild.mesonlib import setup_vsenv -from mesonbuild.options import OptionKey if T.TYPE_CHECKING: from mesonbuild.coredata import SharedCMDOptions diff --git a/test cases/common/299 program in kwargs/customtarget.py b/test cases/common/299 program in kwargs/customtarget.py index efbd580ab..5fd80ddbc 100644 --- a/test cases/common/299 program in kwargs/customtarget.py +++ b/test cases/common/299 program in kwargs/customtarget.py @@ -1,7 +1,6 @@ #!/usr/bin/env python3 import argparse -import os def main() -> None: diff --git a/tools/boost_names.py b/tools/boost_names.py index 3afff163c..19d07fb03 100755 --- a/tools/boost_names.py +++ b/tools/boost_names.py @@ -256,12 +256,12 @@ def main() -> int: """), ' ')) if export_modules: - print(textwrap.dedent(f'''\ - }} + print(textwrap.dedent('''\ + } # dict of all modules with metadata - boost_modules = {{\ + boost_modules = {\ ''')) for mod in modules: @@ -275,8 +275,8 @@ def main() -> int: ),\ """), ' ')) - print(textwrap.dedent(f'''\ - }} + print(textwrap.dedent('''\ + } # # #### ---- END GENERATED ---- ####\ diff --git a/tools/copy_files.py b/tools/copy_files.py index c13ebcc9e..506de8b47 100644 --- a/tools/copy_files.py +++ b/tools/copy_files.py @@ -14,9 +14,9 @@ PathLike = T.Union[Path,str] def copy_files(files: T.List[str], input_dir: PathLike, output_dir: PathLike) -> None: if not input_dir: - raise ValueError(f'Input directory value is not set') + raise ValueError('Input directory value is not set') if not output_dir: - raise ValueError(f'Output directory value is not set') + raise ValueError('Output directory value is not set') input_dir = Path(input_dir).resolve() output_dir = Path(output_dir).resolve() diff --git a/tools/regenerate_docs.py b/tools/regenerate_docs.py index b7484e765..c4807a55c 100755 --- a/tools/regenerate_docs.py +++ b/tools/regenerate_docs.py @@ -146,7 +146,7 @@ def generate_wrapdb_table(output_dir: Path) -> None: def regenerate_docs(output_dir: PathLike, dummy_output_file: T.Optional[PathLike]) -> None: if not output_dir: - raise ValueError(f'Output directory value is not set') + raise ValueError('Output directory value is not set') output_dir = Path(output_dir).resolve() output_dir.mkdir(parents=True, exist_ok=True) diff --git a/unittests/allplatformstests.py b/unittests/allplatformstests.py index b5ff404fd..3c437598f 100644 --- a/unittests/allplatformstests.py +++ b/unittests/allplatformstests.py @@ -16,7 +16,7 @@ import pickle import zipfile, tarfile import sys import sysconfig -from unittest import mock, SkipTest, skipIf, skipUnless, expectedFailure +from unittest import mock, SkipTest, skipIf, skipUnless from contextlib import contextmanager from glob import glob from pathlib import (PurePath, Path) @@ -935,7 +935,7 @@ class AllPlatformTests(BasePlatformTests): try: self._run(command) self.assertEqual(0, failure_count, 'Expected %d tests to fail.' % failure_count) - except subprocess.CalledProcessError as e: + except subprocess.CalledProcessError: actual_fails = 0 with open(os.path.join(self.logdir, 'testlog.json'), encoding='utf-8') as f: for line in f: @@ -3454,7 +3454,7 @@ class AllPlatformTests(BasePlatformTests): with tempfile.NamedTemporaryFile(mode='w', delete=False, encoding='utf-8') as cross_file: cross_file.write( - textwrap.dedent(f''' + textwrap.dedent(''' [binaries] pkg-config = 'pkg-config' ''') diff --git a/unittests/baseplatformtests.py b/unittests/baseplatformtests.py index 32ab1c6a1..9c4a9153b 100644 --- a/unittests/baseplatformtests.py +++ b/unittests/baseplatformtests.py @@ -238,7 +238,7 @@ class BasePlatformTests(TestCase): if inprocess: try: returncode, out, err = run_configure_inprocess(['setup'] + self.meson_args + args + extra_args + build_and_src_dir_args, override_envvars) - except Exception as e: + except Exception: if not allow_fail: self._print_meson_log() raise diff --git a/unittests/cargotests.py b/unittests/cargotests.py index 70cd25868..bf7cfb9cc 100644 --- a/unittests/cargotests.py +++ b/unittests/cargotests.py @@ -3,7 +3,6 @@ from __future__ import annotations import unittest -from unittest import mock import os import tempfile import textwrap @@ -12,7 +11,7 @@ import typing as T from mesonbuild.cargo import cfg from mesonbuild.cargo.cfg import TokenType from mesonbuild.cargo.interpreter import load_cargo_lock -from mesonbuild.cargo.manifest import Dependency, Lint, Manifest, Package, Workspace +from mesonbuild.cargo.manifest import Dependency, Manifest, Package, Workspace from mesonbuild.cargo.toml import load_toml from mesonbuild.cargo.version import api, cargo_parse, SemVer from mesonbuild.mesonlib import MachineChoice, MesonException diff --git a/unittests/internaltests.py b/unittests/internaltests.py index fc86a541a..4fb503d0a 100644 --- a/unittests/internaltests.py +++ b/unittests/internaltests.py @@ -45,7 +45,7 @@ from mesonbuild.interpreterbase import ( KwargInfo, PosArgInfo, VarArgInfo, ) from mesonbuild.mesonlib import ( - FileMode, LibType, MachineChoice, PerMachine, SimpleABC, Version, is_windows, is_osx, + FileMode, LibType, MachineChoice, SimpleABC, Version, is_windows, is_osx, is_cygwin, is_openbsd, search_version, MesonException, EnvironmentException, python_command, version_check_to_range, ) @@ -57,7 +57,6 @@ from mesonbuild.interpreter.type_checking import ( from mesonbuild.dependencies.pkgconfig import PkgConfigDependency, PkgConfigInterface, PkgConfigCLI from mesonbuild.programs import ExternalProgram import mesonbuild.modules.pkgconfig -from mesonbuild import utils from run_tests import get_fake_env, get_fake_options diff --git a/unittests/linuxcrosstests.py b/unittests/linuxcrosstests.py index 3b06a2a2c..f4debcfd3 100644 --- a/unittests/linuxcrosstests.py +++ b/unittests/linuxcrosstests.py @@ -2,7 +2,6 @@ # Copyright 2016-2021 The Meson development team import os -import shutil import subprocess import unittest import platform diff --git a/unittests/linuxliketests.py b/unittests/linuxliketests.py index d6d8dc2fb..c638069e9 100644 --- a/unittests/linuxliketests.py +++ b/unittests/linuxliketests.py @@ -1878,14 +1878,14 @@ class LinuxlikeTests(BasePlatformTests): # Verify that "gcc -m32" works try: self.do_one_test_with_nativefile('1 trivial', "['gcc', '-m32']") - except subprocess.CalledProcessError as e: + except subprocess.CalledProcessError: raise SkipTest('Not GCC, or GCC does not have the -m32 option') self.wipe() # Verify that cmake works try: self.do_one_test_with_nativefile('../cmake/1 basic', "['gcc']") - except subprocess.CalledProcessError as e: + except subprocess.CalledProcessError: raise SkipTest('Could not build basic cmake project') self.wipe() diff --git a/unittests/platformagnostictests.py b/unittests/platformagnostictests.py index 980c0a47a..118867fc4 100644 --- a/unittests/platformagnostictests.py +++ b/unittests/platformagnostictests.py @@ -8,7 +8,6 @@ import os import pickle import subprocess import tempfile -import subprocess import textwrap import shutil from unittest import skipIf, SkipTest diff --git a/unittests/rewritetests.py b/unittests/rewritetests.py index 4bf8283ec..352e77aec 100644 --- a/unittests/rewritetests.py +++ b/unittests/rewritetests.py @@ -12,7 +12,7 @@ import typing as T from mesonbuild.ast import IntrospectionInterpreter, AstIDGenerator from mesonbuild.ast.printer import RawPrinter -from mesonbuild.mesonlib import windows_proof_rmtree, is_windows, is_linux +from mesonbuild.mesonlib import windows_proof_rmtree from .baseplatformtests import BasePlatformTests from .helpers import skip_if_not_language diff --git a/unittests/windowstests.py b/unittests/windowstests.py index ee447dfa9..8e3d50f01 100644 --- a/unittests/windowstests.py +++ b/unittests/windowstests.py @@ -19,7 +19,6 @@ from mesonbuild.mesonlib import ( MachineChoice, is_windows, is_cygwin, python_command, version_compare, EnvironmentException ) -from mesonbuild.options import OptionKey from mesonbuild.compilers import ( detect_c_compiler, detect_d_compiler, compiler_from_language, )