Update parking_lot.py
Fixed the typo where spot size was not being assigned and cleaned up the superspull/782/head
parent
a07e261677
commit
5d01ff2b34
|
@ -14,7 +14,7 @@ class Vehicle(metaclass=ABCMeta):
|
||||||
def __init__(self, vehicle_size, license_plate, spot_size):
|
def __init__(self, vehicle_size, license_plate, spot_size):
|
||||||
self.vehicle_size = vehicle_size
|
self.vehicle_size = vehicle_size
|
||||||
self.license_plate = license_plate
|
self.license_plate = license_plate
|
||||||
self.spot_size
|
self.spot_size=spot_size
|
||||||
self.spots_taken = []
|
self.spots_taken = []
|
||||||
|
|
||||||
def clear_spots(self):
|
def clear_spots(self):
|
||||||
|
@ -33,7 +33,7 @@ class Vehicle(metaclass=ABCMeta):
|
||||||
class Motorcycle(Vehicle):
|
class Motorcycle(Vehicle):
|
||||||
|
|
||||||
def __init__(self, license_plate):
|
def __init__(self, license_plate):
|
||||||
super(Motorcycle, self).__init__(VehicleSize.MOTORCYCLE, license_plate, spot_size=1)
|
super().__init__(VehicleSize.MOTORCYCLE, license_plate, spot_size=1)
|
||||||
|
|
||||||
def can_fit_in_spot(self, spot):
|
def can_fit_in_spot(self, spot):
|
||||||
return True
|
return True
|
||||||
|
@ -42,7 +42,7 @@ class Motorcycle(Vehicle):
|
||||||
class Car(Vehicle):
|
class Car(Vehicle):
|
||||||
|
|
||||||
def __init__(self, license_plate):
|
def __init__(self, license_plate):
|
||||||
super(Car, self).__init__(VehicleSize.COMPACT, license_plate, spot_size=1)
|
super().__init__(VehicleSize.COMPACT, license_plate, spot_size=1)
|
||||||
|
|
||||||
def can_fit_in_spot(self, spot):
|
def can_fit_in_spot(self, spot):
|
||||||
return spot.size in (VehicleSize.LARGE, VehicleSize.COMPACT)
|
return spot.size in (VehicleSize.LARGE, VehicleSize.COMPACT)
|
||||||
|
@ -51,7 +51,7 @@ class Car(Vehicle):
|
||||||
class Bus(Vehicle):
|
class Bus(Vehicle):
|
||||||
|
|
||||||
def __init__(self, license_plate):
|
def __init__(self, license_plate):
|
||||||
super(Bus, self).__init__(VehicleSize.LARGE, license_plate, spot_size=5)
|
super().__init__(VehicleSize.LARGE, license_plate, spot_size=5)
|
||||||
|
|
||||||
def can_fit_in_spot(self, spot):
|
def can_fit_in_spot(self, spot):
|
||||||
return spot.size == VehicleSize.LARGE
|
return spot.size == VehicleSize.LARGE
|
||||||
|
|
Loading…
Reference in New Issue