Skip to content

Commit a13b2c2

Browse files
committed
fix linter issues in app.py
1 parent 860dab0 commit a13b2c2

File tree

1 file changed

+2
-9
lines changed

1 file changed

+2
-9
lines changed

app.py

+2-9
Original file line numberDiff line numberDiff line change
@@ -378,33 +378,26 @@ def user_information():
378378
Handle user information requests
379379
"""
380380
if request.method == "GET":
381-
# Return the user information (assuming there's only one user in this case)
382381
return jsonify([user.__dict__ for user in data["user_information"]]), 200
383382

384383
request_body = request.get_json()
385384

386-
# Validate the required fields
387385
error = validate_fields(["name", "email_address", "phone_number"], request_body)
388386
if error:
389387
return jsonify({"error": f"{', '.join(error)} parameter(s) is required"}), 400
390388

391-
# Validate the phone number format
392389
is_valid_phone_number = validate_phone_number(request_body["phone_number"])
393390
if not is_valid_phone_number:
394391
return jsonify({"error": "Invalid phone number"}), 400
395392

396393
if request.method in ("POST", "PUT"):
397-
# Create new user information instance
398394
new_user_information = UserInformation(
399395
name=request_body["name"],
400396
email_address=request_body["email_address"],
401397
phone_number=request_body["phone_number"]
402398
)
403399

404-
# Since user information is unique, overwrite the existing one
405400
data["user_information"] = [new_user_information]
406-
407-
# Save the data to the JSON file
408401
save_data("data/data.json", data)
409402

410403
return jsonify(new_user_information.__dict__), 201
@@ -537,8 +530,8 @@ def uploaded_file(filename):
537530

538531
@app.route("/resume/data", methods=["GET"])
539532
def get_data():
540-
data = load_data("data/data.json")
541533
"""
542534
Get all data from the data.json file
543535
"""
544-
return jsonify(data), 200
536+
final_data = load_data("data/data.json")
537+
return jsonify(final_data), 200

0 commit comments

Comments
 (0)