Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
f51f29a
34185: initial version
soehms Jul 15, 2022
3071dbc
34185: correction according to review
soehms Jul 18, 2022
faacd11
Merge branch 'u/soehms/hide_features_34185' of trac.sagemath.org:sage…
soehms Jul 24, 2022
b4b562c
34185: take care of joined features
soehms Jul 25, 2022
ddd7ada
Merge branch 'u/soehms/hide_features_34185' of trac.sagemath.org:sage…
soehms Aug 3, 2022
70abb3f
Merge branch 'u/soehms/hide_features_34185' of trac.sagemath.org:sage…
soehms Aug 4, 2022
442fca6
Merge branch 'join_feature_texfile_with_pdflatex_34282' into hide_fea…
soehms Aug 5, 2022
f39836a
Merge branch 'circular_import_matrix_space_34283' into hide_features_…
soehms Aug 5, 2022
0ec6d46
Merge branch 'u/soehms/hide_features_34185' of trac.sagemath.org:sage…
soehms Aug 7, 2022
f463ac7
Merge branch 'join_feature_texfile_with_pdflatex_34282' into hide_fea…
soehms Aug 9, 2022
ebbd4a4
Merge branch 'circular_import_matrix_space_34283' into hide_features_…
soehms Aug 9, 2022
6912c1c
34185: fix doctest failure + pep8 fixes
soehms Aug 9, 2022
2e11970
Merge branch 'u/soehms/hide_features_34185' of trac.sagemath.org:sage…
soehms Sep 3, 2022
d676f79
Merge branch 'u/soehms/join_feature_texfile_with_pdflatex_34282' of t…
soehms Sep 6, 2022
187bdcf
34185: fix typos
soehms Sep 6, 2022
2a582f4
Merge branch 'u/soehms/hide_features_34185' of trac.sagemath.org:sage…
soehms Sep 30, 2022
f69396c
Merge branch 'u/soehms/hide_features_34185' of https://github.com/sag…
soehms May 22, 2023
b695c04
34185: fix RST issues
soehms May 22, 2023
c3da4d8
34185 / 35668: fixes according to review
soehms May 25, 2023
6dff841
Merge branch 'sagemath:develop' into hide_features_34185
soehms May 25, 2023
72d9da7
Merge branch 'develop' into hide_features_34185
soehms May 30, 2023
7d58d67
Merge branch 'develop' into hide_features_34185
soehms Jun 11, 2023
560228c
Merge branch 'sagemath:develop' into hide_features_34185
soehms Jun 11, 2023
d0ccd37
Merge branch 'hide_features_34185' of github.com:soehms/sage into hid…
soehms Jun 19, 2023
97eaac9
35668: pycodestyle fix
soehms Jun 19, 2023
3103888
Merge branch 'hide_features_34185' into feature_standard_optional_static
mkoeppe Jun 23, 2023
1fcdde3
sage.features: Declare type='standard' explicitly, check against SPKG…
mkoeppe Jun 23, 2023
fd8a32d
Terminology change
mkoeppe Jun 24, 2023
ad202ba
Add 'type=standard' in more places
mkoeppe Jun 24, 2023
62ad2a3
Add 'type=standard' in more places that use pplpy
mkoeppe Jun 25, 2023
98a8664
src/sage/features/cddlib.py: Add type='standard'
mkoeppe Jun 25, 2023
4eddb7c
src/sage/misc/package.py: Do not fail if SAGE_PKGS is not set
mkoeppe Jun 25, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
34185: fix doctest failure + pep8 fixes
  • Loading branch information
soehms committed Aug 9, 2022
commit 6912c1c90c32d40057c49c47a735730b5f461053
22 changes: 11 additions & 11 deletions src/sage/doctest/control.py
Original file line number Diff line number Diff line change
Expand Up @@ -1364,7 +1364,7 @@ def run(self):
sage: DC = DocTestController(DF, [filename])
sage: DC.run()
Running doctests with ID ...
Using --optional=sage
Using --optional=sage...
Features to be detected: ...
Doctesting 1 file.
sage -t ....py
Expand Down Expand Up @@ -1556,28 +1556,28 @@ def stringify(x):
# Declaration of doctest strings
###############################################################################

test_hide=r"""{}
sage: next(graphs.fullerenes(20))
test_hide=r"""r{quotmark}
{prompt}: next(graphs.fullerenes(20))
Traceback (most recent call last):
...
FeatureNotPresentError: buckygen is not available.
...
sage: next(graphs.fullerenes(20)) # optional buckygen
{prompt}: next(graphs.fullerenes(20)) # optional buckygen
Graph on 20 vertices

sage: len(list(graphs.fusenes(2)))
{prompt}: len(list(graphs.fusenes(2)))
Traceback (most recent call last):
...
FeatureNotPresentError: benzene is not available.
...
sage: len(list(graphs.fusenes(2))) # optional benzene
{prompt}: len(list(graphs.fusenes(2))) # optional benzene
1
sage: from sage.matrix.matrix_space import get_matrix_class
sage: get_matrix_class(GF(25,'x'), 4, 4, False, 'meataxe')
{prompt}: from sage.matrix.matrix_space import get_matrix_class
{prompt}: get_matrix_class(GF(25,'x'), 4, 4, False, 'meataxe')
Failed lazy import:
sage.matrix.matrix_gfpn_dense is not available.
...
sage: get_matrix_class(GF(25,'x'), 4, 4, False, 'meataxe') # optional meataxe
{prompt}: get_matrix_class(GF(25,'x'), 4, 4, False, 'meataxe') # optional meataxe
<class 'sage.matrix.matrix_gfpn_dense.Matrix_gfpn_dense'>
{}
""".format('r"""', '"""')
{quotmark}
""".format(quotmark='"""', prompt='sage') # using prompt to hide these lines from _test_enough_doctests
22 changes: 13 additions & 9 deletions src/sage/features/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,10 @@ def __call__(cls, *args, **kwds):
else:
return type.__call__(cls, *args, **kwds)


_trivial_unique_representation_cache = dict()


class TrivialUniqueRepresentation(metaclass=TrivialClasscallMetaClass):
r"""
A trivial version of :class:`UniqueRepresentation` without Cython dependencies.
Expand All @@ -92,6 +94,7 @@ def __classcall__(cls, *args, **options):
cached = _trivial_unique_representation_cache[key] = type.__call__(cls, *args, **options)
return cached


class Feature(TrivialUniqueRepresentation):
r"""
A feature of the runtime environment
Expand Down Expand Up @@ -244,7 +247,10 @@ def _spkg_type(self):
If no SPKG corresponds to this feature ``None`` is returned.
"""
from sage.misc.package import _spkg_type
return _spkg_type(self.name)
spkg = self.spkg
if not spkg:
spkg = self.name
return _spkg_type(spkg)

def resolution(self):
r"""
Expand Down Expand Up @@ -379,8 +385,6 @@ def unhide(self):
self._hidden = False




class FeatureNotPresentError(RuntimeError):
r"""
A missing feature error.
Expand Down Expand Up @@ -499,8 +503,6 @@ def __bool__(self):
"""
return bool(self.is_present)



def __repr__(self):
r"""
TESTS::
Expand All @@ -514,6 +516,7 @@ def __repr__(self):

_cache_package_systems = None


def package_systems():
"""
Return a list of :class:`~sage.features.pkg_systems.PackageSystem` objects
Expand Down Expand Up @@ -799,7 +802,9 @@ def absolute_filename(self) -> str:
A :class:`FeatureNotPresentError` is raised if the file cannot be found::

sage: from sage.features import StaticFile
sage: StaticFile(name="no_such_file", filename="KaT1aihu", search_path=(), spkg="some_spkg", url="http://rand.om").absolute_filename() # optional - sage_spkg
sage: StaticFile(name="no_such_file", filename="KaT1aihu",\
search_path=(), spkg="some_spkg",\
url="http://rand.om").absolute_filename() # optional - sage_spkg
Traceback (most recent call last):
...
FeatureNotPresentError: no_such_file is not available.
Expand All @@ -811,9 +816,8 @@ def absolute_filename(self) -> str:
path = os.path.join(directory, self.filename)
if os.path.isfile(path) or os.path.isdir(path):
return os.path.abspath(path)
raise FeatureNotPresentError(self,
reason="{filename!r} not found in any of {search_path}".format(filename=self.filename, search_path=self.search_path),
resolution=self.resolution())
reason = "{filename!r} not found in any of {search_path}".format(filename=self.filename, search_path=self.search_path)
raise FeatureNotPresentError(self, reason=reason, resolution=self.resolution())


class CythonFeature(Feature):
Expand Down