Skip to content

parking_spot

Module: Parking spot.

CompactSpot

Bases: ParkingSpot

Class: Handicapped Parking Spot.

Source code in parking_lot/src/parking_spot.py
57
58
59
60
61
62
class CompactSpot(ParkingSpot):
    """Class: Handicapped Parking Spot."""

    def __init__(self, number: int):
        """Initialize handicapped parking spot."""
        super().__init__(number, ParkingSpotType.COMPACT)

__init__(number)

Initialize handicapped parking spot.

Source code in parking_lot/src/parking_spot.py
60
61
62
def __init__(self, number: int):
    """Initialize handicapped parking spot."""
    super().__init__(number, ParkingSpotType.COMPACT)

HandicappedSpot

Bases: ParkingSpot

Class: Handicapped Parking Spot.

Source code in parking_lot/src/parking_spot.py
49
50
51
52
53
54
class HandicappedSpot(ParkingSpot):
    """Class: Handicapped Parking Spot."""

    def __init__(self, number: int):
        """Initialize handicapped parking spot."""
        super().__init__(number, ParkingSpotType.HANDICAPPED)

__init__(number)

Initialize handicapped parking spot.

Source code in parking_lot/src/parking_spot.py
52
53
54
def __init__(self, number: int):
    """Initialize handicapped parking spot."""
    super().__init__(number, ParkingSpotType.HANDICAPPED)

LargeSpot

Bases: ParkingSpot

Class: Large Parking Spot.

Source code in parking_lot/src/parking_spot.py
65
66
67
68
69
70
class LargeSpot(ParkingSpot):
    """Class: Large Parking Spot."""

    def __init__(self, number: int):
        """Initialize large parking spot."""
        super().__init__(number, ParkingSpotType.LARGE)

__init__(number)

Initialize large parking spot.

Source code in parking_lot/src/parking_spot.py
68
69
70
def __init__(self, number: int):
    """Initialize large parking spot."""
    super().__init__(number, ParkingSpotType.LARGE)

MotorbikeSpot

Bases: ParkingSpot

Class: Motorbike Parking Spot.

Source code in parking_lot/src/parking_spot.py
73
74
75
76
77
78
class MotorbikeSpot(ParkingSpot):
    """Class: Motorbike Parking Spot."""

    def __init__(self, number: int):
        """Initialize motorbike parking spot."""
        super().__init__(number, ParkingSpotType.MOTORBIKE)

__init__(number)

Initialize motorbike parking spot.

Source code in parking_lot/src/parking_spot.py
76
77
78
def __init__(self, number: int):
    """Initialize motorbike parking spot."""
    super().__init__(number, ParkingSpotType.MOTORBIKE)

ParkingSpot

Class: Parking Spot.

Source code in parking_lot/src/parking_spot.py
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
class ParkingSpot:
    """Class: Parking Spot."""

    def __init__(self, floor: int, spot_id: int, spot_type: ParkingSpotType):
        """Initialize Vehicle instance.

        Args:
            floor (int): Floor number
            spot_id (int): Parking spot number
            spot_type (Enum): Parking spot type Enum
        """
        self._floor = floor
        self.spot_id = spot_id
        self._free = True
        self._vehicle = None
        self.spot_type = spot_type

    def assign_vehicle(self, vehicle: Vehicle):
        """Assign vehicle to parking spot.

        Args:
            vehicle (Vehicle): Vehicle Instance
        """
        self._vehicle = vehicle
        self._free = False

    def remove_vehicle(self):
        """Remove vehicle from parking spot."""
        self._vehicle = None
        self._free = True

__init__(floor, spot_id, spot_type)

Initialize Vehicle instance.

Parameters:

Name Type Description Default
floor int

Floor number

required
spot_id int

Parking spot number

required
spot_type Enum

Parking spot type Enum

required
Source code in parking_lot/src/parking_spot.py
20
21
22
23
24
25
26
27
28
29
30
31
32
def __init__(self, floor: int, spot_id: int, spot_type: ParkingSpotType):
    """Initialize Vehicle instance.

    Args:
        floor (int): Floor number
        spot_id (int): Parking spot number
        spot_type (Enum): Parking spot type Enum
    """
    self._floor = floor
    self.spot_id = spot_id
    self._free = True
    self._vehicle = None
    self.spot_type = spot_type

assign_vehicle(vehicle)

Assign vehicle to parking spot.

Parameters:

Name Type Description Default
vehicle Vehicle

Vehicle Instance

required
Source code in parking_lot/src/parking_spot.py
34
35
36
37
38
39
40
41
def assign_vehicle(self, vehicle: Vehicle):
    """Assign vehicle to parking spot.

    Args:
        vehicle (Vehicle): Vehicle Instance
    """
    self._vehicle = vehicle
    self._free = False

remove_vehicle()

Remove vehicle from parking spot.

Source code in parking_lot/src/parking_spot.py
43
44
45
46
def remove_vehicle(self):
    """Remove vehicle from parking spot."""
    self._vehicle = None
    self._free = True

ParkingSpotType

Bases: Enum

Types of Parking Spots.

Source code in parking_lot/src/parking_spot.py
 8
 9
10
11
12
13
14
class ParkingSpotType(Enum):
    """Types of Parking Spots."""

    HANDICAPPED = "handicapped"
    COMPACT = "compact"
    LARGE = "large"
    MOTORBIKE = "motorbike"