From 3c36ab08c87f7d7fb2c564037b7ddd35a3139c2d Mon Sep 17 00:00:00 2001 From: Fabian Joswig Date: Sun, 9 Mar 2025 12:37:42 +0100 Subject: [PATCH 1/5] [Version] Bump version to 2.15.0-dev --- pyerrors/version.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyerrors/version.py b/pyerrors/version.py index d0979fd0..806254b1 100644 --- a/pyerrors/version.py +++ b/pyerrors/version.py @@ -1 +1 @@ -__version__ = "2.14.0" +__version__ = "2.15.0-dev" From 934a61e124aa73fca8f281a6f9b55df9c2b5ea58 Mon Sep 17 00:00:00 2001 From: s-kuberski Date: Tue, 22 Apr 2025 10:19:14 +0200 Subject: [PATCH 2/5] [Fix] removed unnecessary lines that raised the flake8 error code F824 (#262) Co-authored-by: Simon Kuberski --- pyerrors/input/json.py | 5 ----- 1 file changed, 5 deletions(-) diff --git a/pyerrors/input/json.py b/pyerrors/input/json.py index a0d3304a..a2008f9c 100644 --- a/pyerrors/input/json.py +++ b/pyerrors/input/json.py @@ -571,7 +571,6 @@ def _ol_from_dict(ind, reps='DICTOBS'): counter = 0 def dict_replace_obs(d): - nonlocal ol nonlocal counter x = {} for k, v in d.items(): @@ -592,7 +591,6 @@ def _ol_from_dict(ind, reps='DICTOBS'): return x def list_replace_obs(li): - nonlocal ol nonlocal counter x = [] for e in li: @@ -613,7 +611,6 @@ def _ol_from_dict(ind, reps='DICTOBS'): return x def obslist_replace_obs(li): - nonlocal ol nonlocal counter il = [] for e in li: @@ -694,7 +691,6 @@ def _od_from_list_and_dict(ol, ind, reps='DICTOBS'): def dict_replace_string(d): nonlocal counter - nonlocal ol x = {} for k, v in d.items(): if isinstance(v, dict): @@ -710,7 +706,6 @@ def _od_from_list_and_dict(ol, ind, reps='DICTOBS'): def list_replace_string(li): nonlocal counter - nonlocal ol x = [] for e in li: if isinstance(e, list): From dcb95265ac5c1c0dfd56d70e293290effd4d0399 Mon Sep 17 00:00:00 2001 From: JanNeuendorf <75676159+JanNeuendorf@users.noreply.github.com> Date: Tue, 22 Apr 2025 10:26:20 +0200 Subject: [PATCH 3/5] Fixed index in GEVP example (#261) Co-authored-by: Fabian Joswig --- examples/06_gevp.ipynb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/06_gevp.ipynb b/examples/06_gevp.ipynb index 3e6c12d5..3de14d5e 100644 --- a/examples/06_gevp.ipynb +++ b/examples/06_gevp.ipynb @@ -151,7 +151,7 @@ "\n", "$$C_{\\textrm{projected}}(t)=v_1^T \\underline{C}(t) v_2$$\n", "\n", - "If we choose the vectors to be $v_1=v_2=(0,1,0,0)$, we should get the same correlator as in the cell above. \n", + "If we choose the vectors to be $v_1=v_2=(1,0,0,0)$, we should get the same correlator as in the cell above. \n", "\n", "Thinking about it this way is usefull in the Context of the generalized eigenvalue problem (GEVP), used to find the source-sink combination, which best describes a certain energy eigenstate.\n", "A good introduction is found in https://arxiv.org/abs/0902.1265." From 8183ee2ef4428307ffbc0279b3bc50b61b9a5e8d Mon Sep 17 00:00:00 2001 From: Alexander Puck Neuwirth Date: Mon, 5 May 2025 10:52:22 +0200 Subject: [PATCH 4/5] setup.py: Drop deprecated license classifiers (#264) Closes: #263 --- setup.py | 1 - 1 file changed, 1 deletion(-) diff --git a/setup.py b/setup.py index 76efe7e2..8c42f4a6 100644 --- a/setup.py +++ b/setup.py @@ -30,7 +30,6 @@ setup(name='pyerrors', classifiers=[ 'Development Status :: 5 - Production/Stable', 'Intended Audience :: Science/Research', - 'License :: OSI Approved :: MIT License', 'Programming Language :: Python :: 3', 'Programming Language :: Python :: 3.9', 'Programming Language :: Python :: 3.10', From d6e6a435a8203cb314af90bf397b8d5adfe53038 Mon Sep 17 00:00:00 2001 From: Fabian Joswig Date: Mon, 5 May 2025 17:09:40 +0200 Subject: [PATCH 5/5] [ci] Re-enable fail on warning for pytest pipeline. (#265) * [ci] Re-enable fail on warning for pytest pipeline. * [Fix] Use sqlite3 context managers in pandas module. * [Fix] Add closing context. --- .github/workflows/pytest.yml | 2 +- pyerrors/input/pandas.py | 11 +++++------ 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/.github/workflows/pytest.yml b/.github/workflows/pytest.yml index a4c27116..af98e210 100644 --- a/.github/workflows/pytest.yml +++ b/.github/workflows/pytest.yml @@ -43,4 +43,4 @@ jobs: uv pip freeze --system - name: Run tests - run: pytest --cov=pyerrors -vv + run: pytest --cov=pyerrors -vv -Werror diff --git a/pyerrors/input/pandas.py b/pyerrors/input/pandas.py index 13482983..af446cfc 100644 --- a/pyerrors/input/pandas.py +++ b/pyerrors/input/pandas.py @@ -1,6 +1,7 @@ import warnings import gzip import sqlite3 +from contextlib import closing import pandas as pd from ..obs import Obs from ..correlators import Corr @@ -29,9 +30,8 @@ def to_sql(df, table_name, db, if_exists='fail', gz=True, **kwargs): None """ se_df = _serialize_df(df, gz=gz) - con = sqlite3.connect(db) - se_df.to_sql(table_name, con, if_exists=if_exists, index=False, **kwargs) - con.close() + with closing(sqlite3.connect(db)) as con: + se_df.to_sql(table_name, con=con, if_exists=if_exists, index=False, **kwargs) def read_sql(sql, db, auto_gamma=False, **kwargs): @@ -52,9 +52,8 @@ def read_sql(sql, db, auto_gamma=False, **kwargs): data : pandas.DataFrame Dataframe with the content of the sqlite database. """ - con = sqlite3.connect(db) - extract_df = pd.read_sql(sql, con, **kwargs) - con.close() + with closing(sqlite3.connect(db)) as con: + extract_df = pd.read_sql(sql, con=con, **kwargs) return _deserialize_df(extract_df, auto_gamma=auto_gamma)