本文整理汇总了Python中social_auth.utils.ctype_to_model函数的典型用法代码示例。如果您正苦于以下问题:Python ctype_to_model函数的具体用法?Python ctype_to_model怎么用?Python ctype_to_model使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ctype_to_model函数的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: from_session_dict
def from_session_dict(self, session_data, *args, **kwargs):
"""Takes session saved data to continue pipeline and merges with any
new extra argument needed. Returns tuple with next pipeline index
entry, arguments and keyword arguments to continue the process."""
args = args[:] + tuple(map(ctype_to_model, session_data["args"]))
kwargs = kwargs.copy()
kwargs.update((key, ctype_to_model(val)) for key, val in session_data["kwargs"].iteritems())
return (session_data["next"], args, kwargs)
示例2: from_session_dict
def from_session_dict(self, session_data, *args, **kwargs):
"""Takes session saved data to continue pipeline and merges with any
new extra argument needed. Returns tuple with next pipeline index
entry, arguments and keyword arguments to continue the process."""
import pickle
session_data = pickle.loads(session_data['social_data'])
args = args[:] + tuple(map(ctype_to_model, session_data['args']))
kwargs = kwargs.copy()
saved_kwargs = dict((key, ctype_to_model(val))
for key, val in session_data['kwargs'].iteritems())
saved_kwargs.update((key, val)
for key, val in kwargs.iteritems())
return (session_data['next'], args, saved_kwargs)