{"id":21302290,"url":"https://github.com/aziguy/use_case_ayomi","last_synced_at":"2025-03-15T18:41:57.277Z","repository":{"id":228742374,"uuid":"774770334","full_name":"Aziguy/use_case_ayomi","owner":"Aziguy","description":"Calculator in Reverse Polish Notation (RPN)","archived":false,"fork":false,"pushed_at":"2024-03-21T13:01:35.000Z","size":47100,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-01-22T08:16:36.916Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Aziguy.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2024-03-20T06:37:23.000Z","updated_at":"2024-07-24T12:40:51.000Z","dependencies_parsed_at":"2024-03-20T08:54:43.940Z","dependency_job_id":null,"html_url":"https://github.com/Aziguy/use_case_ayomi","commit_stats":null,"previous_names":["aziguy/use_case_ayomi"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Aziguy%2Fuse_case_ayomi","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Aziguy%2Fuse_case_ayomi/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Aziguy%2Fuse_case_ayomi/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Aziguy%2Fuse_case_ayomi/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Aziguy","download_url":"https://codeload.github.com/Aziguy/use_case_ayomi/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243776404,"owners_count":20346350,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-21T15:55:38.541Z","updated_at":"2025-03-15T18:41:57.254Z","avatar_url":"https://github.com/Aziguy.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Calculator in Reverse Polish Notation (RPN).\n\nThis is an API for a Reverse Polish Notation (RPN) calculator. It allows users to perform arithmetic calculations by providing mathematical expressions in RPN format.\n\n## Calculator Class\n\nThe `Calculator` class is responsible for evaluating mathematical expressions in Reverse Polish Notation. It contains the following methods:\n\n### `__init__()`\n\n- Initializes the calculator with an empty stack.\n\n### `evaluate_expression(expression: str) -\u003e float`\n\n- Evaluates a mathematical expression provided in RPN format.\n- Args:\n  - `expression` (str): The mathematical expression in RPN format to evaluate.\n- Returns:\n  - `float`: The calculated result.\n- Raises:\n  - `ValueError`: If the expression is invalid (e.g., not enough operands, unknown token, division by zero).\n\n## API Routes\n\n### POST /calculate/\n\n- Endpoint for calculating the result of a mathematical expression.\n- Request Body:\n  - `expression` (str): The mathematical expression in RPN format.\n- Response:\n  - `result` (float): The calculated result.\n- Example:\n  ```\n  POST /calculate/\n  {\n    \"expression\": \"2 3 +\"\n  }\n  Response: {\"result\": 5.0}\n  ```\n\n### GET /\n\n- Endpoint for displaying the home page of the API.\n- Response:\n  - HTML page containing the calculations history.\n- Example:\n  ```\n  GET /\n  Response: HTML page with calculations history\n  ```\n\n## Getting Started\n\n1. Clone this repository.\n2. Install the required dependencies using `pip install -r requirements.txt`.\n3. Run the API server using `uvicorn app:app --reload`.\n4. Access the API endpoints using an HTTP client or web browser.\n\n\n## DEMO\n\nYou can check RPN using curl like\n\n⚠️ please make sure you have cURL install in your computer ⚠️\n\n\n```\ncurl -X 'POST' \\\n  'http://127.0.0.1:8000/calculate/' \\\n  -H 'accept: application/json' \\\n  -H 'Content-Type: application/json' \\\n  -d '{\n  \"expression\": \"8 9 +\"\n}'\n```\n\nYou should get **17**\n\n```\n{\n  \"result\": 17\n}\n```\n\nSee the documentation interface from [here](http://127.0.0.1:8000/docs) or [here](http://127.0.0.1:8000/redoc)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faziguy%2Fuse_case_ayomi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faziguy%2Fuse_case_ayomi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faziguy%2Fuse_case_ayomi/lists"}