Skip to content

Commit ea2758f

Browse files
author
Release Manager
committedAug 28, 2022
Trac #34211: Fix bug due to a call to SSLContext() in src/sage/graphs/isgci.py
{{{ sage: graph_classes._download_db() ------------------------------------------------------------------------ --- NameError Traceback (most recent call last) <ipython-input-1-3914f28ce325> in <module> ----> 1 graph_classes._download_db() /home/dcoudert/sage/local/var/lib/sage/venv-python3.10/lib64/python3.10 /site-packages/sage/graphs/isgci.py in _download_db(self) 829 import tempfile 830 u = urlopen('https://www.graphclasses.org/data.zip', --> 831 context=SSLContext()) 832 with tempfile.NamedTemporaryFile(suffix=".zip") as f: 833 f.write(u.read()) NameError: name 'SSLContext' is not defined }}} This bug was fixed in #33771, replacing the call to `SSLContext()` in `src/sage/graphs/isgci.py` with a call to `default_context()`, but this changes has been reverted in #33829. ---- Dependency on #34079 since it modifies this file. URL: https://trac.sagemath.org/34211 Reported by: dcoudert Ticket author(s): David Coudert Reviewer(s): Dima Pasechnik
2 parents e96e201 + 2302af6 commit ea2758f

File tree

3 files changed

+20
-58
lines changed

3 files changed

+20
-58
lines changed
 

‎build/pkgs/configure/checksums.ini

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
tarball=configure-VERSION.tar.gz
2-
sha1=901e5c9e8a79b5c68df39b889e8b4698fd230faa
3-
md5=91edef000fa263a8614786c634487b02
4-
cksum=208681990
2+
sha1=5e524f1afff2888475c49f1652efc292b3a4c7b6
3+
md5=c3859fac3716ac64800f176c54389089
4+
cksum=3271526260
+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
461a23c8a43375d7902f3723c313729b2effd62d
1+
02cbc86624701318edfee6cd1c2f59c226f4a588

‎src/sage/graphs/isgci.py

+16-54
Original file line numberDiff line numberDiff line change
@@ -55,30 +55,13 @@
5555
-------------------------
5656
id : gc_32
5757
name : chordal
58-
type : base
59-
<BLANKLINE>
58+
...
6059
Problems :
6160
-----------
6261
3-Colourability : Linear
6362
Clique : Polynomial
6463
Clique cover : Polynomial
65-
Cliquewidth : Unbounded
66-
Cliquewidth expression : NP-complete
67-
Colourability : Linear
68-
Cutwidth : NP-complete
69-
Domination : NP-complete
70-
Feedback vertex set : Polynomial
71-
Hamiltonian cycle : NP-complete
72-
Hamiltonian path : NP-complete
73-
Independent set : Linear
74-
Maximum bisection : Unknown
75-
Maximum cut : NP-complete
76-
Minimum bisection : Unknown
77-
Recognition : Linear
78-
Treewidth : Polynomial
79-
Weighted clique : Polynomial
80-
Weighted feedback vertex set : Unknown
81-
Weighted independent set : Linear
64+
...
8265
8366
It is possible to obtain the complete list of the classes stored in ISGCI by
8467
calling the :meth:`~GraphClasses.show_all` method (beware -- long output)::
@@ -637,30 +620,15 @@ def description(self):
637620
-------------------------
638621
id : gc_32
639622
name : chordal
640-
type : base
641-
<BLANKLINE>
623+
...
642624
Problems :
643625
-----------
644626
3-Colourability : Linear
645627
Clique : Polynomial
646628
Clique cover : Polynomial
647-
Cliquewidth : Unbounded
648-
Cliquewidth expression : NP-complete
649-
Colourability : Linear
650-
Cutwidth : NP-complete
651-
Domination : NP-complete
652-
Feedback vertex set : Polynomial
653-
Hamiltonian cycle : NP-complete
654-
Hamiltonian path : NP-complete
655-
Independent set : Linear
656-
Maximum bisection : Unknown
657-
Maximum cut : NP-complete
658-
Minimum bisection : Unknown
629+
...
659630
Recognition : Linear
660-
Treewidth : Polynomial
661-
Weighted clique : Polynomial
662-
Weighted feedback vertex set : Unknown
663-
Weighted independent set : Linear
631+
...
664632
"""
665633
classes = GraphClasses().classes()
666634
cls = classes[self._gc_id]
@@ -737,7 +705,7 @@ def classes(self):
737705
sage: type(t)
738706
<... 'dict'>
739707
sage: sorted(t["gc_151"].keys())
740-
['id', 'name', 'problem', 'type']
708+
['id', 'name',... 'problem',... 'type']
741709
sage: t["gc_151"]['name']
742710
'cograph'
743711
sage: t["gc_151"]['problem']['Clique']
@@ -780,16 +748,14 @@ def smallgraphs(self):
780748
EXAMPLES::
781749
782750
sage: t = graph_classes.smallgraphs()
783-
sage: t
784-
{'2C_4': Graph on 8 vertices,
785-
'2K_2': Graph on 4 vertices,
786-
'2K_3': Graph on 6 vertices,
787-
'2K_3 + e': Graph on 6 vertices,
788-
'2K_4': Graph on 8 vertices,
789-
'2P_3': Graph on 6 vertices,
790-
...
751+
sage: t['2C_4']
752+
Graph on 8 vertices
753+
sage: t['2K_3 + e']
754+
Graph on 6 vertices
791755
sage: t['fish']
792756
Graph on 6 vertices
757+
sage: t['bull']
758+
Graph on 5 vertices
793759
"""
794760
self._get_ISGCI()
795761
return self.smallgraphs()
@@ -827,11 +793,11 @@ def _download_db(self):
827793
828794
EXAMPLES::
829795
830-
sage: graph_classes._download_db() # Not tested -- requires internet
796+
sage: graph_classes._download_db() # optional - internet
831797
"""
832798
import tempfile
833799
u = urlopen('https://www.graphclasses.org/data.zip',
834-
context=SSLContext())
800+
context=default_context())
835801
with tempfile.NamedTemporaryFile(suffix=".zip") as f:
836802
f.write(u.read())
837803
z = zipfile.ZipFile(f.name)
@@ -858,7 +824,6 @@ def _parse_db(self, directory):
858824
sage: graph_classes._parse_db(GRAPHS_DATA_DIR)
859825
"""
860826
import xml.etree.cElementTree as ET
861-
import os.path
862827
from sage.graphs.graph import Graph
863828

864829
xml_file = os.path.join(GRAPHS_DATA_DIR, _XML_FILE)
@@ -903,7 +868,7 @@ def update_db(self):
903868
904869
EXAMPLES::
905870
906-
sage: graph_classes.update_db() # Not tested -- requires internet
871+
sage: graph_classes.update_db() # optional - internet
907872
"""
908873
self._download_db()
909874

@@ -935,8 +900,6 @@ def _get_ISGCI(self):
935900
936901
sage: graph_classes._get_ISGCI() # long time (4s on sage.math, 2012)
937902
"""
938-
939-
import os.path
940903
from sage.misc.misc import SAGE_DB
941904

942905
try:
@@ -1039,12 +1002,11 @@ def _XML_to_dict(root):
10391002
10401003
EXAMPLES::
10411004
1042-
sage: graph_classes.Perfect.description() # indirect doctest
1005+
sage: graph_classes.Perfect.description() # indirect doctest
10431006
Class of graphs : Perfect
10441007
-------------------------
10451008
id : gc_56
10461009
name : perfect
1047-
type : base
10481010
...
10491011
"""
10501012
ans = root.attrib.copy()

0 commit comments

Comments
 (0)
Please sign in to comment.