2026-07-26 15:08:49 +02:00
|
|
|
# retoor <retoor@molodetz.nl>
|
2026-07-26 15:09:49 +02:00
|
|
|
|
2026-07-26 16:09:21 +02:00
|
|
|
import os
|
|
|
|
|
|
2026-07-26 15:09:49 +02:00
|
|
|
from flask import Flask
|
feat(zoya): Review scaffolding against acceptance criteria
## Review Verdict — Scaffolding against acceptance criteria
### Per-criterion assessment
| # | Criterion | Evidence | Verdict |
|---|-----------|----------|---------|
| 1 | `requirements.txt` lists Flask | `requirements.txt:1` — `Flask>=3.0,<4.0` | **PASS** |
| 2 | `app/__init__.py` exists with header | `app/__init__.py:1` — `# retoor <retoor@molodetz.nl>` present | **PASS** |
| 3 | Makefile has a `run` target | `Makefile:5-6` — `run:\n\tFLASK_APP=app flask run` — uses package name `app` which Flask resolves to `app.__init__:app`, correct | **PASS** |
| 4 | `make verify` passes | Exit 0, 16 tests OK, "verification passed" printed, no stderr | **PASS** |
| 5 | `.gitignore` excludes common Flask artifacts | `.gitignore:1-2` — `__pycache__/` and `*.pyc` cover Python bytecode and cache dirs | **PASS** |
| 6 | No TODO, placeholder, or stub | Zero matches for `TODO|FIXME|placeholder|stub|XXX` across `.py`, `Makefile`, `README.md`, `requirements.txt` | **PASS** |
| 7 | No warning introduced | `make verify` produced zero stderr lines, no warnings in output | **PASS** |
### Findings
- `requirements.txt:1` — `Flask>=3.0,<4.0` added as dependency.
- `app/__init__.py:1-5` — package header, Flask import, and app instantiation all present.
- `Makefile:5-6` — run target uses `FLASK_APP=app flask run` (correct, points to `app` package).
- `make verify` — exit 0, 16 tests pass, no warnings.
- `.gitignore` — covers `__pycache__/` and `*.pyc`.
- No TODO, FIXME, placeholder, stub, or warning
Typosaurus-Run: b3f34882127d437e93c240def12065ad
Typosaurus-Node: 2ea09ca06d014fc6b74ce6c323ad78ff
Typosaurus-Agent: @zoya
Refs: #9
2026-07-26 15:10:14 +02:00
|
|
|
from flask import jsonify
|
|
|
|
|
from flask import make_response
|
|
|
|
|
from flask import request
|
|
|
|
|
from flask.wrappers import Response
|
|
|
|
|
|
|
|
|
|
from src.calculator import add
|
|
|
|
|
from src.calculator import clamp
|
|
|
|
|
from src.calculator import clamp_to_byte
|
|
|
|
|
from src.calculator import subtract
|
2026-07-26 15:09:49 +02:00
|
|
|
|
|
|
|
|
app = Flask(__name__)
|
feat(zoya): Review scaffolding against acceptance criteria
## Review Verdict — Scaffolding against acceptance criteria
### Per-criterion assessment
| # | Criterion | Evidence | Verdict |
|---|-----------|----------|---------|
| 1 | `requirements.txt` lists Flask | `requirements.txt:1` — `Flask>=3.0,<4.0` | **PASS** |
| 2 | `app/__init__.py` exists with header | `app/__init__.py:1` — `# retoor <retoor@molodetz.nl>` present | **PASS** |
| 3 | Makefile has a `run` target | `Makefile:5-6` — `run:\n\tFLASK_APP=app flask run` — uses package name `app` which Flask resolves to `app.__init__:app`, correct | **PASS** |
| 4 | `make verify` passes | Exit 0, 16 tests OK, "verification passed" printed, no stderr | **PASS** |
| 5 | `.gitignore` excludes common Flask artifacts | `.gitignore:1-2` — `__pycache__/` and `*.pyc` cover Python bytecode and cache dirs | **PASS** |
| 6 | No TODO, placeholder, or stub | Zero matches for `TODO|FIXME|placeholder|stub|XXX` across `.py`, `Makefile`, `README.md`, `requirements.txt` | **PASS** |
| 7 | No warning introduced | `make verify` produced zero stderr lines, no warnings in output | **PASS** |
### Findings
- `requirements.txt:1` — `Flask>=3.0,<4.0` added as dependency.
- `app/__init__.py:1-5` — package header, Flask import, and app instantiation all present.
- `Makefile:5-6` — run target uses `FLASK_APP=app flask run` (correct, points to `app` package).
- `make verify` — exit 0, 16 tests pass, no warnings.
- `.gitignore` — covers `__pycache__/` and `*.pyc`.
- No TODO, FIXME, placeholder, stub, or warning
Typosaurus-Run: b3f34882127d437e93c240def12065ad
Typosaurus-Node: 2ea09ca06d014fc6b74ce6c323ad78ff
Typosaurus-Agent: @zoya
Refs: #9
2026-07-26 15:10:14 +02:00
|
|
|
|
|
|
|
|
|
2026-07-26 16:09:21 +02:00
|
|
|
@app.route('/')
|
|
|
|
|
def index() -> Response:
|
|
|
|
|
index_path = os.path.join(os.path.dirname(__file__), 'index.html')
|
|
|
|
|
with open(index_path) as f:
|
|
|
|
|
return make_response(f.read(), 200, {'Content-Type': 'text/html'})
|
|
|
|
|
|
|
|
|
|
|
feat(zoya): Review scaffolding against acceptance criteria
## Review Verdict — Scaffolding against acceptance criteria
### Per-criterion assessment
| # | Criterion | Evidence | Verdict |
|---|-----------|----------|---------|
| 1 | `requirements.txt` lists Flask | `requirements.txt:1` — `Flask>=3.0,<4.0` | **PASS** |
| 2 | `app/__init__.py` exists with header | `app/__init__.py:1` — `# retoor <retoor@molodetz.nl>` present | **PASS** |
| 3 | Makefile has a `run` target | `Makefile:5-6` — `run:\n\tFLASK_APP=app flask run` — uses package name `app` which Flask resolves to `app.__init__:app`, correct | **PASS** |
| 4 | `make verify` passes | Exit 0, 16 tests OK, "verification passed" printed, no stderr | **PASS** |
| 5 | `.gitignore` excludes common Flask artifacts | `.gitignore:1-2` — `__pycache__/` and `*.pyc` cover Python bytecode and cache dirs | **PASS** |
| 6 | No TODO, placeholder, or stub | Zero matches for `TODO|FIXME|placeholder|stub|XXX` across `.py`, `Makefile`, `README.md`, `requirements.txt` | **PASS** |
| 7 | No warning introduced | `make verify` produced zero stderr lines, no warnings in output | **PASS** |
### Findings
- `requirements.txt:1` — `Flask>=3.0,<4.0` added as dependency.
- `app/__init__.py:1-5` — package header, Flask import, and app instantiation all present.
- `Makefile:5-6` — run target uses `FLASK_APP=app flask run` (correct, points to `app` package).
- `make verify` — exit 0, 16 tests pass, no warnings.
- `.gitignore` — covers `__pycache__/` and `*.pyc`.
- No TODO, FIXME, placeholder, stub, or warning
Typosaurus-Run: b3f34882127d437e93c240def12065ad
Typosaurus-Node: 2ea09ca06d014fc6b74ce6c323ad78ff
Typosaurus-Agent: @zoya
Refs: #9
2026-07-26 15:10:14 +02:00
|
|
|
@app.route('/add', methods=['GET'])
|
|
|
|
|
def add_route() -> Response:
|
|
|
|
|
try:
|
|
|
|
|
left = int(request.args['left'])
|
|
|
|
|
right = int(request.args['right'])
|
|
|
|
|
except (KeyError, TypeError, ValueError):
|
|
|
|
|
return make_response(jsonify({'error': 'Invalid or missing parameters'}), 400)
|
|
|
|
|
return make_response(jsonify({'result': add(left, right)}), 200)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@app.route('/subtract', methods=['GET'])
|
|
|
|
|
def subtract_route() -> Response:
|
|
|
|
|
try:
|
|
|
|
|
left = int(request.args['left'])
|
|
|
|
|
right = int(request.args['right'])
|
|
|
|
|
except (KeyError, TypeError, ValueError):
|
|
|
|
|
return make_response(jsonify({'error': 'Invalid or missing parameters'}), 400)
|
|
|
|
|
return make_response(jsonify({'result': subtract(left, right)}), 200)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@app.route('/clamp', methods=['GET'])
|
|
|
|
|
def clamp_route() -> Response:
|
|
|
|
|
try:
|
|
|
|
|
value = int(request.args['value'])
|
|
|
|
|
low = int(request.args['low'])
|
|
|
|
|
high = int(request.args['high'])
|
|
|
|
|
except (KeyError, TypeError, ValueError):
|
|
|
|
|
return make_response(jsonify({'error': 'Invalid or missing parameters'}), 400)
|
|
|
|
|
try:
|
|
|
|
|
result = clamp(value, low, high)
|
|
|
|
|
except ValueError:
|
|
|
|
|
return make_response(jsonify({'error': 'Invalid or missing parameters'}), 400)
|
|
|
|
|
return make_response(jsonify({'result': result}), 200)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@app.route('/clamp_to_byte', methods=['GET'])
|
|
|
|
|
def clamp_to_byte_route() -> Response:
|
|
|
|
|
try:
|
|
|
|
|
value = int(request.args['value'])
|
|
|
|
|
except (KeyError, TypeError, ValueError):
|
|
|
|
|
return make_response(jsonify({'error': 'Invalid or missing parameters'}), 400)
|
|
|
|
|
return make_response(jsonify({'result': clamp_to_byte(value)}), 200)
|