import sys,os,inspect
from typing import *
sys.path.insert(0, '..')
import fastai
import fastai.vision.transform
def get_ft_names(mod) -> List[str]:
"""retrieves all the functions of `mod`"""
fn_names = []
for elt_name in dir(mod):
elt = getattr(mod,elt_name)
#This removes the files imported from elsewhere
try: fname = inspect.getfile(elt)
except: continue
if fname != mod.__file__: continue
if inspect.isclass(elt) or inspect.isfunction(elt): fn_names.append(elt_name)
return fn_names
def get_all_str(mod):
res = [f"'{o}'" for o in get_ft_names(mod) if not o.startswith('_')]
print(f'__all__ = [{", ".join(res)}]')
get_all_str(fastai.vision.transform)