Skip to content

Commit c5f06ac

Browse files
committed
formatting
1 parent 4d02c79 commit c5f06ac

File tree

2 files changed

+8
-28
lines changed

2 files changed

+8
-28
lines changed

nbdev/cli.py

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -85,30 +85,24 @@ def nbdev_new(**kwargs):
8585
nbdev_create_config.__wrapped__(**kwargs)
8686
cfg = get_config()
8787
_update_repo_meta(cfg)
88-
8988
path = Path()
9089

91-
_ORG_OR_USR = 'fastai'
92-
_REPOSITORY = 'nbdev-template'
90+
_ORG_OR_USR,_REPOSITORY = 'fastai','nbdev-template'
9391
_TEMPLATE = f'{_ORG_OR_USR}/{_REPOSITORY}'
9492
template = kwargs.get('template', _TEMPLATE)
95-
try:
96-
org_or_usr, repo = template.split('/')
97-
except ValueError:
98-
org_or_usr, repo = _ORG_OR_USR, _REPOSITORY
99-
93+
try: org_or_usr, repo = template.split('/')
94+
except ValueError: org_or_usr, repo = _ORG_OR_USR, _REPOSITORY
10095

10196
tag = kwargs.get('tag', None)
10297
if tag is None:
10398
with warnings.catch_warnings():
10499
warnings.simplefilter('ignore', UserWarning)
105-
106100
tag = GhApi(gh_host='https://api.github.com', authenticate=False).repos.get_latest_release(org_or_usr, repo).tag_name
107101

108102
url = f"https://github.com/{org_or_usr}/{repo}/archive/{tag}.tar.gz"
109103
extract_tgz(url)
110104
tmpl_path = path/f'{repo}-{tag}'
111-
105+
112106
cfg.nbs_path.mkdir(exist_ok=True)
113107
nbexists = bool(first(cfg.nbs_path.glob('*.ipynb')))
114108
_nbs_path_sufs = ('.ipynb','.css')
@@ -121,7 +115,6 @@ def nbdev_new(**kwargs):
121115
rmtree(tmpl_path)
122116

123117
refresh_quarto_yml()
124-
125118
nbdev_export.__wrapped__()
126119
nbdev_readme.__wrapped__()
127120

nbs/api/13_cli.ipynb

Lines changed: 4 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
{
22
"cells": [
33
{
4-
"attachments": {},
54
"cell_type": "markdown",
65
"id": "ff4908a6",
76
"metadata": {},
@@ -67,7 +66,6 @@
6766
]
6867
},
6968
{
70-
"attachments": {},
7169
"cell_type": "markdown",
7270
"id": "e9fc60a8",
7371
"metadata": {},
@@ -119,7 +117,6 @@
119117
]
120118
},
121119
{
122-
"attachments": {},
123120
"cell_type": "markdown",
124121
"id": "3e7e76f7-7b19-4347-a52b-c33ad15d2178",
125122
"metadata": {},
@@ -191,30 +188,24 @@
191188
" nbdev_create_config.__wrapped__(**kwargs)\n",
192189
" cfg = get_config()\n",
193190
" _update_repo_meta(cfg)\n",
194-
"\n",
195191
" path = Path()\n",
196192
"\n",
197-
" _ORG_OR_USR = 'fastai'\n",
198-
" _REPOSITORY = 'nbdev-template'\n",
193+
" _ORG_OR_USR,_REPOSITORY = 'fastai','nbdev-template'\n",
199194
" _TEMPLATE = f'{_ORG_OR_USR}/{_REPOSITORY}'\n",
200195
" template = kwargs.get('template', _TEMPLATE)\n",
201-
" try:\n",
202-
" org_or_usr, repo = template.split('/')\n",
203-
" except ValueError:\n",
204-
" org_or_usr, repo = _ORG_OR_USR, _REPOSITORY\n",
205-
"\n",
196+
" try: org_or_usr, repo = template.split('/')\n",
197+
" except ValueError: org_or_usr, repo = _ORG_OR_USR, _REPOSITORY\n",
206198
"\n",
207199
" tag = kwargs.get('tag', None)\n",
208200
" if tag is None:\n",
209201
" with warnings.catch_warnings():\n",
210202
" warnings.simplefilter('ignore', UserWarning)\n",
211-
"\n",
212203
" tag = GhApi(gh_host='https://api.github.com', authenticate=False).repos.get_latest_release(org_or_usr, repo).tag_name\n",
213204
"\n",
214205
" url = f\"https://github.com/{org_or_usr}/{repo}/archive/{tag}.tar.gz\"\n",
215206
" extract_tgz(url)\n",
216207
" tmpl_path = path/f'{repo}-{tag}'\n",
217-
" \n",
208+
"\n",
218209
" cfg.nbs_path.mkdir(exist_ok=True)\n",
219210
" nbexists = bool(first(cfg.nbs_path.glob('*.ipynb')))\n",
220211
" _nbs_path_sufs = ('.ipynb','.css')\n",
@@ -227,13 +218,11 @@
227218
" rmtree(tmpl_path)\n",
228219
"\n",
229220
" refresh_quarto_yml()\n",
230-
"\n",
231221
" nbdev_export.__wrapped__()\n",
232222
" nbdev_readme.__wrapped__()"
233223
]
234224
},
235225
{
236-
"attachments": {},
237226
"cell_type": "markdown",
238227
"id": "2239c092",
239228
"metadata": {},
@@ -311,7 +300,6 @@
311300
]
312301
},
313302
{
314-
"attachments": {},
315303
"cell_type": "markdown",
316304
"id": "280e0d6d-6559-4fc3-9478-320ce5eff0dc",
317305
"metadata": {},
@@ -381,7 +369,6 @@
381369
]
382370
},
383371
{
384-
"attachments": {},
385372
"cell_type": "markdown",
386373
"id": "aa35b010",
387374
"metadata": {},

0 commit comments

Comments
 (0)