From adcb7da67941c796fc66786a8915e0ac84444e8b Mon Sep 17 00:00:00 2001 From: Alex Richardson Date: Thu, 8 Feb 2024 14:35:39 -0800 Subject: [PATCH] Fix a few ruff --preview warnings --- pycheribuild/config/chericonfig.py | 3 ++- pycheribuild/config/config_loader_base.py | 2 +- pycheribuild/projects/run_fvp.py | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/pycheribuild/config/chericonfig.py b/pycheribuild/config/chericonfig.py index 6e74e0fa2..b99a9b725 100644 --- a/pycheribuild/config/chericonfig.py +++ b/pycheribuild/config/chericonfig.py @@ -30,6 +30,7 @@ import collections import getpass import grp +import inspect import os import re import shutil @@ -577,7 +578,7 @@ def _ensure_required_properties_set(self) -> bool: if key in self.__optional_properties: continue # don't do the descriptor stuff: - value = object.__getattribute__(self, key) + value = inspect.getattr_static(self, key) if value is None: raise RuntimeError("Required property " + key + " is not set!") assert self.cheri_sdk_dir.is_absolute(), self.cheri_sdk_dir diff --git a/pycheribuild/config/config_loader_base.py b/pycheribuild/config/config_loader_base.py index 1fe2fc2fc..ecba3f6fa 100644 --- a/pycheribuild/config/config_loader_base.py +++ b/pycheribuild/config/config_loader_base.py @@ -331,7 +331,7 @@ def _convert_type(self, loaded_result: _LoadedConfigValue) -> "Optional[T]": result = loaded_result.value # self.debug_msg("Converting", result, "to", self.value_type) # if the requested type is list, tuple, etc. use shlex.split() to convert strings to lists - if self.value_type != str and isinstance(result, str): + if self.value_type is not str and isinstance(result, str): if isinstance(self.value_type, type) and issubclass(self.value_type, collections.abc.Sequence): string_value = result result = shlex.split(string_value) diff --git a/pycheribuild/projects/run_fvp.py b/pycheribuild/projects/run_fvp.py index 5bdd86199..ca81b8dd2 100644 --- a/pycheribuild/projects/run_fvp.py +++ b/pycheribuild/projects/run_fvp.py @@ -694,7 +694,7 @@ def add_hostbridge_params(*params): tcp_ports += [gdb_port] # XXX this matches on any host address; that may not be quite right for x in self.extra_tcp_forwarding: - if x == "": + if not x: self.fatal("Bad extra-tcp-forwarding (empty forward?)") continue hg = x.split("=")