def prompt_init(): parent_init = Property.prompt_init() laundry = get_valid_custom_input(PROMPT_MESSAGE["laundry_input"], Apartment.valid_laundries) or '' balcony = get_valid_custom_input(PROMPT_MESSAGE["balcony_input"], Apartment.valid_balconies) or '' parent_init.update({"laundry": laundry, "balcony": balcony}) #print(parent_init, '-->') return parent_init
def add_property(self): property_type = get_valid_custom_input(PROMPT_MESSAGE["property_type"], Agent.type_property) payment_type = get_valid_custom_input(PROMPT_MESSAGE["payment_type"], Agent.type_contract) PropertyClass = self.type_map[(property_type, payment_type)] args_property = PropertyClass.prompt_init() current_property = PropertyClass(**args_property) self.propertyList.append(current_property) current_property.display()
def prompt_init(): return dict(furnished=get_valid_custom_input( PROMPT_MESSAGE["furnished"], ("yes", "no")), utilities=get_valid_type_input(PROMPT_MESSAGE["utilities"], "numbers"), rent=get_valid_type_input(PROMPT_MESSAGE["rent"], "number"))
def prompt_init(): parent_init = Property.prompt_init() num_stories = get_valid_type_input(PROMPT_MESSAGE["num_stories"], "number") or '' garage = get_valid_custom_input(PROMPT_MESSAGE["garage"], House.valid_garage) or '' fenced = get_valid_custom_input(PROMPT_MESSAGE["fenced"], House.valid_fenced) or '' parent_init.update({ "num_stories": num_stories, "garage": garage, "fenced": fenced }) #print(parent_init) return parent_init
def search_properties(self): list_properties = self.agent.list_properties() matching_properties = [] payment_type = get_valid_custom_input(PROMPT_MESSAGE["payment_type"], ("rental", "purchase", "none")) property_type = get_valid_custom_input(PROMPT_MESSAGE["property_type"], ("house", "apartment", "none")) querySring = '' if (property_type.lower() != 'none'): querySring += property_type.capitalize() if (payment_type.lower() != 'none'): querySring += payment_type.capitalize() for value in list_properties: if querySring and querySring in str(value.__class__.__name__): matching_properties.append(value) print(matching_properties)