def __init__(self, src, dst, flight_type=None, travel_id=None, arrival_time=None, return_time=None): super(FlyingFleet, self).__init__() self.src = coords_to_key(src) self.dst = coords_to_key(dst) self.travel_id = travel_id if travel_id is not None else str(uuid4()) if arrival_time is not None and not isinstance(arrival_time, datetime.datetime): arrival_time = dateutil.parser.parse(arrival_time) if return_time is not None and not isinstance(return_time, datetime.datetime): return_time = dateutil.parser.parse(return_time) self.flight_type = flight_type self.arrival_time = arrival_time self.return_time = return_time
def __init__(self, src, dst, data=None, flight_type=None, travel_id=None, arrival_time=None, return_time=None): super().__init__(data) self.src = coords_to_key(src) self.dst = coords_to_key(dst) self.travel_id = travel_id if travel_id is not None else str(uuid4()) if arrival_time is not None \ and not isinstance(arrival_time, datetime.datetime): arrival_time = dateutil.parser.parse(arrival_time) if return_time is not None \ and not isinstance(return_time, datetime.datetime): return_time = dateutil.parser.parse(return_time) self.flight_type = flight_type self.arrival_time = arrival_time self.return_time = return_time
def key(self): return coords_to_key(self.coords)
def __str__(self): return '%s %r' % (self.name, coords_to_key(self.coords))