From 42c1e2b8ba7a6dd57087e55ce9f6f854cb74e87c Mon Sep 17 00:00:00 2001 From: Scott K Logan Date: Tue, 12 Sep 2023 09:49:41 -0500 Subject: [PATCH] Address flake8 E721 violations (#580) These violations don't show up in our CI right now because we've pinned flake8<6, but when that pin is dropped, we'll have enforcement for this rule. --- colcon_core/package_augmentation/__init__.py | 2 +- colcon_core/package_descriptor.py | 2 +- colcon_core/verb/__init__.py | 2 +- test/test_argument_default.py | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/colcon_core/package_augmentation/__init__.py b/colcon_core/package_augmentation/__init__.py index 71acf7c1..3b579292 100644 --- a/colcon_core/package_augmentation/__init__.py +++ b/colcon_core/package_augmentation/__init__.py @@ -213,7 +213,7 @@ def update_metadata(desc, key, value): old_value |= value return - if type(old_value) != type(value): + if type(old_value) is not type(value): logger.warning( f"update package '{desc.name}' metadata '{key}' from value " f"'{old_value}' to '{value}'") diff --git a/colcon_core/package_descriptor.py b/colcon_core/package_descriptor.py index 19ad113f..0e61006d 100644 --- a/colcon_core/package_descriptor.py +++ b/colcon_core/package_descriptor.py @@ -149,7 +149,7 @@ def __hash__(self): # noqa: D105 return hash((self.type, self.name)) def __eq__(self, other): # noqa: D105 - if type(self) != type(other): + if type(self) is not type(other): return NotImplemented if (self.type, self.name) != (other.type, other.name): return False diff --git a/colcon_core/verb/__init__.py b/colcon_core/verb/__init__.py index 9b6e986e..640dc218 100644 --- a/colcon_core/verb/__init__.py +++ b/colcon_core/verb/__init__.py @@ -174,7 +174,7 @@ def update_object( return severity = 5 \ - if old_value is None or type(old_value) == type(value) \ + if old_value is None or type(old_value) is type(value) \ else logging.WARNING logger.log( severity, f"overwrite package '{package_name}' {argument_type} " diff --git a/test/test_argument_default.py b/test/test_argument_default.py index 8775c6d7..f7b2adeb 100644 --- a/test/test_argument_default.py +++ b/test/test_argument_default.py @@ -19,7 +19,7 @@ def test_argument_default(): unwrap_default_value(value) default_value = wrap_default_value(value) assert is_default_value(default_value) - assert type(default_value) != type(value) + assert type(default_value) is not type(value) with pytest.raises(ValueError): wrap_default_value(default_value) unwrapped_value = unwrap_default_value(default_value) @@ -27,5 +27,5 @@ def test_argument_default(): value = 42 unchanged_value = wrap_default_value(value) - assert type(unchanged_value) == type(value) + assert type(unchanged_value) is type(value) assert unchanged_value == value