From 443ee27b58ec27e23644b5b24df779394534f925 Mon Sep 17 00:00:00 2001 From: Nicola Soranzo Date: Wed, 15 Mar 2023 14:43:25 +0000 Subject: [PATCH] Enable ``strict_equality`` mypy option Also fix the following mypy error: ``` lib/galaxy/util/path/__init__.py:247: error: Non-overlapping equality check (left operand type: "struct_passwd", right operand type: "str") [comparison-overlap] or (file_owner == username and owner_permissions >= 4) ``` --- lib/galaxy/util/path/__init__.py | 2 +- mypy.ini | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/galaxy/util/path/__init__.py b/lib/galaxy/util/path/__init__.py index 92e8d2289801..1ed4896e88ce 100644 --- a/lib/galaxy/util/path/__init__.py +++ b/lib/galaxy/util/path/__init__.py @@ -244,7 +244,7 @@ def __path_permission_for_user(path: GenericPath, username: str) -> bool: other_permissions = int(oct_mode[-1]) if ( other_permissions >= 4 - or (file_owner == username and owner_permissions >= 4) + or (file_owner.pw_name == username and owner_permissions >= 4) or (username in group_members and group_permissions >= 4) ): return True diff --git a/mypy.ini b/mypy.ini index e04dffe2c5a9..5797bdaa82c1 100644 --- a/mypy.ini +++ b/mypy.ini @@ -6,6 +6,7 @@ exclude = lib/galaxy/tools/bundled|test/functional pretty = True no_implicit_reexport = True no_implicit_optional = True +strict_equality = True # green list - work on growing these please! [mypy-galaxy.util.compression_utils]