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

Commit

Permalink
Refactor for travis ci imports and docstrings
Browse files Browse the repository at this point in the history
  • Loading branch information
Patrick Kuehn committed Oct 16, 2019
1 parent 400c24d commit d60aa76
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 16 deletions.
1 change: 1 addition & 0 deletions autofocus/predict/app/models/File.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import os

from werkzeug import secure_filename


Expand Down
3 changes: 1 addition & 2 deletions autofocus/predict/app/models/Predictor.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def predict_multiple(self, files):
Parameters:
files: Dict with File objects of image file
Returns:
dict: Dictionary of probabilities for each file in files
"""
Expand All @@ -45,7 +45,6 @@ def predict_multiple(self, files):
predictions[key] = self.getProbabilities()
return predictions


def getProbabilities(self):
"""
Return formated Probabilities
Expand Down
9 changes: 5 additions & 4 deletions autofocus/predict/app/models/ZipArchive.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import os
from zipfile import ZipFile

from .File import File
from ..requests.Validator import ALLOWED_IMAGE_FILES
from ..utils import allowed_file
Expand Down Expand Up @@ -46,7 +47,7 @@ def listAllImages(self, extensions=ALLOWED_IMAGE_FILES):
Parameters:
extensions: Array of allowed image extensions
Returns:
array: Array of filenames matching the extension
"""
Expand All @@ -58,7 +59,7 @@ def hasImages(self, extensions=ALLOWED_IMAGE_FILES):
Parameters:
extensions: Array of allowed image extensions
Returns:
boolean: True if zip has images
"""
Expand All @@ -74,9 +75,9 @@ def extractAll(self, path=None, members=None):
Parameters:
path: Path to store files
members: Files to extract
Returns:
array: Array of extracted File objects
array: Array of extracted File objects
"""
self.zip.extractall(path, members)
extractedFiles = {}
Expand Down
4 changes: 1 addition & 3 deletions autofocus/predict/app/requests/PredictRequestValidator.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@


class PredictRequestValidator(Validator):
"""
Validate request for endpoint predict
"""
"""Validate request for endpoint predict"""

def validate(self):
"""
Expand Down
4 changes: 1 addition & 3 deletions autofocus/predict/app/requests/PredictZipRequestValidator.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@


class PredictZipRequestValidator(Validator):
"""
Validate request for endpoint predict_zip
"""
"""Validate request for endpoint predict_zip"""

def validate(self):
"""
Expand Down
7 changes: 3 additions & 4 deletions autofocus/predict/app/requests/Validator.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from abc import ABC, abstractmethod

from flask import abort, jsonify, make_response
from flask_api import status

Expand Down Expand Up @@ -48,11 +49,9 @@ def getError(self):
dict: The errors found during validation
"""
return self.error

def abort(self):
"""
Abort with errors
"""
"""Abort with errors"""
abort(make_response(
jsonify(
status=status.HTTP_400_BAD_REQUEST,
Expand Down

0 comments on commit d60aa76

Please sign in to comment.