Esempio n. 1
0
 def _iterate_files(self, content):
     files = []
     if 'files' in content:
         for file_info in content['files']:
             f = DataFile(self.client, pathJoin(self.path, file_info['filename']))
             f.set_attributes(file_info)
             files.append(f)
     return files
Esempio n. 2
0
 def test_putNumpy_getNumpy(self):
     file = ".my/empty/numpy.json"
     df = DataFile(self.client, 'data://' + file)
     arr = np.array([0, 0, 0, 0], dtype=np.int64)
     response = df.putNumpy(arr)
     self.assertEqual(response.path, file)
     result = self.client.file(file).getNumpy()
     self.assertEqual(str(arr), str(result))
Esempio n. 3
0
    def test_set_attributes(self):
        df = DataFile(self.client, 'data://.my/empty')

        try:
            df.set_attributes({
                'last_modified': '2019-01-09T22:44:31.632Z',
                'size': 0
            })
        except Exception as e:
            self.fail("set_attributes failed with exception: " + str(e))
Esempio n. 4
0
 def test_putJson_getJson(self):
     file = '.my/empty/test.json'
     df = DataFile(self.client, 'data://' + file)
     if sys.version_info[0] < 3:
         payload = {u"hello": u"world"}
     else:
         payload = {"hello": "world"}
     response = df.putJson(payload)
     self.assertEqual(response.path, file)
     result = self.client.file(file).getJson()
     self.assertEqual(str(result), str(payload))
Esempio n. 5
0
File: client.py Progetto: zjn0224/mo
 def file(self, dataUrl):
     return DataFile(self, dataUrl)
Esempio n. 6
0
 def file(self, name):
     return DataFile(self.client, pathJoin(self.path, name))
Esempio n. 7
0
 def file(self, dataUrl):
     if dataUrl.startswith('file://'): return LocalDataFile(self, dataUrl)
     else: return DataFile(self, dataUrl)