From 5f07f204a026ba847182250d1b88173d11a4d07e Mon Sep 17 00:00:00 2001 From: Hamza Khan Date: Thu, 27 Nov 2025 01:47:02 +0500 Subject: [PATCH] Remove redundant __ne__ methods In Python 3, when __eq__ is defined, Python automatically provides __ne__ by negating __eq__. Explicitly defining __ne__ is redundant and unnecessary code. This removes the redundant __ne__ methods from HTTPBasicAuth and HTTPDigestAuth classes. All existing tests pass, confirming that Python's automatic __ne__ implementation works correctly. --- src/requests/auth.py | 6 ------ 1 file changed, 6 deletions(-) diff --git a/src/requests/auth.py b/src/requests/auth.py index 4a7ce6dc14..60fe16e6c8 100644 --- a/src/requests/auth.py +++ b/src/requests/auth.py @@ -88,9 +88,6 @@ def __eq__(self, other): ] ) - def __ne__(self, other): - return not self == other - def __call__(self, r): r.headers["Authorization"] = _basic_auth_str(self.username, self.password) return r @@ -309,6 +306,3 @@ def __eq__(self, other): self.password == getattr(other, "password", None), ] ) - - def __ne__(self, other): - return not self == other