]> gitweb.michael.orlitzky.com - sage.d.git/commitdiff
mjo/clan/clan_operator.py: god-awful hack for category check
authorMichael Orlitzky <michael@orlitzky.com>
Sat, 21 Feb 2026 14:30:04 +0000 (09:30 -0500)
committerMichael Orlitzky <michael@orlitzky.com>
Sat, 21 Feb 2026 14:30:04 +0000 (09:30 -0500)
mjo/clan/clan_operator.py

index 82c06395a65938eea5c3f8bb4623f782cb7ce415..dd57f43c96c22cccffada495cd70036cd3c2b814 100644 (file)
@@ -1,6 +1,14 @@
 from sage.categories.all import FreeModules
 from sage.categories.map import Map
 
+def _is_clan(x):
+    r"""
+    I'm sure there's a great reason why this basic functionality
+    doesn't work, but I don't have the time to waste right now.
+    """
+    return any( str(c).startswith("Category of clans")
+                for c in x.categories() )
+
 class ClanOperator(Map):
     r"""
     An operator between two clans.
@@ -30,11 +38,9 @@ class ClanOperator(Map):
     """
 
     def __init__(self, domain, codomain, mat):
-        from mjo.clan.clan import Clans
-
-        if not domain in Clans:
+        if not _is_clan(domain):
             raise TypeError("domain must be a clan")
-        if not codomain in Clans:
+        if not _is_clan(codomain):
             raise TypeError("codomain must be a clan")
 
         F = domain.base_ring()