提交 6fb2a1e3 authored 作者: Ian Goodfellow's avatar Ian Goodfellow

conditionally load hashlib

上级 161a5c75
......@@ -8,7 +8,8 @@ import logging
import os
import StringIO
import sys
import hashlib
# Not available on all platforms
hashlib = None
import numpy
......@@ -1081,6 +1082,12 @@ def var_descriptor(obj, _prev_obs=None, _tag_generator=None):
location dependent information such as the id of a node.
"""
if hashlib is None:
try:
import hashlib
except ImportError:
raise RuntimeError("Can't run var_descriptor because hashlib is not available.")
if _prev_obs is None:
_prev_obs = {}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论