Skip to content

Commit

Permalink
clean
Browse files Browse the repository at this point in the history
  • Loading branch information
jph00 committed Oct 19, 2023
1 parent 85de500 commit aac4dd3
Show file tree
Hide file tree
Showing 11 changed files with 14 additions and 27 deletions.
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
Getting Started
================
# Getting Started

<!-- WARNING: THIS FILE WAS AUTOGENERATED! DO NOT EDIT! -->

Expand Down
6 changes: 3 additions & 3 deletions nbdev/doclinks.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def patch_name(o):
def _iter_py_cells(p):
"Yield cells from an exported Python file."
p = Path(p)
cells = p.read_text().split("\n# %% ")
cells = p.read_text(encoding='utf-8').split("\n# %% ")
for cell in cells[1:]:
top,code = cell.split('\n', 1)
try:
Expand Down Expand Up @@ -93,7 +93,7 @@ def _build_modidx(dest=None, nbs_path=None, skip_exists=False):
idxfile = dest/'_modidx.py'
if skip_exists and idxfile.exists(): return
with contextlib.suppress(FileNotFoundError): idxfile.unlink()
if idxfile.exists(): res = exec_local(idxfile.read_text(), 'd')
if idxfile.exists(): res = exec_local(idxfile.read_text(encoding='utf-8'), 'd')
else: res = dict(syms={}, settings={})
res['settings'] = {k:v for k,v in get_config().d.items()
if k in ('doc_host','doc_baseurl','lib_path','git_url','branch')}
Expand Down Expand Up @@ -159,7 +159,7 @@ def _find_mod(mod):
def _get_exps(mod):
mf = _find_mod(mod)
if not mf: return {}
txt = mf.read_text()
txt = mf.read_text(encoding='utf-8')
_def_types = ast.FunctionDef,ast.AsyncFunctionDef,ast.ClassDef
d = {}
for tree in ast.parse(txt).body:
Expand Down
2 changes: 1 addition & 1 deletion nbdev/maker.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def update_var(varname, func, fn=None, code=None):
"Update the definition of `varname` in file `fn`, by calling `func` with the current definition"
if fn:
fn = Path(fn)
code = fn.read_text()
code = fn.read_text(encoding='utf-8')
lines = code.splitlines()
v = read_var(code, varname)
res = func(v)
Expand Down
4 changes: 2 additions & 2 deletions nbdev/merge.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def nbdev_fix(nbname:str, # Notebook filename to fix
"Create working notebook from conflicted notebook `nbname`"
nbname = Path(nbname)
if not nobackup and not outname: shutil.copy(nbname, nbname.with_suffix('.ipynb.bak'))
nbtxt = nbname.read_text()
nbtxt = nbname.read_text(encoding='utf-8')
a,b,branch1,branch2 = unpatch(nbtxt)
ac,bc = dict2nb(loads(a)),dict2nb(loads(b))
dest = bc if theirs else ac
Expand All @@ -85,7 +85,7 @@ def _git_rebase_head():
for d in ('apply','merge'):
d = Path(f'.git/rebase-{d}')
if d.is_dir():
cmt = (d/'orig-head').read_text()
cmt = (d/'orig-head').read_text(encoding='utf-8')
msg = run(f'git show-branch --no-name {cmt}')
return f'{cmt[:7]} ({msg})'

Expand Down
4 changes: 2 additions & 2 deletions nbdev/serve.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ def _is_qpy(path:Path):
"Is `path` a py script starting with frontmatter?"
path = Path(path)
if not path.suffix=='.py': return
p = ast.parse(path.read_text())
# try: p = ast.parse(path.read_text())
p = ast.parse(path.read_text(encoding='utf-8'))
# try: p = ast.parse(path.read_text(encoding='utf-8'))
# except: return
if not p.body: return
a = p.body[0]
Expand Down
2 changes: 1 addition & 1 deletion nbs/api/02_maker.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -799,7 +799,7 @@
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"display_name": "python3",
"language": "python",
"name": "python3"
}
Expand Down
2 changes: 1 addition & 1 deletion nbs/api/05_doclinks.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -823,7 +823,7 @@
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"display_name": "python3",
"language": "python",
"name": "python3"
}
Expand Down
2 changes: 1 addition & 1 deletion nbs/api/07_merge.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -635,7 +635,7 @@
"split_at_heading": true
},
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"display_name": "python3",
"language": "python",
"name": "python3"
}
Expand Down
2 changes: 1 addition & 1 deletion nbs/api/08_showdoc.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -1345,7 +1345,7 @@
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"display_name": "python3",
"language": "python",
"name": "python3"
}
Expand Down
2 changes: 1 addition & 1 deletion nbs/api/17_serve.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"display_name": "python3",
"language": "python",
"name": "python3"
}
Expand Down
12 changes: 0 additions & 12 deletions nbs/tutorials/best_practices.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -1470,18 +1470,6 @@
"display_name": "aa",
"language": "python",
"name": "aa"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.6"
}
},
"nbformat": 4,
Expand Down

0 comments on commit aac4dd3

Please sign in to comment.