leaf_focus/report/item/report_entry.py
def save(cls, path: Path, items: Iterable["ReportEntry"]):
        """Save items to a csv file."""
        fields = [
            "assembly",
            "state_or_territory",
            "electorate",
            "last_name",
            "first_name",
            "register_section",
            "change_type",
            "form_who",
            "form_name",
            "form_activity",
            "form_participation",
            "form_location",
            "pdf_created_date",
            "pdf_modified_date",
            "pdf_downloaded_date",
            "website_modified_date",
            "processed_date",
            "signed_date",
            "pdf_page",
            "pdf_line",
            "pdf_url",
            "referrer_url",
            "pdf_hash_type",
            "pdf_hash_value",
        ]
        path.parent.mkdir(parents=True, exist_ok=True)
        with open(path, "wt", newline="", encoding="utf8") as f:
            writer = csv.DictWriter(f, fields, dialect="excel")
            writer.writeheader()
            for i in items:
                writer.writerow(
                    {
                        "pdf_hash_type": i.pdf_hash_type,
                        "pdf_hash_value": i.pdf_hash_value,
                        "pdf_page": i.pdf_page,
                        "pdf_line": i.pdf_line,
                        "pdf_created_date": cls.fmt_date(i.pdf_created_date),
                        "pdf_modified_date": cls.fmt_date(i.pdf_modified_date),
                        "pdf_downloaded_date": cls.fmt_date(i.pdf_downloaded_date),
                        "pdf_url": i.pdf_url,
                        "referrer_url": i.referrer_url,
                        "website_modified_date": cls.fmt_date(i.website_modified_date),
                        "processed_date": cls.fmt_date(i.processed_date),
                        "signed_date": cls.fmt_date(i.signed_date),
                        "assembly": i.assembly,
                        "last_name": i.last_name,
                        "first_name": i.first_name,
                        "state_or_territory": i.state_or_territory,
                        "electorate": i.electorate,
                        "register_section": i.register_section,
                        "change_type": i.change_type,
                        "form_who": i.form_who,
                        "form_name": i.form_name,
                        "form_activity": i.form_activity,
                        "form_participation": i.form_participation,
                        "form_location": i.form_location,
                    }
                )
Save items to a csv file.
Save items to a csv file.
Save items to a csv file .
def save(cls, path: Path, items: Iterable["ReportEntry"]):
        fields = [
            "assembly",
            "state_or_territory",
            "electorate",
            "last_name",
            "first_name",
            "register_section",
            "change_type",
            "form_who",
            "form_name",
            "form_activity",
            "form_participation",
            "form_location",
            "pdf_created_date",
            "pdf_modified_date",
            "pdf_downloaded_date",
            "website_modified_date",
            "processed_date",
            "signed_date",
            "pdf_page",
            "pdf_line",
            "pdf_url",
            "referrer_url",
            "pdf_hash_type",
            "pdf_hash_value",
        ]
        path.parent.mkdir(parents=True, exist_ok=True)
        with open(path, "wt", newline="", encoding="utf8") as f:
            writer = csv.DictWriter(f, fields, dialect="excel")
            writer.writeheader()
            for i in items:
                writer.writerow(
                    {
                        "pdf_hash_type": i.pdf_hash_type,
                        "pdf_hash_value": i.pdf_hash_value,
                        "pdf_page": i.pdf_page,
                        "pdf_line": i.pdf_line,
                        "pdf_created_date": cls.fmt_date(i.pdf_created_date),
                        "pdf_modified_date": cls.fmt_date(i.pdf_modified_date),
                        "pdf_downloaded_date": cls.fmt_date(i.pdf_downloaded_date),
                        "pdf_url": i.pdf_url,
                        "referrer_url": i.referrer_url,
                        "website_modified_date": cls.fmt_date(i.website_modified_date),
                        "processed_date": cls.fmt_date(i.processed_date),
                        "signed_date": cls.fmt_date(i.signed_date),
                        "assembly": i.assembly,
                        "last_name": i.last_name,
                        "first_name": i.first_name,
                        "state_or_territory": i.state_or_territory,
                        "electorate": i.electorate,
                        "register_section": i.register_section,
                        "change_type": i.change_type,
                        "form_who": i.form_who,
                        "form_name": i.form_name,
                        "form_activity": i.form_activity,
                        "form_participation": i.form_participation,
                        "form_location": i.form_location,
                    }
                )
def save ( cls , path : Path , items : Iterable [ "ReportEntry" ] ) : fields = [ "assembly" , "state_or_territory" , "electorate" , "last_name" , "first_name" , "register_section" , "change_type" , "form_who" , "form_name" , "form_activity" , "form_participation" , "form_location" , "pdf_created_date" , "pdf_modified_date" , "pdf_downloaded_date" , "website_modified_date" , "processed_date" , "signed_date" , "pdf_page" , "pdf_line" , "pdf_url" , "referrer_url" , "pdf_hash_type" , "pdf_hash_value" , ] path . parent . mkdir ( parents = True , exist_ok = True ) with open ( path , "wt" , newline = "" , encoding = "utf8" ) as f : writer = csv . DictWriter ( f , fields , dialect = "excel" ) writer . writeheader ( ) for i in items : writer . writerow ( { "pdf_hash_type" : i . pdf_hash_type , "pdf_hash_value" : i . pdf_hash_value , "pdf_page" : i . pdf_page , "pdf_line" : i . pdf_line , "pdf_created_date" : cls . fmt_date ( i . pdf_created_date ) , "pdf_modified_date" : cls . fmt_date ( i . pdf_modified_date ) , "pdf_downloaded_date" : cls . fmt_date ( i . pdf_downloaded_date ) , "pdf_url" : i . pdf_url , "referrer_url" : i . referrer_url , "website_modified_date" : cls . fmt_date ( i . website_modified_date ) , "processed_date" : cls . fmt_date ( i . processed_date ) , "signed_date" : cls . fmt_date ( i . signed_date ) , "assembly" : i . assembly , "last_name" : i . last_name , "first_name" : i . first_name , "state_or_territory" : i . state_or_territory , "electorate" : i . electorate , "register_section" : i . register_section , "change_type" : i . change_type , "form_who" : i . form_who , "form_name" : i . form_name , "form_activity" : i . form_activity , "form_participation" : i . form_participation , "form_location" : i . form_location , } )
Save items to a csv file.
Save items to a csv file .
"""Save items to a csv file."""
cls
path
Path
items
Iterable["ReportEntry"]