#################################################################################1#2# (c) Copyright 2010 William Stein3#4# This file is part of PSAGE5#6# PSAGE is free software: you can redistribute it and/or modify7# it under the terms of the GNU General Public License as published by8# the Free Software Foundation, either version 3 of the License, or9# (at your option) any later version.10#11# PSAGE is distributed in the hope that it will be useful,12# but WITHOUT ANY WARRANTY; without even the implied warranty of13# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the14# GNU General Public License for more details.15#16# You should have received a copy of the GNU General Public License17# along with this program. If not, see <http://www.gnu.org/licenses/>.18#19#################################################################################20r"""21Category of function fields22"""232425from sage.categories.category import Category26from sage.misc.cachefunc import cached_method27from sage.categories.basic import Fields28from sage.rings.field import is_Field2930class FunctionFields(Category):31r"""32The category of function fields.3334EXAMPLES:3536We create the category of function fields::3738sage: C = FunctionFields()39sage: C40Category of function fields4142TESTS::4344sage: TestSuite(FunctionFields()).run()45"""4647@cached_method48def super_categories(self):49"""50EXAMPLES::5152sage: FunctionFields().super_categories()53[Category of fields]54"""55return[Fields()]5657def __contains__(self, x):58r"""59Returns True if ``x`` is a function field.6061EXAMPLES::6263"""64import sage.rings.all65return sage.rings.all.is_FunctionField(x)6667def _call_(self, x):68r"""69Constructs an object in this category from the data in ``x``,70or throws a TypeError.7172EXAMPLES::7374sage: C = FunctionFields()7576"""77try:78return x.function_field()79except AttributeError:80raise TypeError, "unable to canonically associate a function field to %s"%x818283class ParentMethods:84pass8586class ElementMethods:87pass888990