Skip to content

Commit

Permalink
fix: flake8 issues
Browse files Browse the repository at this point in the history
  • Loading branch information
alarv committed Aug 1, 2024
1 parent 096dbbb commit 2fe7ba3
Show file tree
Hide file tree
Showing 16 changed files with 10 additions and 191 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/python-app.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
flake8 . --count --max-complexity=10 --max-line-length=127 --statistics
# - name: Test with pytest
# run: |
# pytest
19 changes: 0 additions & 19 deletions src/entities/algorithm.py

This file was deleted.

8 changes: 0 additions & 8 deletions src/entities/dataentry.py

This file was deleted.

22 changes: 0 additions & 22 deletions src/entities/dataset.py

This file was deleted.

9 changes: 0 additions & 9 deletions src/entities/entryid.py

This file was deleted.

19 changes: 0 additions & 19 deletions src/entities/error_report.py

This file was deleted.

18 changes: 0 additions & 18 deletions src/entities/feature.py

This file was deleted.

12 changes: 0 additions & 12 deletions src/entities/featureinfo.py

This file was deleted.

5 changes: 0 additions & 5 deletions src/entities/jaqpot_base.py

This file was deleted.

21 changes: 0 additions & 21 deletions src/entities/meta.py

This file was deleted.

17 changes: 0 additions & 17 deletions src/entities/model.py

This file was deleted.

12 changes: 0 additions & 12 deletions src/entities/parameter.py

This file was deleted.

22 changes: 0 additions & 22 deletions src/entities/task.py

This file was deleted.

3 changes: 2 additions & 1 deletion src/handlers/predict.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from ..entities.prediction_request import PredictionRequestPydantic
from ..helpers import model_decoder, json_to_predreq


def model_post_handler(request: PredictionRequestPydantic):
model = model_decoder.decode(request.model['rawModel'])
data_entry_all = json_to_predreq.decode(request, model)
Expand All @@ -24,4 +25,4 @@ def model_post_handler(request: PredictionRequestPydantic):

final_all = {"predictions": [dict(zip(results, t)) for t in zip(*results.values())]}

return final_all
return final_all
7 changes: 4 additions & 3 deletions src/helpers/json_to_predreq.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
from jaqpotpy.datasets import JaqpotpyDataset
import pandas as pd


def decode(request, model):
df = pd.DataFrame(request.dataset['input'])
independentFeatures = request.model['independentFeatures']
smiles_cols = [feature['key'] for feature in independentFeatures if feature['featureType'] == 'SMILES']
x_cols = [feature['key'] for feature in independentFeatures if feature['featureType'] != 'SMILES']
independent_features = request.model['independentFeatures']
smiles_cols = [feature['key'] for feature in independent_features if feature['featureType'] == 'SMILES']
x_cols = [feature['key'] for feature in independent_features if feature['featureType'] != 'SMILES']
dataset = JaqpotpyDataset(df=df, smiles_cols=smiles_cols, x_cols=x_cols,
task=model.task, featurizer=model.featurizer)
return dataset
5 changes: 3 additions & 2 deletions src/helpers/model_decoder.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@
import pickle
import compress_pickle

def decode(rawModel):
model = b64decode(rawModel)

def decode(raw_model):
model = b64decode(raw_model)
try:
p_mod = compress_pickle.loads(model, compression='bz2')
except Exception as e:
Expand Down

0 comments on commit 2fe7ba3

Please sign in to comment.