示例#1
0
    def __setitem__(self, key, value):
        theKey = rands(10)
        filePath = self.dirPath + '/' + theKey

        self._paths[key] = filePath

        if isinstance(value, Picklable):
            value.save(filePath)
        else:
            f = open(filePath, 'w')
            try:
                cPickle.dump(value, f)
            finally:
                f.close()

        self._paths[key] = filePath
        self._classes[key] = value.__class__
示例#2
0
    def __setitem__(self, key, value):
        theKey = rands(10)
        filePath = self.dirPath + '/' + theKey

        self._paths[key] = filePath

        if isinstance(value, Picklable):
            value.save(filePath)
        else:
            f = open(filePath, 'w')
            try:
                cPickle.dump(value, f)
            finally:
                f.close()

        self._paths[key] = filePath
        self._classes[key] = value.__class__
示例#3
0
def test_rands():
    r = pytools.rands(10)
    assert(len(r) == 10)
示例#4
0
def test_rands():
    r = pytools.rands(10)
    assert (len(r) == 10)