def test_shared_config_is_included(self): config = Config.from_file(self._shared_file_path) config = config.for_environment("Dev") self.assertEqual(config.ci.repo, "https://github.com/ResourceDataInc/Centroid")
def test_iterating_raw_config(self): config = Config.from_file(self._shared_file_path) keyCount = 0 for key in config.raw_config: keyCount += 1 self.assertEqual(keyCount, 4)
def test_create_from_file(self): config = Config.from_file(self._shared_file_path) self.assertEqual(config.dev.database.server, "sqldev01.centroid.local")
def test_iterating_raw_config(self): config = Config.from_file(self._shared_file_path) keyCount = 0; for key in config.raw_config: keyCount += 1 self.assertEqual(keyCount, 4)
def test_shared_config_is_included(self): config = Config.from_file(self._shared_file_path) config = config.for_environment("Dev") self.assertEqual(config.ci.repo, "https://github.com/ResourceDataInc/Centroid")
def test_create_from_file(self): config = Config.from_file(self._shared_file_path) self.assertEqual(config.dev.database.server, "sqldev01.centroid.local")
layer_infos = { } map_doc = arcpy.mapping.MapDocument(mxd_path) print mxd_path for i, layer in enumerate(arcpy.mapping.ListLayers(map_doc)): if layer.supports('dataSource'): if layer.isGroupLayer: # annotation for j, anno_layer in enumerate(layer): anno_idx = i + j + 1 layer_infos[anno_idx] = _get_layer_info(anno_layer, anno_idx) else: # feature or raster layer layer_infos[i] = _get_layer_info(layer, i) else: # group layer layer_infos[i] = layer.name return layer_infos def _get_layer_info(layer, index): layer_info = map_layer() layer_info.index = index layer_info.name = layer.name layer_info.feature_class = os.path.basename(layer.dataSource) return layer_info if __name__ == '__main__': config = Config.from_file("config.json").for_environment('Dev') rt_path = config.maps.documents_source #rt_path = sys.argv[-1] #rt_path = 'C:/users/jroebuck/projects/agdc/gis/mapservices' map_services = [ map_service.from_path_info(mxd, rt_path) for mxd in get_all_files(rt_path, '.mxd') ] map_services_json = obj_to_json(map_services) with open('map_services.json','w') as txt_out: txt_out.write(map_services_json)