本文整理汇总了Python中future.builtins.dict.__setitem__方法的典型用法代码示例。如果您正苦于以下问题:Python dict.__setitem__方法的具体用法?Python dict.__setitem__怎么用?Python dict.__setitem__使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类future.builtins.dict
的用法示例。
在下文中一共展示了dict.__setitem__方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from future.builtins import dict [as 别名]
# 或者: from future.builtins.dict import __setitem__ [as 别名]
def __init__(self):
# Set defaults
self.key = self.value = self.coded_value = None
# Set default attributes
for key in self._reserved:
dict.__setitem__(self, key, "")
示例2: __setitem__
# 需要导入模块: from future.builtins import dict [as 别名]
# 或者: from future.builtins.dict import __setitem__ [as 别名]
def __setitem__(self, K, V):
K = K.lower()
if not K in self._reserved:
raise CookieError("Invalid Attribute %s" % K)
dict.__setitem__(self, K, V)
示例3: __set
# 需要导入模块: from future.builtins import dict [as 别名]
# 或者: from future.builtins.dict import __setitem__ [as 别名]
def __set(self, key, real_value, coded_value):
"""Private method for setting a cookie's value"""
M = self.get(key, Morsel())
M.set(key, real_value, coded_value)
dict.__setitem__(self, key, M)
示例4: load
# 需要导入模块: from future.builtins import dict [as 别名]
# 或者: from future.builtins.dict import __setitem__ [as 别名]
def load(self, rawdata):
"""Load cookies from a string (presumably HTTP_COOKIE) or
from a dictionary. Loading cookies from a dictionary 'd'
is equivalent to calling:
map(Cookie.__setitem__, d.keys(), d.values())
"""
if isinstance(rawdata, str):
self.__parse_string(rawdata)
else:
# self.update() wouldn't call our custom __setitem__
for key, value in rawdata.items():
self[key] = value
return