]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
Pacify mypy, explicitly return None if the range is not a discrete one
authorLele Gaifax <lele@metapensiero.it>
Mon, 31 Oct 2022 07:54:36 +0000 (08:54 +0100)
committerLele Gaifax <lele@metapensiero.it>
Mon, 31 Oct 2022 07:54:36 +0000 (08:54 +0100)
lib/sqlalchemy/dialects/postgresql/ranges.py

index ce260cac7ae0453d4218a9cda2aada96112e7308..9a05411c005ee24aedde866b6fed17d8c0005e17 100644 (file)
@@ -122,8 +122,10 @@ class Range(Generic[_T]):
 
         if isinstance(self.lower, int) or isinstance(self.upper, int):
             return 1
-        if isinstance(self.lower, date) or isinstance(self.upper, date):
+        elif isinstance(self.lower, date) or isinstance(self.upper, date):
             return timedelta(days=1)
+        else:
+            return None
 
     def _contained_by(self, other: Range) -> bool:
         "Determine whether this range is a contained by `other`."