Closed dcoudert closed 5 years ago
So far I'm unable to fix the issues.
Branch: public/graphs/28371_csdp
Author: David Coudert
The current fix is not compatible with python2.
f-strings only appears with python3.6.
sage -t --long src/sage/graphs/lovasz_theta.py
Traceback (most recent call last):
File "/home/vklein/odk/sage/src/bin/sage-runtests", line 177, in <module>
from sage.doctest.control import DocTestController
File "/home/vklein/odk/sage/local/lib/python2.7/site-packages/sage/doctest/control.py", line 33, in <module>
from .sources import FileDocTestSource, DictAsObject
File "/home/vklein/odk/sage/local/lib/python2.7/site-packages/sage/doctest/sources.py", line 33, in <module>
from .parsing import SageDocTestParser
File "/home/vklein/odk/sage/local/lib/python2.7/site-packages/sage/doctest/parsing.py", line 66, in <module>
from sage.all import RealIntervalField
File "/home/vklein/odk/sage/local/lib/python2.7/site-packages/sage/all.py", line 103, in <module>
from sage.modular.all import *
File "/home/vklein/odk/sage/local/lib/python2.7/site-packages/sage/modular/all.py", line 54, in <module>
from .btquotients.all import *
File "/home/vklein/odk/sage/local/lib/python2.7/site-packages/sage/modular/btquotients/all.py", line 2, in <module>
from .btquotient import BruhatTitsQuotient
File "/home/vklein/odk/sage/local/lib/python2.7/site-packages/sage/modular/btquotients/btquotient.py", line 51, in <module>
from sage.graphs.all import Graph
File "/home/vklein/odk/sage/local/lib/python2.7/site-packages/sage/graphs/all.py", line 8, in <module>
from .graph_database import GraphDatabase, GenericGraphQuery, GraphQuery
File "/home/vklein/odk/sage/local/lib/python2.7/site-packages/sage/graphs/graph_database.py", line 48, in <module>
from . import graph
File "/home/vklein/odk/sage/local/lib/python2.7/site-packages/sage/graphs/graph.py", line 425, in <module>
class Graph(GenericGraph):
File "/home/vklein/odk/sage/local/lib/python2.7/site-packages/sage/graphs/graph.py", line 8650, in Graph
from sage.graphs.lovasz_theta import lovasz_theta
File "/home/vklein/odk/sage/local/lib/python2.7/site-packages/sage/graphs/lovasz_theta.py", line 75
tf.write(f"{n}\n{g.number_of_edges()}\n".encode())
^
SyntaxError: invalid syntax
Branch pushed to git repo; I updated commit sha1. New commits:
04ff9b4 | trac #28371: compatibility with Python 2 |
Sorry, fixed.
I have another slight (non blocking) concern with result = lines.decode().strip().split('\n')[-1]
and python2.
With this code in python2 result
is in unicode and the other string used .split('\n')
and re.match("^The Lovasz Theta Number is (.*)$", result)
are in bytes.
It works as it is but i think it would be cleaner to use bytes_to_str
from sage.cpython.string
instead of decode
.
That way result
will be of type str
in both py2 and py3.
Branch pushed to git repo; I updated commit sha1. New commits:
27a9342 | trac #28371: use bytes_to_str instead of .decode() in features/csdp.py |
It is ok like that?
Yes ! Thanks !
Reviewer: Vincent Klein
Thank you. These were the last known Py3 failing doctests in the graph module ;)
Changed branch from public/graphs/28371_csdp to 27a9342
CC: @dimpase @vinklein
Component: graph theory
Author: David Coudert
Branch/Commit:
27a9342
Reviewer: Vincent Klein
Issue created by migration from https://trac.sagemath.org/ticket/28371