Skip to content

Commit

Permalink
Merge pull request #1451 from fastai/cli-export
Browse files Browse the repository at this point in the history
Use Config.find
  • Loading branch information
jph00 authored Sep 20, 2024
2 parents 69d3164 + aed2886 commit 0bb7b5d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
6 changes: 2 additions & 4 deletions nbdev/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,10 +181,8 @@ def nbdev_create_config(

# %% ../nbs/api/01_config.ipynb
def _nbdev_config_file(cfg_name=_nbdev_cfg_name, path=None):
cfg_path = path = Path.cwd() if path is None else Path(path)
while cfg_path != cfg_path.parent and not (cfg_path/cfg_name).exists(): cfg_path = cfg_path.parent
if not (cfg_path/cfg_name).exists(): cfg_path = path
return cfg_path/cfg_name
cfg_path = Path.cwd() if path is None else Path(path)
return getattr(Config.find(cfg_name), 'config_file', cfg_path/cfg_name)

# %% ../nbs/api/01_config.ipynb
def _xdg_config_paths(cfg_name=_nbdev_cfg_name):
Expand Down
6 changes: 2 additions & 4 deletions nbs/api/01_config.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -402,10 +402,8 @@
"source": [
"#|export\n",
"def _nbdev_config_file(cfg_name=_nbdev_cfg_name, path=None):\n",
" cfg_path = path = Path.cwd() if path is None else Path(path)\n",
" while cfg_path != cfg_path.parent and not (cfg_path/cfg_name).exists(): cfg_path = cfg_path.parent\n",
" if not (cfg_path/cfg_name).exists(): cfg_path = path\n",
" return cfg_path/cfg_name"
" cfg_path = Path.cwd() if path is None else Path(path)\n",
" return getattr(Config.find(cfg_name), 'config_file', cfg_path/cfg_name)"
]
},
{
Expand Down

0 comments on commit 0bb7b5d

Please sign in to comment.