示例#1
0
 def dump(self, object, name):
     '''
     dump(object, name)
     '''
     s = encode(object)
     if s:
         s = b64encode(s)
     self.redis.set(_resultname(name), s)
示例#2
0
 def dump(self, object, name):
     '''
     dump(object, name)
     '''
     s = encode(object)
     if s:
         s = b64encode(s)
     self.redis.set(_resultname(name), s)
示例#3
0
 def dump(self, obj, name):
     '''
     dump(object, name)
     '''
     s = encode(obj)
     sblob = self.bucket.blob(self.storage_key(name))
     sblob.upload_from_string(s, content_type=None)
     self.redis.set(self.redis_result_key(name), self.storage_key(name))
示例#4
0
文件: test_encode.py 项目: emidln/jug
def test_decompress_stream_seek():
    s = encode(range(33))
    st = decompress_stream(StringIO(s))
    first = st.read(6)
    st.seek(-6, 1)
    second = st.read(6)
    assert first == second

    st = decompress_stream(StringIO(s))
    first = st.read(6)
    st.seek(-6, 1)
    second = st.read(8)
    assert first == second[:6]
示例#5
0
def test_decompress_stream_seek():
    s = encode(list(range(33)))
    st = decompress_stream(BytesIO(s))
    first = st.read(6)
    st.seek(-6, 1)
    second = st.read(6)
    assert first == second

    st = decompress_stream(BytesIO(s))
    first = st.read(6)
    st.seek(-6, 1)
    second = st.read(8)
    assert first == second[:6]

    st = decompress_stream(BytesIO(s))
    st.seek(6, 1)
    st.seek(-6, 1)
    second = st.read(8)
    assert first == second[:6]
示例#6
0
def test_encode():
    assert decode(encode(None)) is None
    assert decode(encode([])) == []
    assert decode(encode(list(range(33)))) == list(range(33))
示例#7
0
def test_numpy_derived():
    a = Derived([1, 2, 3])
    assert type(decode(encode(a))) == type(a)
示例#8
0
def test_numpy():
    assert np.all(decode(encode(np.arange(33))) == np.arange(33))
示例#9
0
def test_encode():
    assert decode(encode(None)) is None
    assert decode(encode([])) == []
    assert decode(encode(range(33))) == range(33)
示例#10
0
def test_numpy():
    assert np.all(decode(encode(np.arange(33))) == np.arange(33))
示例#11
0
文件: test_encode.py 项目: asford/jug
def test_numpy_derived():
    a = Derived([1,2,3])
    assert type(decode(encode(a))) == type(a)
示例#12
0
def test_numpy():
    assert np.all(decode(encode(np.arange(33))) == np.arange(33))

    x = decode(encode({'res': np.arange(1024 * 1024)}))
    assert np.all(x['res'] == np.arange(1024 * 1024))
示例#13
0
文件: test_encode.py 项目: emidln/jug
def test_encode():
    assert decode(encode(None)) is None
    assert decode(encode([])) == []
    assert decode(encode(range(33))) == range(33)
    assert np.all(decode(encode(np.arange(33))) == np.arange(33))