本文整理汇总了Python中map.Map.put方法的典型用法代码示例。如果您正苦于以下问题:Python Map.put方法的具体用法?Python Map.put怎么用?Python Map.put使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类map.Map
的用法示例。
在下文中一共展示了Map.put方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: call
# 需要导入模块: from map import Map [as 别名]
# 或者: from map.Map import put [as 别名]
def call(self, *args):
'''evaluate the content of the function with the passed args
mapped to the function's args. returns simplified object'''
# create a scope for the call
call_scope = Let()
if self.parent:
self.parent.reparent(call_scope) # to make lexical scope work
call_scope.put(copy(self.child))
# load args into the call's scope
arg_map = Map()
if len(self.args) != len(args):
raise fern.errors.SemanticError('calling function with %d arguments, should be %d' % (len(args), len(self.args)))
for k, v in zip(self.args, args):
arg_map.put(KVPair(k, v))
call_scope.names = arg_map
return call_scope.eval()
示例2: post
# 需要导入模块: from map import Map [as 别名]
# 或者: from map.Map import put [as 别名]
def post(self):
try:
secret = 'men judge generally more by the eye than by the hand, because it belongs to everybody to see you, to few to come in touch with you.'
mapText = self.request.get("map")
nameText = self.request.get("name")
verifyGiven = self.request.get("verify")
m = hashlib.md5()
m.update(secret)
m.update(mapText)
verifyFound = m.hexdigest()
if verifyGiven != verifyFound:
result = urllib.urlencode([('error', 'Map was corrupted in transit')])
else:
map = Map(name = nameText, text = db.Text(mapText))
map.update()
key = map.put()
getUrl = re.sub("upload/?$", "get/", self.request.url) + str(key)
result = urllib.urlencode([('result', getUrl),
('key', str(key))])
except Exception, error:
message = 'Could not find map: ' + str(error)
result = urllib.urlencode([('error', message)])