Skip to content
This repository has been archived by the owner on Jan 30, 2023. It is now read-only.

Commit

Permalink
Some cleanup and getting category stubs ready.
Browse files Browse the repository at this point in the history
  • Loading branch information
Travis Scrimshaw committed Apr 12, 2015
1 parent 96547d2 commit bdb08fb
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 90 deletions.
15 changes: 0 additions & 15 deletions src/sage/categories/groups.py
Original file line number Diff line number Diff line change
Expand Up @@ -958,19 +958,4 @@ class Topological(TopologicalSpacesCategory):
- :wikipedia:`Topological_group`
"""
def additional_structure(self):
r"""
Return ``None``.
Indeed, the category of topolgocial groups defines no new
structure: a morphism of groups and of topological spaces
between two topological groups is a topological group morphism.
.. SEEALSO:: :meth:`Category.additional_structure`
EXAMPLES::
sage: Groups().Topological().additional_structure()
"""
return None

11 changes: 10 additions & 1 deletion src/sage/categories/lie_groups.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,11 @@
from sage.categories.category import Category
from sage.categories.category_types import Category_over_base_ring
from sage.categories.sets_cat import Sets
from sage.categories.groups import Groups
from sage.categories.manifolds import Manifolds
from sage.rings.all import RR

class Manifolds(Category_over_base_ring):
class LieGroups(Category_over_base_ring):
r"""
The category of Lie groups.
Expand All @@ -42,6 +45,12 @@ class Manifolds(Category_over_base_ring):
sage: TestSuite(C).run()
"""
def __init__(self, R=RR):
"""
Initialize ``self``.
"""
Category_over_base_ring.__init__(self, RR)

@cached_method
def super_categories(self):
"""
Expand Down
74 changes: 0 additions & 74 deletions src/sage/categories/topological_spaces.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,80 +18,6 @@ class TopologicalSpacesCategory(RegressiveCovariantConstructionCategory):

_functor_category = "Topological"

# Currently no use case for this
@lazy_class_attribute
def _base_category_class(cls):
"""
Recover the class of the base category.
OUTPUT:
A *tuple* whose first entry is the base category class.
.. WARNING::
This is only used for graded categories that are not
implemented as nested classes, and won't work otherwise.
.. SEEALSO:: :meth:`__classcall__`
EXAMPLES::
sage: GradedModules._base_category_class
(<class 'sage.categories.modules.Modules'>,)
sage: GradedAlgebrasWithBasis._base_category_class
(<class 'sage.categories.algebras_with_basis.AlgebrasWithBasis'>,)
The reason for wrapping the base category class in a tuple is
that, often, the base category class implements a
:meth:`__classget__` method which would get in the way upon
attribute access::
sage: F = GradedAlgebrasWithBasis
sage: F._foo = F._base_category_class[0]
sage: F._foo
Traceback (most recent call last):
...
AssertionError: base category class for <...AlgebrasWithBasis'> mismatch;
expected <...Algebras'>, got <...GradedAlgebrasWithBasis'>
"""
module_name = cls.__module__.replace("topological_","")
import sys
name = cls.__name__.replace("Topological","")
__import__(module_name)
module = sys.modules[module_name]
return (module.__dict__[name],)

@staticmethod
def __classcall__(cls, category=None, *args):
"""
Magic support for putting topological categories in their own file.
EXAMPLES::
sage: TopologicalSpaces() # indirect doctest
Category of graded modules over Integer Ring
sage: Sets().Topological()
Category of graded modules over Integer Ring
sage: TopologicalSpaces() is Sets().Topological()
True
.. TODO::
Generalize this support for all other functorial
constructions if at some point we have a category ``Blah`` for
which we want to implement the construction ``Blah.Foo`` in a
separate file like we do for e.g. :class:`GradedModules`,
:class:`GradedAlgebras`, ...
.. SEEALSO:: :meth:`_base_category_class`
"""
base_category_class = cls._base_category_class[0]
if isinstance(category, base_category_class):
return super(TopologicalSpacesCategory, cls).__classcall__(cls, category, *args)
else:
return base_category_class(category, *args).Topological()

def _repr_object_names(self):
"""
EXAMPLES::
Expand Down

0 comments on commit bdb08fb

Please sign in to comment.