本文整理匯總了Python中arccore.utils.AIUtils.AIUtils.str2dict方法的典型用法代碼示例。如果您正苦於以下問題:Python AIUtils.str2dict方法的具體用法?Python AIUtils.str2dict怎麽用?Python AIUtils.str2dict使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類arccore.utils.AIUtils.AIUtils
的用法示例。
在下文中一共展示了AIUtils.str2dict方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: fromStr
# 需要導入模塊: from arccore.utils.AIUtils import AIUtils [as 別名]
# 或者: from arccore.utils.AIUtils.AIUtils import str2dict [as 別名]
def fromStr(self, attrs):
obj = None
if AIUtils.isStr(attrs):
attrs = AIUtils.str2dict(attrs)
obj = self
if AIUtils.isDict(attrs):
for key in attrs:
func = getattr(obj, 'set' + AIStrUtils.toUpperF(key))
if AIUtils.isFunc(func):
apply(func, [attrs[key]])
else:
raise Exception('input parameter type not correct!')
return obj
示例2:
# 需要導入模塊: from arccore.utils.AIUtils import AIUtils [as 別名]
# 或者: from arccore.utils.AIUtils.AIUtils import str2dict [as 別名]
if __name__ == "__main__":
qr = ""
# 獲取python服務端根目錄
path = sys.argv[0]
if os.path.isfile(path):
path = os.path.dirname(path)
rootPath = os.path.abspath(os.path.join(path, os.pardir))
# 讀取日誌配置
logging.config.fileConfig(os.path.join(rootPath, "resources", "conf", "logging.conf"))
logger = logging.getLogger("app.scripts.queryFdsList")
logger.info("讀取Python服務端日誌配置成功")
# 獲取參數
param1 = sys.argv[1]
param1 = param1.replace("null", "''")
wksDict = AIUtils.str2dict(param1)
# 設置工作空間
wksId = wksDict["id"]
wksType = wksDict["type"]
if AIStrUtils.isEqual(wksType, "sde"):
# 建立相關連接
cf = ConfigParser.ConfigParser()
cf.read(os.path.join(rootPath, "resources", "conf", "config.conf"))
# 獲取sde連接文件
sdeIds = cf.options("sde")
if wksId in sdeIds:
sdeInfo = cf.get("sde", wksId)
sdeInfos = sdeInfo.split("/")
sdeServer = sdeInfos[0]
sdeInstance = sdeInfos[1]
sdeUsername = sdeInfos[2]
示例3:
# 需要導入模塊: from arccore.utils.AIUtils import AIUtils [as 別名]
# 或者: from arccore.utils.AIUtils.AIUtils import str2dict [as 別名]
if __name__ == "__main__":
flag = "false"
# 獲取python服務端根目錄
path = sys.argv[0]
if os.path.isfile(path):
path = os.path.dirname(path)
rootPath = os.path.abspath(os.path.join(path, os.pardir))
# 讀取日誌配置
logging.config.fileConfig(os.path.join(rootPath, "resources", "conf", "logging.conf"))
logger = logging.getLogger("app.scripts.addFds")
logger.info("讀取Python服務端日誌配置成功")
# 獲取參數
param1 = sys.argv[1]
param1 = param1.replace("null", "''")
wksDict = AIUtils.str2dict(param1)
# 設置工作空間
wksId = wksDict["id"]
wksType = wksDict["type"]
if AIStrUtils.isEqual(wksType, "sde"):
# 建立相關連接
cf = ConfigParser.ConfigParser()
cf.read(os.path.join(rootPath, "resources", "conf", "config.conf"))
# 獲取sde連接文件
sdeIds = cf.options("sde")
if wksId in sdeIds:
sdeInfo = cf.get("sde", wksId)
sdeInfos = sdeInfo.split("/")
sdeServer = sdeInfos[0]
sdeInstance = sdeInfos[1]
sdeUsername = sdeInfos[2]
示例4:
# 需要導入模塊: from arccore.utils.AIUtils import AIUtils [as 別名]
# 或者: from arccore.utils.AIUtils.AIUtils import str2dict [as 別名]
from arccore.store.AIWks import AIWks
if __name__ == '__main__':
qr = ''
# 獲取python服務端根目錄
path = sys.argv[0]
if os.path.isfile(path):
path = os.path.dirname(path)
rootPath = os.path.abspath(os.path.join(path, os.pardir))
# 讀取日誌配置
logging.config.fileConfig(os.path.join(rootPath, 'resources', 'conf', 'logging.conf'))
logger = logging.getLogger('app.scripts.queryFds')
logger.info('讀取Python服務端日誌配置成功')
# 獲取參數
param1 = sys.argv[1]
param1 = param1.replace('null', '\'\'')
wksDict = AIUtils.str2dict(param1)
# 設置工作空間
wksId = wksDict['id']
wksType = wksDict['type']
if AIStrUtils.isEqual(wksType, 'sde'):
# 建立相關連接
cf = ConfigParser.ConfigParser()
cf.read(os.path.join(rootPath, 'resources', 'conf', 'config.conf'))
# 獲取sde連接文件
sdeIds = cf.options('sde')
if wksId in sdeIds:
sdeInfo = cf.get('sde', wksId)
sdeInfos = sdeInfo.split('/')
sdeServer = sdeInfos[0]
sdeInstance = sdeInfos[1]
sdeUsername = sdeInfos[2]