Join features#

class sage.features.join_feature.JoinFeature(*args, **kwds)[source]#

Bases: Feature

Join of several Feature instances.

This creates a new feature as the union of the given features. Typically these are executables of an SPKG. For an example, see Rubiks.

Furthermore, this can be the union of a single feature. This is used to map the given feature to a more convenient name to be used in optional tags of doctests. Thus you can equip a feature such as a PythonModule with a tag name that differs from the systematic tag name. As an example for this use case, see Meataxe.

EXAMPLES:

sage: from sage.features import Executable
sage: from sage.features.join_feature import JoinFeature
sage: F = JoinFeature("shell-boolean",
....:                 (Executable('shell-true', 'true'),
....:                  Executable('shell-false', 'false')))
sage: F.is_present()
FeatureTestResult('shell-boolean', True)
sage: F = JoinFeature("asdfghjkl",
....:                 (Executable('shell-true', 'true'),
....:                  Executable('xxyyyy', 'xxyyyy-does-not-exist')))
sage: F.is_present()
FeatureTestResult('xxyyyy', False)
from sage.features import Executable
from sage.features.join_feature import JoinFeature
F = JoinFeature("shell-boolean",
                (Executable('shell-true', 'true'),
                 Executable('shell-false', 'false')))
F.is_present()
F = JoinFeature("asdfghjkl",
                (Executable('shell-true', 'true'),
                 Executable('xxyyyy', 'xxyyyy-does-not-exist')))
F.is_present()
>>> from sage.all import *
>>> from sage.features import Executable
>>> from sage.features.join_feature import JoinFeature
>>> F = JoinFeature("shell-boolean",
...                 (Executable('shell-true', 'true'),
...                  Executable('shell-false', 'false')))
>>> F.is_present()
FeatureTestResult('shell-boolean', True)
>>> F = JoinFeature("asdfghjkl",
...                 (Executable('shell-true', 'true'),
...                  Executable('xxyyyy', 'xxyyyy-does-not-exist')))
>>> F.is_present()
FeatureTestResult('xxyyyy', False)
hide()[source]#

Hide this feature and all its joined features.

EXAMPLES:

sage: from sage.features.sagemath import sage__groups
sage: f = sage__groups()
sage: f.hide()
sage: f._features[0].is_present()
FeatureTestResult('sage.groups.perm_gps.permgroup', False)

sage: f.require()
Traceback (most recent call last):
...
FeatureNotPresentError: sage.groups is not available.
Feature `sage.groups` is hidden.
Use method `unhide` to make it available again.
from sage.features.sagemath import sage__groups
f = sage__groups()
f.hide()
f._features[0].is_present()
f.require()
>>> from sage.all import *
>>> from sage.features.sagemath import sage__groups
>>> f = sage__groups()
>>> f.hide()
>>> f._features[Integer(0)].is_present()
FeatureTestResult('sage.groups.perm_gps.permgroup', False)

>>> f.require()
Traceback (most recent call last):
...
FeatureNotPresentError: sage.groups is not available.
Feature `sage.groups` is hidden.
Use method `unhide` to make it available again.
is_functional()[source]#

Test whether the join feature is functional.

This method is deprecated. Use Feature.is_present() instead.

EXAMPLES:

sage: from sage.features.latte import Latte
sage: Latte().is_functional()  # optional - latte_int
doctest:warning...
DeprecationWarning: method JoinFeature.is_functional; use is_present instead
See https://github.com/sagemath/sage/issues/33114 for details.
FeatureTestResult('latte_int', True)
from sage.features.latte import Latte
Latte().is_functional()  # optional - latte_int
>>> from sage.all import *
>>> from sage.features.latte import Latte
>>> Latte().is_functional()  # optional - latte_int
doctest:warning...
DeprecationWarning: method JoinFeature.is_functional; use is_present instead
See https://github.com/sagemath/sage/issues/33114 for details.
FeatureTestResult('latte_int', True)
unhide()[source]#

Revert what hide() did.

OUTPUT: The number of events a present feature has been hidden.

EXAMPLES:

sage: from sage.features.sagemath import sage__groups
sage: f = sage__groups()
sage: f.hide()
sage: f.is_present()
FeatureTestResult('sage.groups', False)
sage: f._features[0].is_present()
FeatureTestResult('sage.groups.perm_gps.permgroup', False)

sage: f.unhide()
4
sage: f.is_present()    # optional sage.groups
FeatureTestResult('sage.groups', True)
sage: f._features[0].is_present() # optional sage.groups
FeatureTestResult('sage.groups.perm_gps.permgroup', True)
from sage.features.sagemath import sage__groups
f = sage__groups()
f.hide()
f.is_present()
f._features[0].is_present()
f.unhide()
f.is_present()    # optional sage.groups
f._features[0].is_present() # optional sage.groups
>>> from sage.all import *
>>> from sage.features.sagemath import sage__groups
>>> f = sage__groups()
>>> f.hide()
>>> f.is_present()
FeatureTestResult('sage.groups', False)
>>> f._features[Integer(0)].is_present()
FeatureTestResult('sage.groups.perm_gps.permgroup', False)

>>> f.unhide()
4
>>> f.is_present()    # optional sage.groups
FeatureTestResult('sage.groups', True)
>>> f._features[Integer(0)].is_present() # optional sage.groups
FeatureTestResult('sage.groups.perm_gps.permgroup', True)