Ejemplo n.º 1
0
 def from_dict(cls, data):
     poi = cls()
     poi.slug = data.get('slug')
     poi.names = LocalisedNames(LocalisedName(**name) for name in data.get('names', []))
     poi.descriptions = LocalisedNames(LocalisedName(**name) for name in data.get('descriptions', []))
     poi.identifiers = Identifiers(Identifier(**name) for name in data.get('identifiers', []))
     poi.address = data.get('address')
     poi.locality = data.get('locality')
     poi.telephone_number = data.get('telephone_number')
     poi.opening_hours = data.get('opening_hours', [])
     poi.categories = data.get('categories', [])
     poi.amenities = data.get('amenities', [])
     poi.geography = asShape(data['geography']) if data.get('geography') else None
     poi.location = asShape(data['location']) if data.get('location') else None
     poi.sources = [Source.from_dict(source) for source in data.get('sources', [])]
     return poi