All Samples(87) | Call(71) | Derive(0) | Import(16)
Return an iterator which yields the paths matching a pathname pattern. The pattern may contain simple shell-style wildcards a la fnmatch.
def iglob(pathname):
"""Return an iterator which yields the paths matching a pathname pattern.
The pattern may contain simple shell-style wildcards a la fnmatch.
"""
if not has_magic(pathname):
if os.path.lexists(pathname):
yield pathname
return
dirname, basename = os.path.split(pathname)
if not dirname:
for name in glob1(os.curdir, basename):
yield name
return
if has_magic(dirname):
dirs = iglob(dirname)
else:
dirs = [dirname]
if has_magic(basename):
glob_in_dir = glob1
else:
glob_in_dir = glob0
for dirname in dirs:
for name in glob_in_dir(dirname, basename):
yield os.path.join(dirname, name)
def clear(self):
[os.remove(entry) for entry in glob.iglob(os.path.join(self._intf._cachedir, '*'))]
def delete(self, uri):
for entry in glob.iglob(os.path.join(self._intf._cachedir, '*.headers')):
f = open(entry, 'rb')
val = f.read()
def all(self, _filter='*'):
uris = []
for entry in glob.iglob(os.path.join(self._intf._cachedir, '*.headers')):
f = open(entry, 'rb')
val = f.read()
f.close()
def files(self, _filter='*'):
uris = []
for entry in glob.iglob(os.path.join(self._intf._cachedir, '*.headers')):
f = open(entry, 'rb')
content_headers = f.read()
f.close()
def resources(self, _filter='*'):
uris = []
for entry in glob.iglob(os.path.join(self._intf._cachedir, '*.headers')):
f = open(entry, 'rb')
content_headers = f.read()
f.close()
def get_data_file(self, uri):
for entry in glob.iglob(os.path.join(self._intf._cachedir, '*.headers')):
f = open(entry, 'rb')
val = f.read()
f.close()
if get_content_uri(val) == uri:
return entry.split('.headers')[0]
def get_header_file(self, uri):
for entry in glob.iglob(os.path.join(self._intf._cachedir, '*.headers')):
f = open(entry, 'rb')
val = f.read()
f.close()
if get_content_uri(val) == uri:
return entry
src/u/l/Ulu-HEAD/bin/uremove.py Ulu(Download)
exclusions = list(set(sum(exclusions, []))) # flatten and de-dupe
for ent in args.pathspec:
for globbed in glob.iglob(ent):
globbed = os.path.normpath(globbed)
if globbed in exclusions:
continue
src/e/x/exovo-HEAD/trunk/base/tools/xprotogen.py exovo(Download)
pydir = os.path.join(basedir, 'xproto-autogen')
assert os.path.isdir(pydir)
for pyfile in glob.iglob(os.path.join(pydir, '*.*')):
os.remove(pyfile)
xmlfiles = glob.glob(os.path.join(xmldir, '*.xml'))
src/e/x/exovo-HEAD/base/tools/xprotogen.py exovo(Download)
pydir = os.path.join(basedir, 'xproto-autogen')
assert os.path.isdir(pydir)
for pyfile in glob.iglob(os.path.join(pydir, '*.*')):
os.remove(pyfile)
xmlfiles = glob.glob(os.path.join(xmldir, '*.xml'))
src/o/b/obspy-HEAD/misc/sandbox/openglviewer/misc/index_files.py obspy(Download)
from obspy.core import read, Stream, Trace, UTCDateTime from glob import iglob import numpy as np from numpy.ma import is_masked folder = '/Users/lion/Documents/workspace/TestFiles/archive/RJOB/EHE.D/BW.*' for file in iglob(folder):
src/b/l/bleachbit-HEAD/bleachbit/Cleaner.py bleachbit(Download)
return True
elif 'pathname' == test:
expanded = os.path.expanduser(os.path.expandvars(pathname))
for globbed in glob.iglob(expanded):
if os.path.exists(globbed):
print "debug: file '%s' exists indicating '%s' is running" % (globbed, self.name)
return True
for path in paths:
expanded = os.path.expandvars(path)
for globbed in glob.iglob(expanded):
files += [ globbed ]
# memory
file = os.path.expandvars('$windir\\memory.dmp')
if os.path.exists(file):
files += [ file ]
for file in glob.iglob(os.path.expandvars('$windir\\Minidump\\*.dmp')):
files += [ file ]
# most recently used documents list
# prefetch
if 'nt' == os.name and 'prefetch' == option_id:
for path in glob.iglob(os.path.expandvars('$windir\\Prefetch\\*.pf')):
yield Command.Delete(path)
src/o/b/obspy-HEAD/obspy.core/trunk/obspy/core/stream.py obspy(Download)
""" from StringIO import StringIO from glob import iglob from obspy.core.trace import Trace from obspy.core.utcdatetime import UTCDateTime from obspy.core.util import NamedTemporaryFile, _getPlugins, deprecated, \
else:
# file name
pathname = pathname_or_url
for file in iglob(pathname):
st.extend(_read(file, format, headonly, **kwargs).traces)
if len(st) == 0:
raise Exception("Cannot open file/files", pathname)
src/r/e/reverence-HEAD/src/cache.py reverence(Download)
if not os.path.exists(settingsroot): continue for cachepath in glob.iglob(os.path.join(settingsroot, "*/*/CCP/EVE/" + cacheFolderName, "cache")): # this should only ever give one folder. break else:
src/b/l/bleachbit-HEAD/bleachbit/Unix.py bleachbit(Download)
def __localization_path(self, basedir, language_filter, dir_filter):
"""Return localization paths in a single directory tree"""
if -1 != basedir.find('*'):
for basedir2 in glob.iglob(basedir):
for path in self.__localization_path(basedir2, language_filter, dir_filter):
yield path
return
def is_running(exename):
"""Check whether exename is running"""
for filename in glob.iglob("/proc/*/exe"):
try:
target = os.path.realpath(filename)
except TypeError:
# happens, for example, when link points to
'/var/log/*/*.old', \
'/var/log/*.old' )
for globpath in globpaths:
for path in glob.iglob(globpath):
yield path
regex = '-[0-9]{8}$'
globpaths = ( '/var/log/*-*', '/var/log/*/*-*' )
src/b/l/bleachbit-HEAD/bleachbit/FileUtilities.py bleachbit(Download)
def scan(self):
"""Update cache"""
self.last_scan_time = datetime.datetime.now()
self.files = []
for filename in glob.iglob("/proc/*/fd/*"):
try:
target = os.path.realpath(filename)
def expand_glob_join(pathname1, pathname2):
"""Join pathname1 and pathname1, expand pathname, glob, and return as list"""
ret = []
pathname3 = os.path.expanduser(os.path.expandvars(os.path.join(pathname1, pathname2)))
for pathname4 in glob.iglob(pathname3):
ret.append(pathname4)
return ret
for path in globex(singleglob, regex):
yield path
else:
for path in glob.iglob(pathname):
if re.search(regex, path):
yield path
1 | 2 | 3 | 4 | 5 | 6 Next