diff options
author | Matthias Baumgartner <dev@igsor.net> | 2023-01-13 12:22:34 +0100 |
---|---|---|
committer | Matthias Baumgartner <dev@igsor.net> | 2023-01-13 12:22:34 +0100 |
commit | 60257ed3c2aa6ea2891f362a691bde9d7ef17831 (patch) | |
tree | 20b3226e879cb308552ed2955cdfa10ce79caf85 /bsfs/schema | |
parent | 1b7ef16c3795bb7112683662b8c22a774e219269 (diff) | |
download | bsfs-60257ed3c2aa6ea2891f362a691bde9d7ef17831.tar.gz bsfs-60257ed3c2aa6ea2891f362a691bde9d7ef17831.tar.bz2 bsfs-60257ed3c2aa6ea2891f362a691bde9d7ef17831.zip |
schema type comparison across classes
Diffstat (limited to 'bsfs/schema')
-rw-r--r-- | bsfs/schema/types.py | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/bsfs/schema/types.py b/bsfs/schema/types.py index 6257dee..95dc66a 100644 --- a/bsfs/schema/types.py +++ b/bsfs/schema/types.py @@ -150,8 +150,10 @@ class _Type(): def __lt__(self, other: typing.Any) -> bool: """Return True iff *self* is a true subclass of *other*.""" - if not isinstance(other, type(self)): + if not isinstance(other, _Type): return NotImplemented + if not isinstance(other, type(self)): # FIXME: necessary? + return False if self.uri == other.uri: # equivalence return False if self in other.parents(): # superclass @@ -163,8 +165,10 @@ class _Type(): def __le__(self, other: typing.Any) -> bool: """Return True iff *self* is equivalent or a subclass of *other*.""" - if not isinstance(other, type(self)): + if not isinstance(other, _Type): return NotImplemented + if not isinstance(other, type(self)): # FIXME: necessary? + return False if self.uri == other.uri: # equivalence return True if self in other.parents(): # superclass @@ -176,8 +180,10 @@ class _Type(): def __gt__(self, other: typing.Any) -> bool: """Return True iff *self* is a true superclass of *other*.""" - if not isinstance(other, type(self)): + if not isinstance(other, _Type): return NotImplemented + if not isinstance(other, type(self)): # FIXME: necessary? + return False if self.uri == other.uri: # equivalence return False if self in other.parents(): # superclass @@ -189,8 +195,10 @@ class _Type(): def __ge__(self, other: typing.Any) -> bool: """Return True iff *self* is eqiuvalent or a superclass of *other*.""" - if not isinstance(other, type(self)): + if not isinstance(other, _Type): return NotImplemented + if not isinstance(other, type(self)): # FIXME: necessary? + return False if self.uri == other.uri: # equivalence return True if self in other.parents(): # superclass |