class PropertyConceptPropertyLoader(ItemLoader):

    default_input_processor = Identity()
    default_output_processor = TakeFirst()

    area_in = Compose(Split(','), Get(0), Get(1))

    street_name_in = Compose(Split(','), Get(0), Get(0))

    postcode_in = Identity()

    number_bedrooms_in = Compose(TakeFirst(), MapCompose(int))
    number_bathrooms_in = Compose(TakeFirst(), MapCompose(int))

    price_per_month_in = Compose(TakeFirst(), MapCompose(format_price))

    description_out = Join()

    amenities_in = Concatenate(
        Compose(TextSearch('washing machine'), lambda x: ['Washing machine']
                if x else []),
        Compose(TextSearch('parking'), lambda x: ['Parking'] if x else []),
        Compose(TextSearch('dishwasher'), lambda x: ['Dishwasher']
                if x else []))
    amenities_out = Identity()

    heating_type_in = Compose(TextSearch('gas'), lambda is_gas: 'gas'
                              if is_gas else 'unknown')

    let_agreed_in = Compose(lambda xs: 'Let'
                            if any('Let Agreed' in x for x in xs) else 'No')

    epc_rating_in = Compose(MapCompose(to_epc_rating),
                            lambda xs: filter(lambda x: x, xs))
示例#2
0
class AbsolutePropertyLoader(ItemLoader):

    default_input_processor = Identity()
    default_output_processor = TakeFirst()

    area_in = Identity()

    street_name_in = Compose(Split(','), Get(0), Get(1))

    postcode_in = Compose(Split(','), Get(0), Get(2))

    price_per_month_in = AbsolutePriceProcessor()

    description_out = Join()

    amenities_in = Concatenate(
            Compose(TextSearch('washing machine'), lambda x: ['Washing machine'] if x else []),
            Compose(TextSearch('parking'), lambda x: ['Parking'] if x else []),
            Compose(TextSearch('dishwasher'), lambda x: ['Dishwasher'] if x else [])
    )
    amenities_out = Identity()

    heating_type_in = Compose(TextSearch('gas'), lambda is_gas: 'gas' if is_gas else 'unknown')

    let_agreed_in = Compose(lambda xs: 'Yes' if any('Let' in x for x in xs) else 'No')
示例#3
0
class AccommodationUnlimitedPropertyLoader(ItemLoader):

    default_input_processor = Identity()
    default_output_processor = TakeFirst()

    area_in = Compose(Split(','), Get(0), Get(1))

    street_name_in = Compose(Split(','), Get(0), Get(0))

    #postcode_in = Identity()

    number_bedrooms_in = Compose(MapCompose(strip), TakeFirst(), Split(' '),
                                 Get(0), MapCompose(int))

    price_per_month_in = Compose(TakeFirst(), MapCompose(format_price))

    description_out = Join()

    amenities_in = Concatenate(
        Compose(TextSearch('washing machine'), lambda x: ['Washing machine']
                if x else []),
        Compose(TextSearch('parking'), lambda x: ['Parking'] if x else []),
        Compose(TextSearch('dishwasher'), lambda x: ['Dishwasher']
                if x else []))
    amenities_out = Identity()

    heating_type_in = Compose(TextSearch('gas'), lambda is_gas: 'gas'
                              if is_gas else 'unknown')
class JacksonPropertyPropertyLoader(ItemLoader):

    default_input_processor = Identity()
    default_output_processor = TakeFirst()

    area_in = Identity()

    street_in = MapCompose(Split(' - '), Get(0), Get(0))

    price_per_month_in = Compose(TakeFirst(), MapCompose(to_price_per_month))

    number_bedrooms_in = MapCompose(to_number_bedrooms)

    description_out = Join()

    amenities_in = Concatenate(
        Compose(TextSearch('washing machine'), lambda x: ['Washing machine']
                if x else []),
        Compose(TextSearch('parking'), lambda x: ['Parking'] if x else []),
        Compose(TextSearch('dishwasher'), lambda x: ['Dishwasher']
                if x else []))
    amenities_out = Identity()

    heating_type_in = Compose(TextSearch('gas'), lambda is_gas: 'gas'
                              if is_gas else 'unknown')

    epc_rating_in = MapCompose(to_epc_rating)
class ChappellAndMatthewsPropertyLoader(ItemLoader):

    default_input_processor = Identity()
    default_output_processor = TakeFirst()

    area_in = Compose(Split(','), Get(0), Get(0))
    street_name_in = Compose(Split(','), Get(0), Get(1))
    postcode_in = Compose(Split(','), Get(0), Get(-1))

    price_per_month_in = ChappellAndMatthewsPriceProcessor()

    number_bedrooms_in = Compose(Split(' '), Get(0), Get(0))

    description_out = Join()

    amenities_in = Concatenate(
        Compose(TextSearch('washing machine'), lambda x: ['Washing machine']
                if x else []),
        Compose(TextSearch('parking'), lambda x: ['Parking'] if x else []),
        Compose(TextSearch('dishwasher'), lambda x: ['Dishwasher']
                if x else []))
    amenities_out = Identity()

    heating_type_in = Compose(TextSearch('gas'), lambda is_gas: 'gas'
                              if is_gas else 'unknown')