本文整理汇总了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]