# Some common objects for RPC communication #------------------------------------------------------------------------------ from . import const #------------------------------------------------------------------------------ class Plane(object): """Information about an airplane in the fleet.""" @staticmethod def str2status(letter): """Convert the given letter into a plane status.""" return const.PLANE_HOME if letter=="H" else \ const.PLANE_AWAY if letter=="A" else \ const.PLANE_PARKING if letter=="P" else \ const.PLANE_UNKNOWN @staticmethod def status2str(status): """Convert the given status into the corresponding letter code.""" return "H" if status==const.PLANE_HOME else \ "A" if status==const.PLANE_AWAY else \ "P" if status==const.PLANE_PARKING else "" def _setStatus(self, letter): """Set the status from the given letter.""" self.status = Plane.str2status(letter) def __repr__(self): """Get the representation of the plane object.""" s = "