示例#1
0
def load_star_systems(path):
    """
    Load all StarSystem data stored under the given path. This function is not recursive.
    """
    return storage.load_files(path, "*.star_system.json", star_system.StarSystem)
示例#2
0
def load_celestials(path):
    """
    Load all Celestial data stored under the given path. This function is not recursive.
    """
    return storage.load_files(path, "*.celestial.json", celestial.Celestial)
示例#3
0
 def test_load_files(self):
     objs = storage.load_files(os.path.dirname(self.path1), "*.foo.json", Obj)
     self.assertEqual(len(objs), 2)
     for obj, data in zip(objs, [self.d1, self.d2]):
         self.assertTrue(isinstance(obj, Obj))
         obj.load_data.assert_called_once_with(data)