Giter Site home page Giter Site logo

airbnb_clone's Introduction

AirBnB clone - The console

General Objectives ๐Ÿš€

  • Create a Python package fda,mfladsl
  • Create a command interpreter in Python using the cmd module
  • Usage Unit testing and how to implement it in a large project
  • Serialize and deserialize a Class
  • Write and read a JSON file
  • Use of manage datetime
  • Use of UUID
  • Use of * args and how to use it
  • Use of * kwargs and how to use it
  • To handle named arguments in a function.

Requirements ๐Ÿ“‘

  • Python Scripts
  • Python Unit Tests

forthebadge


Table of Contents

Directory Files
Models Main Class BaseModel and Sub Classes: City, State, Review, User, Amenity, Place.
Engine Class FileStorage
Tests All project tests

The command interpreter ๐Ÿ•น๏ธ

In order to manage the objects of our program, we create an environment where we can use and execute specific commands that will allow us to manage our program in a more efficient way,


Interactive mode: ๐Ÿ’ป

โžœ  AirBnB_clone git:(main) โœ— ./console.py 
(hbnb)help

Documented commands (type help <topic>):
========================================
EOF  User  all  create  destroy  help  quit  show

(hbnb)
(hbnb)
(hbnb)
(hbnb)quit
โžœ  AirBnB_clone git:(main) โœ— 

##In non-interactive mode: ๐Ÿ–ฅ๏ธ

โžœ  AirBnB_clone git:(main) โœ— echo "help" | ./console.py
(hbnb)
Documented commands (type help <topic>):
========================================
EOF  User  all  create  destroy  help  quit  show

(hbnb)%                                                                     
โžœ  AirBnB_clone git:(main) โœ— 

Usage of commands

Syntax : quit

Command to exit the program

โžœ  AirBnB_clone git:(main) โœ— ./console.py 
(hbnb)
(hbnb)quit
โžœ  AirBnB_clone git:(main) โœ— 

Syntax : EOF

Command to exit the program

โžœ  AirBnB_clone git:(main) โœ— ./console.py
(hbnb)
(hbnb)EOF
โžœ  AirBnB_clone git:(main) โœ— 

Syntax : create

Creates a new instance of BaseModel, saves it (to the JSON file) and prints the id.

โžœ  AirBnB_clone git:(main) โœ— ./console.py
(hbnb)
(hbnb)create
** class name missing **
(hbnb)create MyModel
** class does not exist **
(hbnb)create BaseModel
.9fbd3cc9-3e0b-411b-ac1b-5a8e01b64a1d
(hbnb)
(hbnb)

Syntax : show

Prints the string representation of an instance based on the class name and id.

โžœ  AirBnB_clone git:(main) โœ— ./console.py
(hbnb)
(hbnb)show
** class name missing **
(hbnb)show MyModel
** class doesnt exist **
(hbnb)show BaseModel
** instance id missing **
(hbnb)show BaseModel 121212
** no instance found **
(hbnb)
(hbnb)show 9fbd3cc9-3e0b-411b-ac1b-5a8e01b64a1d
** class doesnt exist **
(hbnb)show BaseModel 9fbd3cc9-3e0b-411b-ac1b-5a8e01b64a1d
[BaseModel] (9fbd3cc9-3e0b-411b-ac1b-5a8e01b64a1d) {'created_at': datetime.datetime(2021, 11, 13, 23, 5, 18, 456036), 'id': '9fbd3cc9-3e0b-411b-ac1b-5a8e01b64a1d', 'updated_at': datetime.datetime(2021, 11, 13, 23, 5, 18, 456053)}
(hbnb)

Syntax : destroy

Deletes an instance based on the class name and id (save the change into the JSON file).

โžœ  AirBnB_clone git:(main) โœ— ./console.py
(hbnb)
(hbnb)destroy
** class name missing **
(hbnb)destroy MyModel
** class doesnt exist **
(hbnb)destroy BaseModel
** instance id missing **
(hbnb)destroy BaseModel 121212
** no instance found **
(hbnb)destroy BaseModel 9fbd3cc9-3e0b-411b-ac1b-5a8e01b64a1d
(hbnb)

Syntax : all

Prints all string representation of all instances based or not on the class name.

โžœ  AirBnB_clone git:(main) โœ— ./console.py
(hbnb)
(hbnb)all BaseModel
[BaseModel] (d4f94723-c724-4803-a92c-342a69dee1d7) {'created_at': datetime.datetime(2021, 11, 12, 20, 21, 40, 173122), 'id': 'd4f94723-c724-4803-a92c-342a69dee1d7', 'my_number': 89, 'name': 'My_First_Model', 'updated_at': datetime.datetime(2021, 11, 12, 20, 21, 40, 173128)}
[BaseModel] (d7b39e6f-3694-4380-b892-6c79faae9361) {'created_at': datetime.datetime(2021, 11, 12, 20, 21, 42, 356737), 'id': 'd7b39e6f-3694-4380-b892-6c79faae9361', 'my_number': 89, 'name': 'My_First_Model', 'updated_at': datetime.datetime(2021, 11, 12, 20, 21, 42, 356743)}
[BaseModel] (f50daab2-e7b7-4ae9-98fc-5681c59a2fbb) {'created_at': datetime.datetime(2021, 11, 12, 20, 21, 25, 303542), 'id': 'f50daab2-e7b7-4ae9-98fc-5681c59a2fbb', 'my_number': 89, 'name': 'My_First_Model', 'updated_at': datetime.datetime(2021, 11, 12, 20, 21, 25, 303566)}

Syntax : Update

Updates an instance based on the class name and id by adding or updating attribute (save the change into the JSON file).


Flowchart

AUTHORS

forthebadge


`



` ```

airbnb_clone's People

Contributors

mahalaksmy avatar julian-carlosama avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.