Skip to content
Snippets Groups Projects

Resolve "cleanup and documentation"

12 files
+ 81
16
Compare changes
  • Side-by-side
  • Inline

Files

+ 8
2
@@ -12,6 +12,13 @@ from path_constants import _ACCESS_DATABASE
from image_encoder.image_encoder import *
import cv2
"""
Endpoint for editing salamanders.
GET: Gets a specific salamanders original and processed image, and all its data.
PUT: Edits a specific salamander with new data like sex, species, location etc.
DELETE: Deletes a specific salamander from the system.
"""
class EditSalamander(Resource):
decorators = [limiter.limit("60/minute")]
@@ -41,7 +48,6 @@ class EditSalamander(Resource):
height, width, _ = image.shape
desired_long_side = 320
scaling_factor = 1
if width > height:
scaling_factor = desired_long_side / width
@@ -145,7 +151,7 @@ class EditSalamander(Resource):
if "location" in data and "new_location" in data and "new_sex" in data and "new_species" in data:
if data['location'] != data['new_location'] or salamander.sex != data[
'new_sex'] or salamander.species != data['new_species']:
'new_sex'] or salamander.species != data['new_species']:
salamander_path = os.path.join("images", data['location'], salamander.species,
salamander.sex, str(salamander.id))
new_path_to_images = os.path.join("images", data['new_location'], data['new_species'],
Loading