]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
Remove all `__nonzero__` methods (#8308)
authorNikita Sobolev <mail@sobolevn.me>
Sat, 30 Jul 2022 18:48:26 +0000 (21:48 +0300)
committerGitHub <noreply@github.com>
Sat, 30 Jul 2022 18:48:26 +0000 (20:48 +0200)
lib/sqlalchemy/event/attr.py
lib/sqlalchemy/ext/associationproxy.py
lib/sqlalchemy/orm/collections.py
lib/sqlalchemy/orm/dynamic.py
lib/sqlalchemy/sql/elements.py
lib/sqlalchemy/sql/lambdas.py

index 281699811741e97ea50e17075c28fe2489bd9ece..f8d70a06a6f817fa8a8ed8f6e4a862398d131102 100644 (file)
@@ -398,8 +398,6 @@ class _EmptyListener(_InstanceLevelDispatch[_ET]):
     def __bool__(self) -> bool:
         return bool(self.parent_listeners)
 
-    __nonzero__ = __bool__
-
 
 class _MutexProtocol(Protocol):
     def __enter__(self) -> bool:
@@ -509,8 +507,6 @@ class _CompoundListener(_InstanceLevelDispatch[_ET]):
     def __bool__(self) -> bool:
         return bool(self.listeners or self.parent_listeners)
 
-    __nonzero__ = __bool__
-
 
 class _ListenerCollection(_CompoundListener[_ET]):
     """Instance-level attributes on instances of :class:`._Dispatch`.
index 7db95eac9b385d35bb5db104c9de2077eeec10bd..f238f4f8ae7c9bdc7ed3de3a472f08dd4bc761c8 100644 (file)
@@ -1316,8 +1316,6 @@ class _AssociationCollection(Generic[_IT]):
     def __bool__(self) -> bool:
         return bool(self.col)
 
-    __nonzero__ = __bool__
-
     def __getstate__(self) -> Any:
         return {"parent": self.parent, "lazy_collection": self.lazy_collection}
 
@@ -1749,8 +1747,6 @@ class _AssociationSet(_AssociationSingleItem[_T], MutableSet[_T]):
         else:
             return False
 
-    __nonzero__ = __bool__
-
     def __contains__(self, __o: object) -> bool:
         for member in self.col:
             if self._get(member) == __o:
index 78fe89d05fbad6055ff3e11178fff5cf9d0cc976..f47d00634e2432fbcf9b570ae62c83177e2b72a9 100644 (file)
@@ -614,8 +614,6 @@ class CollectionAdapter:
     def __bool__(self):
         return True
 
-    __nonzero__ = __bool__
-
     def fire_append_wo_mutation_event(self, item, initiator=None):
         """Notify that a entity is entering the collection but is already
         present.
index 084ba969fb6d82d627d915aa7166fc428fc26c60..8663389bc3c626525832fb6e46274d6fd72568ef 100644 (file)
@@ -337,8 +337,6 @@ class DynamicCollectionAdapter:
     def __bool__(self):
         return True
 
-    __nonzero__ = __bool__
-
 
 class AppenderMixin:
     query_class = None
index 9db90cb02b4bf550f8f92328cf54a5be5cbd3ee8..71459f6794d6b504910d39faa5147dc13a5dfb1c 100644 (file)
@@ -696,8 +696,6 @@ class ClauseElement(
     def __bool__(self):
         raise TypeError("Boolean value of this clause is not defined")
 
-    __nonzero__ = __bool__
-
     def __repr__(self):
         friendly = self.description
         if friendly is None:
index c7464c91cbd91cb34e403280acfd8660df520a12..bbfaf47e1b1bb31114c82f92f1892f76d8b6e356 100644 (file)
@@ -1341,10 +1341,6 @@ class PyWrapper(ColumnOperators):
         to_evaluate = object.__getattribute__(self, "_to_evaluate")
         return bool(to_evaluate)
 
-    def __nonzero__(self):
-        to_evaluate = object.__getattribute__(self, "_to_evaluate")
-        return bool(to_evaluate)
-
     def __getattribute__(self, key):
         if key.startswith("_sa_"):
             return object.__getattribute__(self, key[4:])