Commit 97909eac authored by Tiago Peixoto's avatar Tiago Peixoto
Browse files

Fix more compatibility bugs with python 2

parent fdf387eb
......@@ -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.
......@@ -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): = tempfile.mkdtemp(suffix, prefix, dir)
def __enter__(self):
def __exit__(self, exc, value, tb):
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:
with tempfile.TemporaryDirectory(suffix=name) as tempdir:
with TemporaryDirectory(suffix=name) as tempdir:
with, mode='r:bz2') as tar:
g = load_koblenz_dir(tempdir)
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment