Skip to content

Commit

Permalink
🐛 None is not dumped as null without cp dict
Browse files Browse the repository at this point in the history
- config dict has to be copied. Otherwise value
  None is not dumped as null:
  Before:
  - column_names: "None"
  Now:
  - column_names: null
  • Loading branch information
Henry Webel committed Nov 11, 2023
1 parent 7a55767 commit 8bd3211
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions project/workflow/Snakefile_v2
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,10 @@ rule dump_split_config:
configfile=config["config_split"],
run:
import yaml

# recreating dict, otherwise Null becomes string "Null" in yaml dump...
cfg = dict()
for k, v in config["split_data"].items():
cfg[k] = v
with open(output.configfile, "w") as f:
f.write("# Build in Snakemake workflow\n")
yaml.dump(config["split_data"], f, sort_keys=False)
f.write("# Build in Snakemake workflow (from v2)\n")
yaml.dump(cfg, f, sort_keys=False)

0 comments on commit 8bd3211

Please sign in to comment.