當前位置: 首頁>>代碼示例>>Python>>正文


Python Subject.storage方法代碼示例

本文整理匯總了Python中zeitgeist.datamodel.Subject.storage方法的典型用法代碼示例。如果您正苦於以下問題:Python Subject.storage方法的具體用法?Python Subject.storage怎麽用?Python Subject.storage使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在zeitgeist.datamodel.Subject的用法示例。


在下文中一共展示了Subject.storage方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: dict2event

# 需要導入模塊: from zeitgeist.datamodel import Subject [as 別名]
# 或者: from zeitgeist.datamodel.Subject import storage [as 別名]
def dict2event(d):
	ev = Event()
	ev[0][Event.Id] = d.get("id", "").encode("UTF-8")
	ev.timestamp = str(d.get("timestamp", ""))
	ev.interpretation = str(d.get("interpretation", "").encode("UTF-8"))
	ev.manifestation = str(d.get("manifestation", "").encode("UTF-8"))
	ev.actor = str(d.get("actor", "").encode("UTF-8"))
	ev.origin = str(d.get("origin", "").encode("UTF-8"))
	ev.payload = str(d.get("payload", "").encode("UTF-8"))
	
	subjects = d.get("subjects", [])
	for sd in subjects:
		subj = Subject()
		subj.uri = str(sd.get("uri", "").encode("UTF-8"))
		subj.current_uri = str(sd.get("current_uri", "")).encode("UTF-8")
		subj.interpretation = str(sd.get("interpretation", "").encode("UTF-8"))
		subj.manifestation = str(sd.get("manifestation", "").encode("UTF-8"))
		subj.origin = str(sd.get("origin", "").encode("UTF-8"))
		subj.current_origin = str(sd.get("current_origin", "")).encode("UTF-8")
		subj.mimetype = str(sd.get("mimetype", "").encode("UTF-8"))
		subj.text = str(sd.get("text", "").encode("UTF-8"))
		subj.storage = str(sd.get("storage", "").encode("UTF-8"))
		ev.append_subject(subj)
	return ev
開發者ID:freedesktop-unofficial-mirror,項目名稱:zeitgeist__zeitgeist,代碼行數:26,代碼來源:testutils.py


注:本文中的zeitgeist.datamodel.Subject.storage方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。