当前位置: 首页>>代码示例>>Python>>正文


Python OrderedDict.update方法代码示例

本文整理汇总了Python中synnefo.lib.ordereddict.OrderedDict.update方法的典型用法代码示例。如果您正苦于以下问题:Python OrderedDict.update方法的具体用法?Python OrderedDict.update怎么用?Python OrderedDict.update使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在synnefo.lib.ordereddict.OrderedDict的用法示例。


在下文中一共展示了OrderedDict.update方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: project_fields

# 需要导入模块: from synnefo.lib.ordereddict import OrderedDict [as 别名]
# 或者: from synnefo.lib.ordereddict.OrderedDict import update [as 别名]
def project_fields(project):
    app = project.last_application
    pending_app = (app.id if app and app.state == app.PENDING
                   else None)

    d = OrderedDict([
        ('project id', project.uuid),
        ('name', project.realname),
        ('status', project.state_display()),
        ('pending_app', pending_app),
        ('owner', project.owner),
        ('homepage', project.homepage),
        ('description', project.description),
        ('creation date', project.creation_date),
        ('request end date', project.end_date),
        ])

    deact = project.last_deactivation()
    if deact is not None:
        d['deactivation date'] = deact.date

    d.update([
            ('join policy', project.member_join_policy_display),
            ('leave policy', project.member_leave_policy_display),
            ('max members', units.show(project.limit_on_members_number, None)),
            ('total members', project.members_count()),
    ])

    return d
开发者ID:AthinaB,项目名称:synnefo,代码行数:31,代码来源:project-show.py

示例2: project_fields

# 需要导入模块: from synnefo.lib.ordereddict import OrderedDict [as 别名]
# 或者: from synnefo.lib.ordereddict.OrderedDict import update [as 别名]
def project_fields(s, project, last_app):
    app = project.application

    d = OrderedDict(
        [("project id", project.id), ("application id", app.id), ("name", app.name), ("status", Chain.state_display(s))]
    )
    if s in Chain.PENDING_STATES:
        d.update([("pending application", last_app.id)])

    d.update(
        [
            ("owner", app.owner),
            ("applicant", app.applicant),
            ("homepage", app.homepage),
            ("description", app.description),
            ("comments for review", app.comments),
            ("request issue date", app.issue_date),
            ("request start date", app.start_date),
            ("creation date", project.creation_date),
            ("request end date", app.end_date),
        ]
    )

    deact_date = project.deactivation_date
    if deact_date is not None:
        d["deactivation date"] = deact_date

    mem_limit = app.limit_on_members_number
    mem_limit_show = mem_limit if mem_limit is not None else "unlimited"

    d.update(
        [
            ("join policy", app.member_join_policy_display),
            ("leave policy", app.member_leave_policy_display),
            ("max members", mem_limit_show),
            ("total members", project.members_count()),
        ]
    )

    return d
开发者ID:vkoukis,项目名称:synnefo,代码行数:42,代码来源:project-show.py

示例3: project_fields

# 需要导入模块: from synnefo.lib.ordereddict import OrderedDict [as 别名]
# 或者: from synnefo.lib.ordereddict.OrderedDict import update [as 别名]
def project_fields(project, pending_app):
    app = project.application

    d = OrderedDict([
        ('project id', project.id),
        ('application id', app.id),
        ('name', app.name),
        ('status', project.state_display()),
    ])
    if pending_app is not None:
        d.update([('pending application', pending_app.id)])

    d.update([('owner', app.owner),
              ('applicant', app.applicant),
              ('homepage', app.homepage),
              ('description', app.description),
              ('comments for review', app.comments),
              ('request issue date', app.issue_date),
              ('request start date', app.start_date),
              ('creation date', project.creation_date),
              ('request end date', app.end_date),
              ])

    deact = project.last_deactivation()
    if deact is not None:
        d['deactivation date'] = deact.date

    mem_limit = app.limit_on_members_number
    mem_limit_show = mem_limit if mem_limit is not None else "unlimited"

    d.update([
            ('join policy', app.member_join_policy_display),
            ('leave policy', app.member_leave_policy_display),
            ('max members', mem_limit_show),
            ('total members', project.members_count()),
    ])

    return d
开发者ID:antonis-m,项目名称:synnefo,代码行数:40,代码来源:project-show.py


注:本文中的synnefo.lib.ordereddict.OrderedDict.update方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。