class BristolPropertyCentrePropertyLoader(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(), Split(' '), Get(0), MapCompose(int)) number_bathrooms_in = Compose(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') let_agreed_in = Compose(lambda xs: 'Let' if any('Let Agreed' in x for x in xs) else 'No')
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')
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')
class TerryOlpinPropertyLoader(ItemLoader): default_input_processor = Identity() default_output_processor = TakeFirst() area_in = Identity() price_per_month_in = TerryOlpinPriceProcessor() number_bedrooms_in = MapCompose(get_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(get_epc_rating)
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')