From 6fa3ac426ebfcdf904134c2028d3e42b7103cf85 Mon Sep 17 00:00:00 2001 From: David Fokkema Date: Tue, 20 Sep 2022 16:16:00 +0200 Subject: [PATCH 1/4] Docstring fix --- src/tailor/app.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/tailor/app.py b/src/tailor/app.py index 893ead6..fc6e2e5 100644 --- a/src/tailor/app.py +++ b/src/tailor/app.py @@ -430,7 +430,8 @@ def selection_changed(self, selected, deselected): These values are used to update the column information in the user interface. - Args: selected: QItemSelection containing the newly selected events. + Args: + selected: QItemSelection containing the newly selected events. deselected: QItemSelection containing previously selected, and now deselected, items. """ From b284f31246a9801ad06aa4816f631985802f45c1 Mon Sep 17 00:00:00 2001 From: David Fokkema Date: Tue, 20 Sep 2022 16:23:44 +0200 Subject: [PATCH 2/4] Ignore dev logs --- .gitignore | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.gitignore b/.gitignore index 059e749..85909e3 100644 --- a/.gitignore +++ b/.gitignore @@ -67,3 +67,6 @@ windows/ android/ linux/ django/ + +# Briefcase dev logs +*.dev.log From 6e7d0cf89dee8b930e4a850134e07df2b2dbae53 Mon Sep 17 00:00:00 2001 From: David Fokkema Date: Tue, 20 Sep 2022 16:41:43 +0200 Subject: [PATCH 3/4] Upgrade PySide6, use only essentials --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 72ba5ac..bfbd744 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -21,7 +21,7 @@ requires = [ 'lmfit>=1.0.3,<2.0.0', 'scipy>=1.8.0,<2.0.0', 'asteval>=0.9.26,<1.0.0', - 'PySide6>=6.2.4,<6.3.0', + 'PySide6_essentials>=6.3.2,<6.4.0', 'pyqtgraph>=0.12.3,<0.13.0', 'matplotlib>=3.5.1,<4.0.0', ] From ece266a1b4823b5fc73598e76f12e52b239b041a Mon Sep 17 00:00:00 2001 From: David Fokkema Date: Tue, 20 Sep 2022 17:28:44 +0200 Subject: [PATCH 4/4] Use tomli instead of toml Fixes a nasty encoding bug, see https://github.com/uiri/toml/issues/404. --- pruner.py | 10 ++++------ pyproject.toml | 3 ++- src/tailor/config.py | 12 ++++++------ 3 files changed, 12 insertions(+), 13 deletions(-) diff --git a/pruner.py b/pruner.py index e3ee2f3..36580ed 100644 --- a/pruner.py +++ b/pruner.py @@ -4,7 +4,7 @@ from glob import glob from pathlib import Path -import toml +import tomli def prune(base_dir, exclude, include): @@ -33,12 +33,10 @@ def prune(base_dir, exclude, include): def main(): - with open("pyproject.toml") as f: - config = toml.load(f) + with open("pyproject.toml", "rb") as f: + config = tomli.load(f) pruner_config = config["tool"]["pruner"][sys.platform] - prune( - pruner_config["base_dir"], pruner_config["exclude"], pruner_config["include"] - ) + prune(pruner_config["base_dir"], pruner_config["exclude"], pruner_config["include"]) if __name__ == "__main__": diff --git a/pyproject.toml b/pyproject.toml index bfbd744..7848cee 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -15,7 +15,8 @@ sources = ['src/tailor'] requires = [ 'std-nslog', 'appdirs>=1.4.4,<2.0.0', - 'toml>=0.10.2,<1.0.0', + 'tomli>=2.0.1,<3.0.0', + 'tomli_w>=1.0.0,<2.0.0', 'numpy>=1.22.1,<2.0.0', 'pandas>=1.4.0,<2.0.0', 'lmfit>=1.0.3,<2.0.0', diff --git a/src/tailor/config.py b/src/tailor/config.py index 3133a4a..a16dc9d 100644 --- a/src/tailor/config.py +++ b/src/tailor/config.py @@ -1,10 +1,10 @@ +import pathlib import sys from importlib import metadata as importlib_metadata import appdirs -import toml -import pathlib - +import tomli +import tomli_w app_module = sys.modules["__main__"].__package__ metadata = importlib_metadata.metadata(app_module) @@ -18,8 +18,8 @@ def read_config(): """Read configuration file.""" config_path = get_config_path() if config_path.is_file(): - with open(config_path) as f: - return toml.load(f) + with open(config_path, "rb") as f: + return tomli.load(f) else: return {} @@ -32,7 +32,7 @@ def write_config(config): """ create_config_dir() config_path = get_config_path() - toml_config = toml.dumps(config) + toml_config = tomli_w.dumps(config) with open(config_path, "w") as f: # separate TOML generation from writing to file, or an exception # generating TOML will result in an empty file