From: Lele Gaifax Date: Mon, 31 Oct 2022 07:54:36 +0000 (+0100) Subject: Pacify mypy, explicitly return None if the range is not a discrete one X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=81d99cca361729872b763092e8c57a6e237230fb;p=thirdparty%2Fsqlalchemy%2Fsqlalchemy.git Pacify mypy, explicitly return None if the range is not a discrete one --- diff --git a/lib/sqlalchemy/dialects/postgresql/ranges.py b/lib/sqlalchemy/dialects/postgresql/ranges.py index ce260cac7a..9a05411c00 100644 --- a/lib/sqlalchemy/dialects/postgresql/ranges.py +++ b/lib/sqlalchemy/dialects/postgresql/ranges.py @@ -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`."