MCPcopy Create free account
hub / github.com/Image-Py/imagepy / build_tools

Function build_tools

imagepy/core/loader/loader.py:161–188  ·  view source on GitHub ↗
(path, err=False)

Source from the content-addressed store, hash-verified

159 return rst
160
161def build_tools(path, err=False):
162 root = err in (True, False)
163 if root: sta, err = err, []
164 subtree = []
165 cont = os.listdir(os.path.join(root_dir, path))
166
167 for i in cont:
168 subp = os.path.join(path,i)
169 if root and os.path.isdir(os.path.join(root_dir, subp)):
170 sub = build_tools(subp, err)
171 if len(sub)!=0:subtree.append(sub)
172 elif not root:
173 if i[len(i)-7:] in ('_tol.py', 'tols.py'):
174 subtree.append(i[:-3])
175 elif i[-3:] in ('.mc', '.md', '.wf', 'rpt'):
176 subtree.append(i)
177 if len(subtree)==0:return []
178 rpath = path.replace('/', '.').replace('\\','.')
179 #rpath = rpath[rpath.index('imagepy.'):]
180 pg = __import__('imagepy.' + rpath,'','',[''])
181 pg.title = os.path.basename(path)
182 if hasattr(pg, 'catlog'):
183 subtree = sort_tools(pg.catlog, subtree)
184 if not root:subtree = extend_tools(path, subtree, err)
185 elif sta and len(err)>0:
186 IPy.write('tools not loaded:')
187 for i in err: IPy.write('>>> %-50s%-20s%s'%i)
188 return (pg, subtree)
189
190def extend_widgets(path, lst, err):
191 rst = []

Callers 1

loader.pyFile · 0.70

Calls 4

sort_toolsFunction · 0.85
extend_toolsFunction · 0.85
appendMethod · 0.80
writeMethod · 0.45

Tested by

no test coverage detected