本文整理汇总了Python中form.Form.from_dict方法的典型用法代码示例。如果您正苦于以下问题:Python Form.from_dict方法的具体用法?Python Form.from_dict怎么用?Python Form.from_dict使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类form.Form
的用法示例。
在下文中一共展示了Form.from_dict方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: from_dict
# 需要导入模块: from form import Form [as 别名]
# 或者: from form.Form import from_dict [as 别名]
def from_dict(job_dict):
job_dict.setdefault("connector", [])
job_dict["connector"] = [Form.from_dict(con_form_dict) for con_form_dict in job_dict["connector"]]
job_dict.setdefault("framework", [])
job_dict["framework"] = [Form.from_dict(framework_form_dict) for framework_form_dict in job_dict["framework"]]
if not "connection_id" in job_dict:
job_dict["connection_id"] = job_dict["connection-id"]
if not "connector_id" in job_dict:
job_dict["connector_id"] = job_dict["connector-id"]
if not "creation_user" in job_dict:
job_dict["creation_user"] = job_dict.setdefault("creation-user", "hue")
if not "creation_date" in job_dict:
job_dict["creation_date"] = job_dict.setdefault("creation-date", 0)
if not "update_user" in job_dict:
job_dict["update_user"] = job_dict.setdefault("update-user", "hue")
if not "update_date" in job_dict:
job_dict["update_date"] = job_dict.setdefault("update-date", 0)
return Job(**force_dict_to_strings(job_dict))
示例2: from_dict
# 需要导入模块: from form import Form [as 别名]
# 或者: from form.Form import from_dict [as 别名]
def from_dict(job_dict):
job_dict.setdefault('connector', [])
job_dict['connector'] = [ Form.from_dict(con_form_dict) for con_form_dict in job_dict['connector'] ]
job_dict.setdefault('framework', [])
job_dict['framework'] = [ Form.from_dict(framework_form_dict) for framework_form_dict in job_dict['framework'] ]
if not 'connection_id' in job_dict:
job_dict['connection_id'] = job_dict['connection-id']
if not 'connector_id' in job_dict:
job_dict['connector_id'] = job_dict['connector-id']
if not 'creation_user' in job_dict:
job_dict['creation_user'] = job_dict.setdefault('creation-user', 'hue')
if not 'creation_date' in job_dict:
job_dict['creation_date'] = job_dict.setdefault('creation-date', 0)
if not 'update_user' in job_dict:
job_dict['update_user'] = job_dict.setdefault('update-user', 'hue')
if not 'update_date' in job_dict:
job_dict['update_date'] = job_dict.setdefault('update-date', 0)
return Job(**job_dict)
示例3: from_dict
# 需要导入模块: from form import Form [as 别名]
# 或者: from form.Form import from_dict [as 别名]
def from_dict(connection_dict):
connection_dict.setdefault('connector', [])
connection_dict['connector'] = [ Form.from_dict(con_form_dict) for con_form_dict in connection_dict['connector'] ]
connection_dict.setdefault('framework', [])
connection_dict['framework'] = [ Form.from_dict(framework_form_dict) for framework_form_dict in connection_dict['framework'] ]
if not 'connector_id' in connection_dict:
connection_dict['connector_id'] = connection_dict.setdefault('connector-id', -1)
return Connection(**connection_dict)
示例4: from_dict
# 需要导入模块: from form import Form [as 别名]
# 或者: from form.Form import from_dict [as 别名]
def from_dict(framework_dict):
framework_dict.setdefault('job-forms', {})
framework_dict['job_forms'] = {}
if 'IMPORT' in framework_dict['job-forms']:
framework_dict['job_forms']['IMPORT'] = [ Form.from_dict(job_form_dict) for job_form_dict in framework_dict['job-forms']['IMPORT'] ]
if 'EXPORT' in framework_dict['job-forms']:
framework_dict['job_forms']['EXPORT'] = [ Form.from_dict(job_form_dict) for job_form_dict in framework_dict['job-forms']['EXPORT'] ]
framework_dict.setdefault('con-forms', [])
framework_dict['con_forms'] = [ Form.from_dict(con_form_dict) for con_form_dict in framework_dict['con-forms'] ]
return Framework(**framework_dict)
示例5: from_dict
# 需要导入模块: from form import Form [as 别名]
# 或者: from form.Form import from_dict [as 别名]
def from_dict(job_dict):
job_dict.setdefault('connector', [])
job_dict['connector'] = [ Form.from_dict(con_form_dict) for con_form_dict in job_dict['connector'] ]
job_dict.setdefault('framework', [])
job_dict['framework'] = [ Form.from_dict(framework_form_dict) for framework_form_dict in job_dict['framework'] ]
if not 'connection_id' in job_dict:
job_dict['connection_id'] = job_dict['connection-id']
if not 'connector_id' in job_dict:
job_dict['connector_id'] = job_dict['connector-id']
return Job(**job_dict)
示例6: from_dict
# 需要导入模块: from form import Form [as 别名]
# 或者: from form.Form import from_dict [as 别名]
def from_dict(connector_dict, resources_dict={}):
connector_dict.setdefault('job-forms', {})
connector_dict['job_forms'] = {}
if 'IMPORT' in connector_dict['job-forms']:
connector_dict['job_forms']['IMPORT'] = [ Form.from_dict(job_form_dict) for job_form_dict in connector_dict['job-forms']['IMPORT'] ]
if 'EXPORT' in connector_dict['job-forms']:
connector_dict['job_forms']['EXPORT'] = [ Form.from_dict(job_form_dict) for job_form_dict in connector_dict['job-forms']['EXPORT'] ]
connector_dict.setdefault('con-forms', [])
connector_dict['con_forms'] = [ Form.from_dict(con_form_dict) for con_form_dict in connector_dict['con-forms'] ]
connector_dict['resources'] = resources_dict.setdefault(unicode(connector_dict['id']), {})
return Connector(**connector_dict)
示例7: from_dict
# 需要导入模块: from form import Form [as 别名]
# 或者: from form.Form import from_dict [as 别名]
def from_dict(connection_dict):
connection_dict.setdefault('connector', [])
connection_dict['connector'] = [ Form.from_dict(con_form_dict) for con_form_dict in connection_dict['connector'] ]
connection_dict.setdefault('framework', [])
connection_dict['framework'] = [ Form.from_dict(framework_form_dict) for framework_form_dict in connection_dict['framework'] ]
if not 'connector_id' in connection_dict:
connection_dict['connector_id'] = connection_dict.setdefault('connector-id', -1)
if not 'creation_user' in connection_dict:
connection_dict['creation_user'] = connection_dict.setdefault('creation-user', 'hue')
if not 'creation_date' in connection_dict:
connection_dict['creation_date'] = connection_dict.setdefault('creation-date', 0)
if not 'update_user' in connection_dict:
connection_dict['update_user'] = connection_dict.setdefault('update-user', 'hue')
if not 'update_date' in connection_dict:
connection_dict['update_date'] = connection_dict.setdefault('update-date', 0)
return Connection(**force_dict_to_strings(connection_dict))