コード例 #1
0
 def test_walk_wildcard(self):
     self.fs.setcontents('a.txt', 'hello')
     self.fs.setcontents('b.txt', 'world')
     self.fs.makeopendir('foo').setcontents('c', '123')
     self.fs.makeopendir('.svn').setcontents('ignored', '')
     for dir_path, paths in self.fs.walk(wildcard='*.txt'):
         for path in paths:
             self.assert_(path.endswith('.txt'))
     for dir_path, paths in self.fs.walk(wildcard=lambda fn:fn.endswith('.txt')):
         for path in paths:
             self.assert_(path.endswith('.txt'))
コード例 #2
0
 def test_walk_wildcard(self):
     self.fs.setcontents('a.txt', b('hello'))
     self.fs.setcontents('b.txt', b('world'))
     self.fs.makeopendir('foo').setcontents('c', b('123'))
     self.fs.makeopendir('.svn').setcontents('ignored', b(''))
     for dir_path, paths in self.fs.walk(wildcard='*.txt'):
         for path in paths:
             self.assert_(path.endswith('.txt'))
     for dir_path, paths in self.fs.walk(wildcard=lambda fn: fn.endswith('.txt')):
         for path in paths:
             self.assert_(path.endswith('.txt'))
コード例 #3
0
def url_join(path, path2):
    result = urlparse(path)
    if result.scheme and path.endswith(result.scheme):
        return f"{path}!/{path2}"
    else:
        return f"{path}/{path2}"