Skip to content

Commit

Permalink
some fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
TsumiNa committed Mar 14, 2021
1 parent 75c6921 commit 8af93eb
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
- v*

env:
MPLBACKEN: 'Agg'
MPLBACKEN: "Agg"

jobs:
test_ubuntu:
Expand All @@ -16,7 +16,7 @@ jobs:
max-parallel: 4
matrix:
python-version: [3.7]
os: ['ubuntu-18.04']
os: ["ubuntu-18.04"]

steps:
- uses: actions/checkout@v2
Expand Down
13 changes: 3 additions & 10 deletions tests/inverse/test_iqspr.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,17 @@
# license that can be found in the LICENSE file.

import types
from copy import deepcopy
from pathlib import Path

import numpy as np
import pandas as pd
import pytest
from copy import deepcopy
from sklearn.linear_model import BayesianRidge

from xenonpy.descriptor import ECFP, RDKitFP
from xenonpy.inverse.iqspr import GaussianLogLikelihood, NGram, IQSPR, IQSPR4DF, GetProbError, MolConvertError
from xenonpy.inverse.base import BaseLogLikelihoodSet
from xenonpy.inverse.iqspr import (IQSPR, IQSPR4DF, GaussianLogLikelihood, GetProbError, MolConvertError, NGram)


@pytest.fixture(scope='module')
Expand Down Expand Up @@ -51,14 +51,7 @@ def __init__(self):
ngram.fit(X[0:20], train_order=5)
iqspr = IQSPR(estimator=bre, modifier=ngram)
# prepare test data
yield dict(ecfp=ecfp,
rdkitfp=rdkitfp,
bre=bre,
bre2=bre2,
like_mdl=like_mdl,
ngram=ngram,
iqspr=iqspr,
pg=(X, y))
yield dict(ecfp=ecfp, rdkitfp=rdkitfp, bre=bre, bre2=bre2, like_mdl=like_mdl, ngram=ngram, iqspr=iqspr, pg=(X, y))

print('test over')

Expand Down
3 changes: 2 additions & 1 deletion tests/mdl/test_mdl.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.


from json import JSONDecodeError
from pathlib import Path
from shutil import rmtree
Expand Down Expand Up @@ -56,7 +55,9 @@ def test_pull_1(mdl):


def test_return_nothing(mdl, monkeypatch):

class Request_Dummy(object):

def __init__(self, **_):
self.status_code = 999

Expand Down
12 changes: 6 additions & 6 deletions xenonpy/mdl/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@
class BaseQuery(BaseEstimator, metaclass=TimedMetaClass):
queryable = None

def __init__(self, variables, *, api_key: str = 'anonymous.user.key',
endpoint: str = 'http://xenon.ism.ac.jp/api'):
def __init__(self, variables, *, api_key: str = 'anonymous.user.key', endpoint: str = 'http://xenon.ism.ac.jp/api'):
if self.queryable is None:
raise RuntimeError('Query class must give a queryable field in list of string')

Expand Down Expand Up @@ -75,8 +74,10 @@ def __call__(self, *querying_vars, file=None, return_json=None):
if file is None:
ret = requests.post(url=self._endpoint,
data=payload,
headers={"content-type": "application/json",
'api_key': self._api_key})
headers={
"content-type": "application/json",
'api_key': self._api_key
})
else:
file = Path(file).resolve()
file = make_archive(str(file), 'gztar', str(file))
Expand All @@ -99,8 +100,7 @@ def __call__(self, *querying_vars, file=None, return_json=None):
except json.JSONDecodeError:
message = "Server did not responce."

raise HTTPError('status_code: %s, %s' %
(ret.status_code, message))
raise HTTPError('status_code: %s, %s' % (ret.status_code, message))
ret = ret.json()
if 'errors' in ret:
raise ValueError(ret['errors'][0]['message'])
Expand Down

0 comments on commit 8af93eb

Please sign in to comment.