Commits (3)
......@@ -5,9 +5,11 @@ EXAMPLES::
sage: from sagetypes import Exporter
sage: e = Exporter()
sage: e.harvest_categories()
sage: e.harvest_sage_object(TransitiveGroups())
sage: e.harvest_sage_object(TransitiveGroup(4,1))
sage: e.harvest_sage_object(TransitiveGroup(4,1).an_element())
sage: for P in [ TransitiveGroup(4,1), Partitions(100), QQ['x,y'] ]:
....: e.harvest_sage_object(P)
....: e.harvest_sage_object(P.an_element())
sage: e.save('transitive_groups.json')
.. TODO::
......@@ -16,9 +18,49 @@ EXAMPLES::
- How to separate mathematical metadata from technical stuff
- Currently, the metadata for an instance is added to that of its class;
if there are several instances with the same class, the last one wins
sage: import openmath.convert
sage: from openmath import openmath as om
sage: o = om.OMApplication(om.OMSymbol(name='apply_function', cd='python'),
....: [openmath.convert.to_openmath(x) for x in
["sage.rings.finite_rings.integer_mod_ring.IntegerModRing", int(3)]])
sage: openmath.convert.to_python(o)
Ring of integers modulo 3
sage: o = om.OMApplication(om.OMSymbol(name='apply_function', cd='python'),
....: [openmath.convert.to_openmath(x) for x in
....: ["GL", int(3), int(4)]])
sage: openmath.convert.to_python(o)
General Linear Group of degree 3 over Finite Field in a of size 2^2
n = 3
GL(n, n)
om.OMAttribution(om.OMAttributionPairs([ [ om.OMSymbol(name='n'), om.OMInteger(3) ] ],
om.OMApplication(om.OMSymbol(name='apply_function', cd='python'),
[OMString("GL"), n
import json
import json, importlib
import openmath.convert
def apply_python_function(o):
f = openmath.convert.to_python(o.arguments[0]).split(".")
module = '.'.join(f[:-1])
if not module:
module = "sage.all"
module = importlib.import_module(module)
f = getattr(module, f[-1])
return f(*[openmath.convert.to_python(arg) for arg in o.arguments[1:]])
from sage.misc.misc import attrcall
from sage.misc.cachefunc import cached_function
from sage.misc.abstract_method import AbstractMethod
......@@ -32,6 +74,8 @@ from sage.structure.parent import Parent
from sage.structure.sage_object import SageObject
# import mygap
def related_categories(category):
result = list(category.super_categories())
for key,value in category.__class__.__base__.__dict__.iteritems():
This diff is collapsed.