Remove unnecessary bool checks on patking_lot.py
parent
a70a8f3a04
commit
90600559bd
|
@ -85,9 +85,7 @@ class Level(object):
|
||||||
|
|
||||||
def park_vehicle(self, vehicle):
|
def park_vehicle(self, vehicle):
|
||||||
spot = self._find_available_spot(vehicle)
|
spot = self._find_available_spot(vehicle)
|
||||||
if spot is None:
|
if spot:
|
||||||
return None
|
|
||||||
else:
|
|
||||||
spot.park_vehicle(vehicle)
|
spot.park_vehicle(vehicle)
|
||||||
return spot
|
return spot
|
||||||
|
|
||||||
|
@ -111,10 +109,10 @@ class ParkingSpot(object):
|
||||||
self.vehicle = None
|
self.vehicle = None
|
||||||
|
|
||||||
def is_available(self):
|
def is_available(self):
|
||||||
return True if self.vehicle is None else False
|
return not self.vehicle
|
||||||
|
|
||||||
def can_fit_vehicle(self, vehicle):
|
def can_fit_vehicle(self, vehicle):
|
||||||
if self.vehicle is not None:
|
if self.vehicle:
|
||||||
return False
|
return False
|
||||||
return vehicle.can_fit_in_spot(self)
|
return vehicle.can_fit_in_spot(self)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue