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


Python Event.validate方法代码示例

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


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

示例1: get_events

# 需要导入模块: from pupa.scrape import Event [as 别名]
# 或者: from pupa.scrape.Event import validate [as 别名]

#.........这里部分代码省略.........
             ],},
            {"name": "Meeting of the Join Committee on Bar",
             "start_time": dt.datetime.fromtimestamp(1008923205),
             "location": "Council Chambers",
             "documents": [
                 {"url": "http://someone.example.com/slides.html",
                  "mimetype": "text/html",
                  "name": "HTML Slides",},
                 {"url": "http://someone.example.com/slides.ppt",
                  "mimetype": "application/vnd.ms-powerpoint",
                  "name": "Powerpoint of the Slides",},
                 {"url": "http://test.example.com/otherthing.ogg",
                  "mimetype": "audio/ogg",
                  "name": "Background Music",},
             ],
            },
            {"name": "Meeting of the Join Committee on Fnord",
             "start_time": dt.datetime.fromtimestamp(1418929205),
             "location": "City Hall",
             "agenda": [
                {"related_entities": [
                 {"note": "Yandel will be presenting on the effects of this bill",
                  "type": "person",
                  "name": "Yandel V. Watkins",},
                ],
                "media": [
                    {"date": "2014-04-12",
                     "type": "recording",
                     "name": "Recording of the meeting",
                     "links": [
                         {"mimetype": "video/mp4",
                          "url": "http://example.com/video.mp4"},
                         {"mimetype": "video/webm",
                          "url": "http://example.com/video.webm"},
                     ],
                     "offset": 19,
                    }
                ],
                "notes": [
                    "Yandel started his presentation.",
                    "Yandel made some good points.",
                    "Yandel sat down.",
                ],
                "subjects": [
                    "testimony", "this-bill", "this-subject"
                ],
                "order": '0',
               "description": "Yandel will give a talk",
                },
                {"related_entities": [
                 {"note": "Mckenzie will be presenting on the effects of this bill",
                  "type": "person",
                  "name": "Mckenzie A. Cannon",},
                ],
                "media": [
                    {"date": "2014-04-12",
                     "type": "recording",
                     "name": "Recording of the meeting",
                     "links": [
                         {"mimetype": "video/mp4",
                          "url": "http://example.com/video.mp4"},
                         {"mimetype": "video/webm",
                          "url": "http://example.com/video.webm"},
                     ],
                     "offset": 200,
                    }
                ],
                "notes": [
                    "Mckenzie started his presentation.",
                    "Mckenzie made some good points.",
                    "Mckenzie made some good better points.",
                    "Mckenzie sat down.",
                ],
                "subjects": [
                    "testimony", "this-bill-2", "this-subject"
                ],
                "order": '1',
                "description": "Mckenzie will give a talk",
                },
             ],},
        ]
        for e in events:
            obj = Event(name=e['name'],
                        start_time=e['start_time'],
                        location=e['location'])
            obj.add_source("http://example.com/events")

            l = e.get("_location", None)
            if l:
                obj.location = l

            for key in [
                "media", "links", "participants", "agenda", "documents"
            ]:
                l = e.get(key, None)
                if l:
                    setattr(obj, key, l)

            obj.validate()
            yield obj
开发者ID:paultag,项目名称:test-legislature,代码行数:104,代码来源:__init__.py


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