diff --git a/store/neurostore/resources/base.py b/store/neurostore/resources/base.py index 10746da3e..0962c8325 100644 --- a/store/neurostore/resources/base.py +++ b/store/neurostore/resources/base.py @@ -27,9 +27,6 @@ BaseStudy, User, Annotation, - Image, - Point, - Analysis, ) from ..schemas.data import StudysetSnapshot from . import data as viewdata @@ -294,15 +291,14 @@ class ObjectView(BaseView): def get(self, id): args = parser.parse(self._view_fields, request, location="query") if args.get("nested") is None: - args['nested'] = request.args.get("nested", False) == "true" - + args["nested"] = request.args.get("nested", False) == "true" q = self._model.query - if args['nested'] or self._model is Annotation: + if args["nested"] or self._model is Annotation: q = q.options(nested_load(self)) record = q.filter_by(id=id).first_or_404() - if self._model is Studyset and args['nested']: + if self._model is Studyset and args["nested"]: snapshot = StudysetSnapshot() return snapshot.dump(record) else: @@ -473,9 +469,7 @@ def post(self): data = self._load_from_source(source, source_id) else: data = parser.parse(self.__class__._schema, request) - args["nested"] = bool( - args.get("nested") or request.args.get("source_id") - ) + args["nested"] = bool(args.get("nested") or request.args.get("source_id")) with db.session.no_autoflush: record = self.__class__.update_or_create(data) diff --git a/store/neurostore/tests/api/test_base_studies.py b/store/neurostore/tests/api/test_base_studies.py index eb1c24c8e..b88d3e378 100644 --- a/store/neurostore/tests/api/test_base_studies.py +++ b/store/neurostore/tests/api/test_base_studies.py @@ -20,10 +20,10 @@ def test_info_base_study(auth_client, ingest_neurosynth, session): assert reg_resp.status_code == 200 assert "updated_at" in info_resp.json["results"][0]["versions"][0] - assert isinstance(reg_resp.json['results'][0]["versions"][0], str) + assert isinstance(reg_resp.json["results"][0]["versions"][0], str) # test specific base-study - base_study_id = reg_resp.json['results'][0]['id'] + base_study_id = reg_resp.json["results"][0]["id"] single_info_resp = auth_client.get(f"/api/base-studies/{base_study_id}?info=true") single_reg_resp = auth_client.get(f"/api/base-studies/{base_study_id}?info=false")