From 4c7e63364f53b940084bc46ca2d29b50dc3aab7f Mon Sep 17 00:00:00 2001 From: Egor Tensin Date: Sun, 17 Jan 2021 14:49:48 +0300 Subject: fix PyLint warnings --- project/boost/toolchain.py | 2 +- project/ci/appveyor/generator.py | 4 ++-- project/ci/cmake.py | 2 +- project/cmake/toolchain.py | 3 ++- project/configuration.py | 6 +++--- project/linkage.py | 6 +++--- project/os.py | 2 +- project/platform.py | 6 +++--- project/toolchain.py | 6 +++--- 9 files changed, 19 insertions(+), 18 deletions(-) (limited to 'project') diff --git a/project/boost/toolchain.py b/project/boost/toolchain.py index cce06a4..37f24ea 100644 --- a/project/boost/toolchain.py +++ b/project/boost/toolchain.py @@ -452,6 +452,6 @@ class Clang(ConfigFile): class ClangCL(Toolchain): def get_b2_args(self): return super().get_b2_args() + [ - f'toolset=clang-win', + 'toolset=clang-win', 'define=BOOST_USE_WINDOWS_H', ] diff --git a/project/ci/appveyor/generator.py b/project/ci/appveyor/generator.py index dc1fa13..19c11df 100644 --- a/project/ci/appveyor/generator.py +++ b/project/ci/appveyor/generator.py @@ -15,7 +15,7 @@ class Image(Enum): VS_2019 = 'Visual Studio 2019' def __str__(self): - return self.value + return str(self.value) @staticmethod def parse(s): @@ -36,7 +36,7 @@ class Generator(Enum): VS_2019 = 'Visual Studio 16 2019' def __str__(self): - return self.value + return str(self.value) @staticmethod def from_image(image): diff --git a/project/ci/cmake.py b/project/ci/cmake.py index df2b55a..2f801de 100644 --- a/project/ci/cmake.py +++ b/project/ci/cmake.py @@ -26,7 +26,7 @@ def _parse_args(dirs, argv=None): help='set Boost directory path') parser.add_argument('--toolset', metavar='TOOLSET', type=ToolchainType.parse, - help=f'toolset to use') + help='toolset to use') parser.add_argument('cmake_args', nargs='*', metavar='CMAKE_ARG', default=[], help='additional CMake arguments, to be passed verbatim') return parser.parse_args(argv) diff --git a/project/cmake/toolchain.py b/project/cmake/toolchain.py index 7c96628..7966192 100644 --- a/project/cmake/toolchain.py +++ b/project/cmake/toolchain.py @@ -189,7 +189,8 @@ class Makefile(Toolchain): def _get_config_path(build_dir): return os.path.join(build_dir, 'custom_toolchain.cmake') - def _get_makefile_generator(self): + @staticmethod + def _get_makefile_generator(): if on_windows(): if shutil.which('mingw32-make'): return 'MinGW Makefiles' diff --git a/project/configuration.py b/project/configuration.py index 50489fa..4b25c6e 100644 --- a/project/configuration.py +++ b/project/configuration.py @@ -16,7 +16,7 @@ class Configuration(Enum): RELEASE = 'Release' def __str__(self): - return self.value + return str(self.value) @staticmethod def all(): @@ -26,8 +26,8 @@ class Configuration(Enum): def parse(s): try: return Configuration(s) - except ValueError: - raise argparse.ArgumentTypeError(f'invalid configuration: {s}') + except ValueError as e: + raise argparse.ArgumentTypeError(f'invalid configuration: {s}') from e def to_boost_variant(self): '''Roughly maps CMake's CMAKE_BUILD_TYPE to Boost's variant. diff --git a/project/linkage.py b/project/linkage.py index 7019049..ffef071 100644 --- a/project/linkage.py +++ b/project/linkage.py @@ -12,7 +12,7 @@ class Linkage(Enum): SHARED = 'shared' def __str__(self): - return self.value + return str(self.value) @staticmethod def all(): @@ -22,5 +22,5 @@ class Linkage(Enum): def parse(s): try: return Linkage(s) - except ValueError: - raise argparse.ArgumentTypeError(f'invalid linkage: {s}') + except ValueError as e: + raise argparse.ArgumentTypeError(f'invalid linkage: {s}') from e diff --git a/project/os.py b/project/os.py index 53b64e1..eaa63db 100644 --- a/project/os.py +++ b/project/os.py @@ -13,7 +13,7 @@ class OS(Enum): CYGWIN = 'Cygwin' def __str__(self): - return self.value + return str(self.value) @staticmethod def current(): diff --git a/project/platform.py b/project/platform.py index 8eb7f3e..d25827b 100644 --- a/project/platform.py +++ b/project/platform.py @@ -15,7 +15,7 @@ class Platform(Enum): X64 = 'x64' def __str__(self): - return self.value + return str(self.value) @staticmethod def native(): @@ -35,8 +35,8 @@ class Platform(Enum): # AppVeyor convention: return Platform.X86 return Platform(s) - except ValueError: - raise argparse.ArgumentTypeError(f'invalid platform: {s}') + except ValueError as e: + raise argparse.ArgumentTypeError(f'invalid platform: {s}') from e def get_address_model(self): '''Maps to Boost's address-model.''' diff --git a/project/toolchain.py b/project/toolchain.py index d931c6b..4d10872 100644 --- a/project/toolchain.py +++ b/project/toolchain.py @@ -31,7 +31,7 @@ class ToolchainType(Enum): CLANG_CL = 'clang-cl' def __str__(self): - return self.value + return str(self.value) @staticmethod def all(): @@ -41,5 +41,5 @@ class ToolchainType(Enum): def parse(s): try: return ToolchainType(s) - except ValueError: - raise argparse.ArgumentTypeError(f'invalid toolset: {s}') + except ValueError as e: + raise argparse.ArgumentTypeError(f'invalid toolset: {s}') from e -- cgit v1.2.3