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 aPythonModule
with a tag name that differs from the systematic tag name. As an example for this use case, seeMeataxe
.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.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.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.
- unhide()[source]¶
Revert what
hide()
did.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() 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.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() >>> 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)