]> gitweb.michael.orlitzky.com - sage.d.git/commitdiff
mjo/clan/clan_operator.py: undo _is_clan() hack
authorMichael Orlitzky <michael@orlitzky.com>
Sat, 21 Feb 2026 15:25:52 +0000 (10:25 -0500)
committerMichael Orlitzky <michael@orlitzky.com>
Sat, 21 Feb 2026 15:25:52 +0000 (10:25 -0500)
And just like that, it starts working for no reason.

mjo/clan/clan_operator.py

index a738d2207894d82ff0cf1379363bac5c26a01ad6..9f689e57668643ebf78c0f7f5c1eb6299fbdd984 100644 (file)
@@ -1,13 +1,6 @@
 from sage.categories.map import Map
 from sage.categories.modules_with_basis import ModulesWithBasis
 
-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"""
@@ -38,9 +31,12 @@ class ClanOperator(Map):
     """
 
     def __init__(self, domain, codomain, mat):
-        if not _is_clan(domain):
+        from mjo.clan.clan import Clans
+
+        # Uses __classcontains__ hack for parametrized categories
+        if not domain in Clans:
             raise TypeError("domain must be a clan")
-        if not _is_clan(codomain):
+        if not codomain in Clans:
             raise TypeError("codomain must be a clan")
 
         F = domain.base_ring()