Skip to content

Commit

Permalink
fix style issues
Browse files Browse the repository at this point in the history
  • Loading branch information
jdkent committed Aug 23, 2023
1 parent fa4ee3d commit 48d78fb
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 12 deletions.
14 changes: 4 additions & 10 deletions store/neurostore/resources/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,6 @@
BaseStudy,
User,
Annotation,
Image,
Point,
Analysis,
)
from ..schemas.data import StudysetSnapshot
from . import data as viewdata
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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)

Expand Down
4 changes: 2 additions & 2 deletions store/neurostore/tests/api/test_base_studies.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")

Expand Down

0 comments on commit 48d78fb

Please sign in to comment.