Skip to content

Commit 9a0fad3

Browse files
committed
fixes #576
1 parent f448138 commit 9a0fad3

File tree

6 files changed

+188
-46
lines changed

6 files changed

+188
-46
lines changed

fastcore/_modidx.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -436,6 +436,7 @@
436436
'fastcore.py2pyi.has_deco': ('py2pyi.html#has_deco', 'fastcore/py2pyi.py'),
437437
'fastcore.py2pyi.imp_mod': ('py2pyi.html#imp_mod', 'fastcore/py2pyi.py'),
438438
'fastcore.py2pyi.py2pyi': ('py2pyi.html#py2pyi', 'fastcore/py2pyi.py'),
439+
'fastcore.py2pyi.replace_wildcards': ('py2pyi.html#replace_wildcards', 'fastcore/py2pyi.py'),
439440
'fastcore.py2pyi.sig2str': ('py2pyi.html#sig2str', 'fastcore/py2pyi.py')},
440441
'fastcore.script': { 'fastcore.script.Param': ('script.html#param', 'fastcore/script.py'),
441442
'fastcore.script.Param.__init__': ('script.html#param.__init__', 'fastcore/script.py'),
@@ -627,6 +628,7 @@
627628
'fastcore.xtras.dataclass_src': ('xtras.html#dataclass_src', 'fastcore/xtras.py'),
628629
'fastcore.xtras.dict2obj': ('xtras.html#dict2obj', 'fastcore/xtras.py'),
629630
'fastcore.xtras.dumps': ('xtras.html#dumps', 'fastcore/xtras.py'),
631+
'fastcore.xtras.expand_wildcards': ('xtras.html#expand_wildcards', 'fastcore/xtras.py'),
630632
'fastcore.xtras.get_source_link': ('xtras.html#get_source_link', 'fastcore/xtras.py'),
631633
'fastcore.xtras.globtastic': ('xtras.html#globtastic', 'fastcore/xtras.py'),
632634
'fastcore.xtras.hl_md': ('xtras.html#hl_md', 'fastcore/xtras.py'),

fastcore/py2pyi.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# AUTOGENERATED! DO NOT EDIT! File to edit: ../nbs/12_py2pyi.ipynb.
22

33
# %% auto 0
4-
__all__ = ['functypes', 'imp_mod', 'has_deco', 'sig2str', 'ast_args', 'create_pyi', 'py2pyi']
4+
__all__ = ['functypes', 'imp_mod', 'has_deco', 'sig2str', 'ast_args', 'create_pyi', 'py2pyi', 'replace_wildcards']
55

66
# %% ../nbs/12_py2pyi.ipynb 3
77
import ast, sys, inspect, re, os, importlib.util, importlib.machinery
@@ -136,3 +136,12 @@ def py2pyi(fname:str, # The file name to convert
136136
):
137137
"Convert `fname.py` to `fname.pyi` by removing function bodies and expanding `delegates` kwargs"
138138
create_pyi(fname, package)
139+
140+
# %% ../nbs/12_py2pyi.ipynb 63
141+
@call_parse
142+
def replace_wildcards(
143+
# Path to the Python file to process
144+
path: str):
145+
"Expand wildcard imports in the specified Python file."
146+
path = Path(path)
147+
path.write_text(expand_wildcards(path.read_text()))

0 commit comments

Comments
 (0)