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


Python Bill.extras["additional_information"]方法代码示例

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


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

示例1: scrape

# 需要导入模块: from pupa.scrape import Bill [as 别名]
# 或者: from pupa.scrape.Bill import extras["additional_information"] [as 别名]

#.........这里部分代码省略.........
                    # they messed up Phil Mendelson's name
                    if name == "Phil Pmendelson":
                        name = "Phil Mendelson"
                    bill.add_sponsorship(name, classification='primary',
                                         entity_type='person', primary=True)

                for s in cosponsors:
                    name = s["Name"]
                    if name == "Phil Pmendelson":
                        name = "Phil Mendelson"
                    bill.add_sponsorship(name=name, classification="cosponsor",
                                         entity_type='person', primary=False)

                # if it's become law, add the law number as an alternate title
                if "LawNumber" in legislation_info:
                    law_num = legislation_info["LawNumber"]
                    if law_num:
                        bill.add_title(law_num)

                # also sometimes it's got an act number
                if "ActNumber" in legislation_info:
                    act_num = legislation_info["ActNumber"]
                    if act_num:
                        bill.add_title(act_num)

                # sometimes AdditionalInformation has a previous bill name
                if "AdditionalInformation" in legislation_info:
                    add_info = legislation_info["AdditionalInformation"]
                    if "previously" in add_info.lower():
                        prev_title = add_info.lower().replace("previously", ""
                                                              ).strip().replace(" ", "")
                        bill.add_title(prev_title.upper())
                    elif add_info:
                        bill.extras["additional_information"] = add_info

                if "WithDrawnDate" in legislation_info:
                    withdrawn_date = self.date_format(legislation_info["WithDrawnDate"])
                    withdrawn_by = legislation_info["WithdrawnBy"][0]["Name"].strip()
                    if withdrawn_by == "the Mayor":

                        bill.add_action("withdrawn", withdrawn_date,
                                        chamber="executive", classification="withdrawal")

                    elif "committee" in withdrawn_by.lower():
                        a = bill.add_action("withdrawn", withdrawn_date,
                                            classification="withdrawal")
                        a.add_related_entity(withdrawn_by, entity_type='organization')
                    else:
                        a = bill.add_action("withdrawn", withdrawn_date,
                                            classification="withdrawal")
                        a.add_related_entity(withdrawn_by, entity_type='person')

                # deal with actions involving the mayor
                mayor = bill_info["MayorReview"]
                if mayor != []:
                    mayor = mayor[0]

                    if "TransmittedDate" in mayor:
                        transmitted_date = self.date_format(mayor["TransmittedDate"])

                        bill.add_action("transmitted to mayor", transmitted_date,
                                        chamber="executive",
                                        classification="executive-receipt")

                    if 'SignedDate' in mayor:
                        signed_date = self.date_format(mayor["SignedDate"])
开发者ID:cliftonmcintosh,项目名称:openstates,代码行数:70,代码来源:bills.py


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