|
|
b0636c3 |
From 82484016be1462d45478186fd15330ad54307b07 Mon Sep 17 00:00:00 2001
|
|
|
b0636c3 |
From: Chris Markiewicz <effigies@gmail.com>
|
|
|
b0636c3 |
Date: Mon, 24 Apr 2023 09:29:11 -0400
|
|
|
b0636c3 |
Subject: [PATCH 1/3] FIX: Import declarative_base from correct location
|
|
|
b0636c3 |
|
|
|
b0636c3 |
---
|
|
|
b0636c3 |
bids/layout/models.py | 8 ++++++--
|
|
|
b0636c3 |
setup.cfg | 2 +-
|
|
|
b0636c3 |
2 files changed, 7 insertions(+), 3 deletions(-)
|
|
|
b0636c3 |
|
|
|
b0636c3 |
diff --git a/bids/layout/models.py b/bids/layout/models.py
|
|
|
b0636c3 |
index be1534bb..fff3d1ff 100644
|
|
|
b0636c3 |
--- a/bids/layout/models.py
|
|
|
b0636c3 |
+++ b/bids/layout/models.py
|
|
|
b0636c3 |
@@ -9,12 +9,16 @@ from copy import deepcopy
|
|
|
b0636c3 |
from itertools import chain
|
|
|
b0636c3 |
from functools import lru_cache
|
|
|
b0636c3 |
|
|
|
b0636c3 |
-from sqlalchemy.ext.declarative import declarative_base
|
|
|
b0636c3 |
from sqlalchemy.ext.associationproxy import association_proxy
|
|
|
b0636c3 |
from sqlalchemy.orm.collections import attribute_mapped_collection
|
|
|
b0636c3 |
-from sqlalchemy import (Column, String, Boolean, ForeignKey, Table)
|
|
|
b0636c3 |
+from sqlalchemy import Column, String, Boolean, ForeignKey, Table
|
|
|
b0636c3 |
from sqlalchemy.orm import reconstructor, relationship, backref, object_session
|
|
|
b0636c3 |
|
|
|
b0636c3 |
+try:
|
|
|
b0636c3 |
+ from sqlalchemy.orm import declarative_base
|
|
|
b0636c3 |
+except ImportError: # sqlalchemy < 1.4
|
|
|
b0636c3 |
+ from sqlalchemy.ext.declarative import declarative_base
|
|
|
b0636c3 |
+
|
|
|
b0636c3 |
from ..utils import listify
|
|
|
b0636c3 |
from .writing import build_path, write_to_file
|
|
|
b0636c3 |
from ..config import get_option
|
|
|
b0636c3 |
diff --git a/setup.cfg b/setup.cfg
|
|
|
b0636c3 |
index 5a901aa6..8d23fa8c 100644
|
|
|
b0636c3 |
--- a/setup.cfg
|
|
|
b0636c3 |
+++ b/setup.cfg
|
|
|
b0636c3 |
@@ -27,7 +27,7 @@ install_requires =
|
|
|
b0636c3 |
nibabel >=2.1
|
|
|
b0636c3 |
pandas >=0.23
|
|
|
b0636c3 |
formulaic >=0.2.4, <0.4 # Tested on 0.2.4 and 0.3.2
|
|
|
b0636c3 |
- sqlalchemy <1.4.0.dev0
|
|
|
b0636c3 |
+ sqlalchemy
|
|
|
b0636c3 |
bids-validator
|
|
|
b0636c3 |
num2words
|
|
|
b0636c3 |
click >=8.0
|
|
|
b0636c3 |
--
|
|
|
b0636c3 |
2.39.2
|
|
|
b0636c3 |
|
|
|
b0636c3 |
|
|
|
b0636c3 |
From d167ba66c01352fedc59fc50d04967c0cd13d8cd Mon Sep 17 00:00:00 2001
|
|
|
b0636c3 |
From: Chris Markiewicz <effigies@gmail.com>
|
|
|
b0636c3 |
Date: Mon, 24 Apr 2023 09:44:12 -0400
|
|
|
b0636c3 |
Subject: [PATCH 2/3] FIX: Accept more precise proxied error for duplicate
|
|
|
b0636c3 |
config
|
|
|
b0636c3 |
|
|
|
b0636c3 |
---
|
|
|
b0636c3 |
bids/layout/tests/test_models.py | 3 ++-
|
|
|
b0636c3 |
1 file changed, 2 insertions(+), 1 deletion(-)
|
|
|
b0636c3 |
|
|
|
b0636c3 |
diff --git a/bids/layout/tests/test_models.py b/bids/layout/tests/test_models.py
|
|
|
b0636c3 |
index 2f7862fa..0e1e5b59 100644
|
|
|
b0636c3 |
--- a/bids/layout/tests/test_models.py
|
|
|
b0636c3 |
+++ b/bids/layout/tests/test_models.py
|
|
|
b0636c3 |
@@ -179,7 +179,8 @@ def test_load_existing_config():
|
|
|
b0636c3 |
session.commit()
|
|
|
b0636c3 |
|
|
|
b0636c3 |
from sqlalchemy.orm.exc import FlushError
|
|
|
b0636c3 |
- with pytest.raises(FlushError):
|
|
|
b0636c3 |
+ from sqlalchemy.exc import DBAPIError
|
|
|
b0636c3 |
+ with pytest.raises((FlushError, DBAPIError)):
|
|
|
b0636c3 |
second = Config.load({"name": "dummy"})
|
|
|
b0636c3 |
session.add(second)
|
|
|
b0636c3 |
session.commit()
|
|
|
b0636c3 |
--
|
|
|
b0636c3 |
2.39.2
|
|
|
b0636c3 |
|
|
|
b0636c3 |
|
|
|
b0636c3 |
From 4c91c328cf500a2acc0a3908411f210bf20e57d4 Mon Sep 17 00:00:00 2001
|
|
|
b0636c3 |
From: Chris Markiewicz <effigies@gmail.com>
|
|
|
b0636c3 |
Date: Mon, 24 Apr 2023 09:44:27 -0400
|
|
|
b0636c3 |
Subject: [PATCH 3/3] TEST: Yield from fixture to avoid session going out of
|
|
|
b0636c3 |
scope
|
|
|
b0636c3 |
|
|
|
b0636c3 |
---
|
|
|
b0636c3 |
bids/layout/tests/test_writing.py | 2 +-
|
|
|
b0636c3 |
1 file changed, 1 insertion(+), 1 deletion(-)
|
|
|
b0636c3 |
|
|
|
b0636c3 |
diff --git a/bids/layout/tests/test_writing.py b/bids/layout/tests/test_writing.py
|
|
|
b0636c3 |
index dde6b3a1..ad74785a 100644
|
|
|
b0636c3 |
--- a/bids/layout/tests/test_writing.py
|
|
|
b0636c3 |
+++ b/bids/layout/tests/test_writing.py
|
|
|
b0636c3 |
@@ -37,7 +37,7 @@ def writable_file(tmpdir):
|
|
|
b0636c3 |
|
|
|
b0636c3 |
session.add_all(list(ents.values()) + tags + [bf])
|
|
|
b0636c3 |
session.commit()
|
|
|
b0636c3 |
- return bf
|
|
|
b0636c3 |
+ yield bf
|
|
|
b0636c3 |
|
|
|
b0636c3 |
|
|
|
b0636c3 |
@pytest.fixture(scope='module')
|
|
|
b0636c3 |
--
|
|
|
b0636c3 |
2.39.2
|
|
|
b0636c3 |
|