call site 1 for path.local.listdir
apigen/testing/test_apigen_example.py - line 301
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
   def test_build_function_navigation(self):
       self.apb.build_namespace_pages()
       self.apb.build_function_pages(['main.sub.func'])
       self.apb.build_class_pages(['main.SomeClass',
                                   'main.SomeSubClass',
                                   'main.SomeInstance',
                                   'main.SomeHiddenClass'])
->     self.linker.replace_dirpath(self.base, False)
       html = self.base.join('api/main.sub.func.html').read()
       print html
       # XXX NOTE: do not mess with the string below, the spaces between the
       # <div> and <a> are actually UTF-8 \xa0 characters (non-breaking
       # spaces)!
       assert """\
       <div class="sidebar">
         <div class="selected"><a href="index.html">pkg</a></div>
         <div class="selected">  <a href="main.html">main</a></div>
         <div>    <a href="main.SomeClass.html">SomeClass</a></div>
         <div>    <a href="main.SomeInstance.html">SomeInstance</a></div>
         <div>    <a href="main.SomeSubClass.html">SomeSubClass</a></div>
         <div class="selected">    <a href="main.sub.html">sub</a></div>
         <div class="selected">      <a href="main.sub.func.html">func</a></div>
         <div>  <a href="other.html">other</a></div></div>
   """ in html
apigen/linker.py - line 85
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
   def replace_dirpath(self, dirpath, stoponerrors=True):
       """ replace temporary links in all html files in dirpath and below """
->     for fpath in dirpath.visit('*.html'):
           html = fpath.read()
           while 1:
               match = self._reg_tempurl.search(html)
               if not match:
                   break
               tempurl = match.group(1)
               try:
                   html = html.replace('"' + tempurl + '"',
                                       '"' + self.get_target(tempurl,
                                               fpath.relto(dirpath)) + '"')
               except KeyError:
                   if stoponerrors:
                       raise
                   html = html.replace('"' + tempurl + '"',
                                       '"apigen.notfound://%s"' % (tempurl,))
           fpath.write(html)
path/common.py - line 215
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
   def visit(self, fil=None, rec=None, ignore=_dummyclass):
       """ yields all paths below the current one
   
               fil is a filter (glob pattern or callable), if not matching the
               path will not be yielded, defaulting to None (everything is
               returned)
   
               rec is a filter (glob pattern or callable) that controls whether
               a node is descended, defaulting to None
   
               ignore is an Exception class that is ignoredwhen calling dirlist()
               on any of the paths (by default, all exceptions are reported)
           """
       if isinstance(fil, str):
           fil = fnmatch(fil)
       if rec: 
           if isinstance(rec, str):
               rec = fnmatch(fil)
           elif not callable(rec): 
               rec = lambda x: True 
       reclist = [self]
       while reclist: 
           current = reclist.pop(0)
           try:
->             dirlist = current.listdir() 
           except ignore:
               return
           for p in dirlist:
               if fil is None or fil(p):
                   yield p
               if p.check(dir=1) and (rec is None or rec(p)):
                   reclist.append(p)