Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Tiago Peixoto
graph-tool
Commits
97909eac
Commit
97909eac
authored
Sep 16, 2015
by
Tiago Peixoto
Browse files
Fix more compatibility bugs with python 2
parent
fdf387eb
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/graph_tool/__init__.py
View file @
97909eac
...
...
@@ -1309,7 +1309,7 @@ class InternalPropertyDict(dict):
self
[
k
]
=
v
class
PropertyDict
():
class
PropertyDict
(
object
):
"""Wrapper for the dict of vertex, graph or edge properties, which sets the
value on the property map when changed in the dict.
...
...
src/graph_tool/collection/konect.py
View file @
97909eac
...
...
@@ -27,8 +27,19 @@ import os.path
import
tempfile
if
sys
.
version_info
<
(
3
,):
from
urllib2
import
urlopen
import
shutil
class
TemporaryDirectory
(
object
):
def
__init__
(
self
,
suffix
=
""
,
prefix
=
""
,
dir
=
None
):
self
.
name
=
tempfile
.
mkdtemp
(
suffix
,
prefix
,
dir
)
def
__enter__
(
self
):
return
self
.
name
def
__exit__
(
self
,
exc
,
value
,
tb
):
shutil
.
rmtree
(
self
.
name
)
else
:
from
urllib.request
import
urlopen
from
tempfile
import
TemporaryDirectory
import
tarfile
import
warnings
import
numpy
...
...
@@ -88,7 +99,7 @@ def get_koblenz_network_data(name):
if
len
(
buf
)
<
buflen
:
break
ftemp
.
seek
(
0
)
with
tempfile
.
TemporaryDirectory
(
suffix
=
name
)
as
tempdir
:
with
TemporaryDirectory
(
suffix
=
name
)
as
tempdir
:
with
tarfile
.
open
(
fileobj
=
ftemp
,
mode
=
'r:bz2'
)
as
tar
:
tar
.
extractall
(
path
=
tempdir
)
g
=
load_koblenz_dir
(
tempdir
)
...
...
Tiago Peixoto
@count0
mentioned in issue
#243 (closed)
·
Sep 16, 2015
mentioned in issue
#243 (closed)
mentioned in issue #243
Toggle commit list
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment