Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix toml decoding error #56

Merged
merged 4 commits into from
Sep 20, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -67,3 +67,6 @@ windows/
android/
linux/
django/

# Briefcase dev logs
*.dev.log
10 changes: 4 additions & 6 deletions pruner.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from glob import glob
from pathlib import Path

import toml
import tomli


def prune(base_dir, exclude, include):
Expand Down Expand Up @@ -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__":
Expand Down
5 changes: 3 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,14 @@ 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',
'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',
]
Expand Down
3 changes: 2 additions & 1 deletion src/tailor/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
"""
Expand Down
12 changes: 6 additions & 6 deletions src/tailor/config.py
Original file line number Diff line number Diff line change
@@ -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)
Expand All @@ -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 {}

Expand All @@ -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
Expand Down