1 # Module 'glob' -- filename globbing.
9 if not has_magic(pathname
):
10 if os
.path
.exists(pathname
):
14 dirname
, basename
= os
.path
.split(pathname
)
15 if has_magic(dirname
):
19 if not has_magic(basename
):
22 if basename
or os
.path
.isdir(dirname
):
23 name
= os
.path
.join(dirname
, basename
)
24 if os
.path
.exists(name
):
29 sublist
= glob1(dirname
, basename
)
31 result
.append(os
.path
.join(dirname
, name
))
34 def glob1(dirname
, pattern
):
35 if not dirname
: dirname
= os
.curdir
37 names
= os
.listdir(dirname
)
42 if name
[0] != '.' or pattern
[0] == '.':
43 if fnmatch
.fnmatch(name
, pattern
):
48 magic_check
= regex
.compile('[*?[]')
51 return magic_check
.search(s
) >= 0