AirBnB_clone_v2
AirBnB_clone_v2 copied to clipboard
method get() & count() were added to file_storage and db_storage
DBStorage and FileStorage updated.
Two new methods were added to both files:
-
A method to retrieve one object:
- Prototype:
def get(self, cls, id)
-
cls
: class -
id
: string representing the object ID - RETURN: object based on the class and its ID, or None if not found.
- Prototype:
-
A method to count the number of objects in storage:
- Prototype:
def count(self, cls=None)
-
cls
: class (optional) - RETURN: number of objects in storage matching the given class. If no class is passed, returns the count of all objects in storage.
- Prototype:
New tests were added for these 2 methods on each storage engine.