Skip to content
This repository was archived by the owner on Apr 16, 2023. It is now read-only.

Commit d60aa76

Browse files
author
Patrick Kuehn
committed
Refactor for travis ci imports and docstrings
1 parent 400c24d commit d60aa76

File tree

6 files changed

+12
-16
lines changed

6 files changed

+12
-16
lines changed

autofocus/predict/app/models/File.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import os
2+
23
from werkzeug import secure_filename
34

45

autofocus/predict/app/models/Predictor.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ def predict_multiple(self, files):
3535
3636
Parameters:
3737
files: Dict with File objects of image file
38-
38+
3939
Returns:
4040
dict: Dictionary of probabilities for each file in files
4141
"""
@@ -45,7 +45,6 @@ def predict_multiple(self, files):
4545
predictions[key] = self.getProbabilities()
4646
return predictions
4747

48-
4948
def getProbabilities(self):
5049
"""
5150
Return formated Probabilities

autofocus/predict/app/models/ZipArchive.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import os
22
from zipfile import ZipFile
3+
34
from .File import File
45
from ..requests.Validator import ALLOWED_IMAGE_FILES
56
from ..utils import allowed_file
@@ -46,7 +47,7 @@ def listAllImages(self, extensions=ALLOWED_IMAGE_FILES):
4647
4748
Parameters:
4849
extensions: Array of allowed image extensions
49-
50+
5051
Returns:
5152
array: Array of filenames matching the extension
5253
"""
@@ -58,7 +59,7 @@ def hasImages(self, extensions=ALLOWED_IMAGE_FILES):
5859
5960
Parameters:
6061
extensions: Array of allowed image extensions
61-
62+
6263
Returns:
6364
boolean: True if zip has images
6465
"""
@@ -74,9 +75,9 @@ def extractAll(self, path=None, members=None):
7475
Parameters:
7576
path: Path to store files
7677
members: Files to extract
77-
78+
7879
Returns:
79-
array: Array of extracted File objects
80+
array: Array of extracted File objects
8081
"""
8182
self.zip.extractall(path, members)
8283
extractedFiles = {}

autofocus/predict/app/requests/PredictRequestValidator.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,7 @@
33

44

55
class PredictRequestValidator(Validator):
6-
"""
7-
Validate request for endpoint predict
8-
"""
6+
"""Validate request for endpoint predict"""
97

108
def validate(self):
119
"""

autofocus/predict/app/requests/PredictZipRequestValidator.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,7 @@
33

44

55
class PredictZipRequestValidator(Validator):
6-
"""
7-
Validate request for endpoint predict_zip
8-
"""
6+
"""Validate request for endpoint predict_zip"""
97

108
def validate(self):
119
"""

autofocus/predict/app/requests/Validator.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
from abc import ABC, abstractmethod
2+
23
from flask import abort, jsonify, make_response
34
from flask_api import status
45

@@ -48,11 +49,9 @@ def getError(self):
4849
dict: The errors found during validation
4950
"""
5051
return self.error
51-
52+
5253
def abort(self):
53-
"""
54-
Abort with errors
55-
"""
54+
"""Abort with errors"""
5655
abort(make_response(
5756
jsonify(
5857
status=status.HTTP_400_BAD_REQUEST,

0 commit comments

Comments
 (0)