Remove unnecessary bool checks on patking_lot.py

pull/160/head
Daniel 2018-04-29 18:14:28 +02:00 committed by GitHub
parent a70a8f3a04
commit 90600559bd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 5 deletions

View File

@ -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)