<commit_before>from data_importers.management.commands import BaseDemocracyCountsCsvImporter


class Command(BaseDemocracyCountsCsvImporter):
    council_id = "E06000032"
    addresses_name = "parl.2019-12-12/Version 1/DC - Polling Districts2.csv"
    stations_name = "parl.2019-12-12/Version 1/DC - Polling Stations.csv"
    elections = ["parl.2019-12-12"]
    csv_encoding = "windows-1252"
    allow_station_point_from_postcode = False

    def address_record_to_dict(self, record):
        rec = super().address_record_to_dict(record)
        uprn = record.uprn.strip().lstrip("0")

        if uprn == "10001037360":
            rec["postcode"] = "LU2 7QG"
            rec["accept_suggestion"] = False

        if uprn in [
            "200003273279",  # LU31TL -> LU27AU : SCHOOL HOUSE BARNFIELD COLLEGE, BARNFIELD AVENUE, LUTON
        ]:
            rec["accept_suggestion"] = True

        return rec<commit_msg>Import script for Luton (closes #3222)<commit_after>from data_importers.management.commands import BaseDemocracyCountsCsvImporter


class Command(BaseDemocracyCountsCsvImporter):
    council_id = "LUT"
    addresses_name = "2021-03-17T12:07:50.769847/Luton DC - Polling Districts.csv"
    stations_name = "2021-03-17T12:07:50.769847/Luton DC - Polling Stations.csv"
    elections = ["2021-05-06"]

    def address_record_to_dict(self, record):
        uprn = record.uprn.strip().lstrip("0")
        self.postcode_field = "pcode"
        if record.pcode in ["LU3 1BU", "LU1 1BE"]:
            return None
        if uprn in ["10001037360", "200003278390"]:
            return None
        return super().address_record_to_dict(record)

    def station_record_to_dict(self, record):
        self.postcode_field = "postcode"
        return super().station_record_to_dict(record)
{'fraction_non_alphanumeric': 0.10813823857302118, 'fraction_numerical': 0.08305462653288741, 'mean_word_length': 3.19392523364486, 'pattern_counts': {'":': 1, '<': 3, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '140853', 'n_tokens_mistral': 713, 'n_tokens_neox': 610, 'n_words': 112}