sagemath/sage

sage.features: Remove dependency on sage.misc.lazy_string

Closed this issue · 11 comments

This allows us to package sage.features in a distribution without any dependencies in #29941.

CC: @kwankyu @seblabbe

Component: refactoring

Author: Matthias Koeppe

Branch/Commit: 9b5535b

Reviewer: Kwankyu Lee

Issue created by migration from https://trac.sagemath.org/ticket/32977

Author: Matthias Koeppe

New commits:

a1c8e51Feature.resolution: Just return a string
9b5535bFeatureNotPresentError, FeatureTestResult: Make resolution a property

Description changed:

--- 
+++ 
@@ -1 +1,2 @@
+This allows us to package `sage.features` in a distribution without any dependencies in #29941.
 

Commit: 9b5535b

comment:3

Perhaps

diff --git a/src/sage/features/__init__.py b/src/sage/features/__init__.py
index 73511b91a7..2617a13ebc 100644
--- a/src/sage/features/__init__.py
+++ b/src/sage/features/__init__.py
@@ -293,7 +293,7 @@ class FeatureNotPresentError(RuntimeError):
             lines.append(self.reason)
         resolution = self.resolution
         if resolution:
-            lines.append(str(resolution))
+            lines.append(resolution)
         return "\n".join(lines)
comment:4

I kept the str in case some user-defined Feature uses lazy strings

Reviewer: Kwankyu Lee

comment:5

Replying to @mkoeppe:

I kept the str in case some user-defined Feature uses lazy strings

Okay if you intended, though I doubt user-defined Feature is realistic.

Anyway, the branch looks good.

comment:6

Thanks!