Skip to content

Commit

Permalink
Change toml file read to actually use toml instead of configparser
Browse files Browse the repository at this point in the history
  • Loading branch information
alexandrebarbaruiva authored and gotcha committed Mar 8, 2021
1 parent 144f241 commit 1f68be5
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions ipdb/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,12 +168,16 @@ def get_config():
parser.filepath = filepath
# Users are expected to put an [ipdb] section
# only if they use setup.cfg
if filepath.endswith('setup.cfg') or filepath.endswith('pyproject.toml'):
if filepath.endswith('setup.cfg'):
with open(filepath) as f:
parser.remove_section("ipdb")
read_func(f)
# To use on pyproject.toml, put [tool.ipdb] section
elif filepath.endswith('pyproject.toml'):
import toml
toml_file = toml.load(filepath)
parser["ipdb"] = toml_file["tool"].get("ipdb")
else:
parser.remove_section("tool.ipdb")
read_func(ConfigFile(filepath))
return parser

Expand Down

0 comments on commit 1f68be5

Please sign in to comment.