Skip to content

Commit

Permalink
Convert to tomlib
Browse files Browse the repository at this point in the history
  - delete leading and trailing blank lines
  • Loading branch information
brocla committed Mar 13, 2024
1 parent 9013cec commit 2ab9e9d
Show file tree
Hide file tree
Showing 3 changed files with 1,117 additions and 1,119 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

"""
This exmple comes from ChatGPT
Prompt: Write a python function that
Expand All @@ -9,12 +8,12 @@
two sources of settings, the data from
the toml file should be used.
"""
import toml
import tomlib

def merge_settings(default_settings, toml_file_path):
# Load settings from TOML file
with open(toml_file_path, 'r') as f:
toml_settings = toml.load(f)
toml_settings = tomlib.load(f)

# Merge default settings with settings from TOML file
merged_settings = default_settings | toml_settings
Expand Down Expand Up @@ -93,4 +92,3 @@ def assign(letters, selections, lefty, righty):
selections = new_selections
letters = letters[1:]
return [slc for slc, _ in selections]

Loading

0 comments on commit 2ab9e9d

Please sign in to comment.