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)
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/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/v/o/vogeler-HEAD/vogeler/plugins.py vogeler(Download)
import ConfigParser import os, shutil, subprocess, shlex, datetime from platform import node from glob import iglob import vogeler.exceptions as exceptions
def _compile_plugins(self):
try:
cpf = open(self.compiled_plugin_file, 'w')
header = "#This is a compiled vogeler plugin file. Please do not edit!!!\n"
cpf.write(header)
for filename in iglob(os.path.join(self.plugin_dir, '*.cfg')):
shutil.copyfileobj(open(filename, 'r'), cpf)
src/p/y/python_wc_multiprocessing-HEAD/wc.py python_wc_multiprocessing(Download)
from multiprocessing import Pool, Queue, Process from collections import defaultdict from glob import iglob from pprint import pprint import re PoolSize = 20
reduce_process.start()
p = Pool(PoolSize)
# split the files up amongst workers in the process pool
worker_results = p.imap_unordered(count_words, iglob('**/**/**'))
for i in worker_results:
file_results.put(i)
# signals the end of incoming data for summing
src/o/b/obspy.core-0.4.0/obspy/core/stream.py obspy.core(Download)
(http://www.gnu.org/copyleft/lesser.html)
"""
from glob import iglob
from obspy.core.utcdatetime import UTCDateTime
from obspy.core.trace import Trace
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/p/y/pyhtmllist-HEAD/htmllist/htmllist_demo.py pyhtmllist(Download)
# TODO: I have hell of a time with the unicode here from __future__ import with_statement from glob import iglob from webbrowser import open as web_open from sys import argv from optparse import OptionParser, OptionGroup
print "Waiting..." while True: # Poll a folder indefinitely (need to work on Windows too:) time.sleep(SLEEP) for fl in iglob(options.monitor + "/*"): # If file exists - process, open in browser and delete them print "Handling:", fl with open(fl) as html_file:
src/h/t/HtmlList-2.2.1/htmllist/htmllist_demo.py HtmlList(Download)
# TODO: I have hell of a time with the unicode here from __future__ import with_statement from glob import iglob from webbrowser import open as web_open from sys import argv from optparse import OptionParser, OptionGroup
print "Waiting..." while True: # Poll a folder indefinitely (need to work on Windows too:) time.sleep(SLEEP) for fl in iglob(options.monitor + "/*"): # If file exists - process, open in browser and delete them print "Handling:", fl with open(fl) as html_file:
src/g/a/Gallerize-0.1/gallerize/resize.py Gallerize(Download)
#!/usr/bin/env python # -*- coding: utf-8 -*- """Resize all JPEG images in a directory, writing them to another directory.""" from __future__ import with_statement from glob import iglob
os.mkdir(target_path)
# Find all images in the source directory and resize them.
for image in iglob(os.path.join(src_path, '*.JPG')):
image_basename = os.path.basename(image)
resize_image(src_path, image_basename, target_path, image_basename,
size)
src/g/a/Gallerize-0.1/gallerize/gallerize.py Gallerize(Download)
# you have to change the corresponding code. from __future__ import with_statement from glob import iglob from optparse import OptionParser import os from shutil import copy
def __init__(self, path, title):
self.path = path
self.images = map(os.path.basename, iglob(os.path.join(path, '*.JPG')))
self.images.sort()
self.title = title
def create_thumbnail(self, src_fn, size, target_path):
src/v/o/vogeler-0.9.2/vogeler/plugins.py vogeler(Download)
import ConfigParser import os, shutil, subprocess, shlex, datetime from platform import node from glob import iglob import vogeler.exceptions as exceptions
def _compile_plugins(self):
try:
cpf = open(self.compiled_plugin_file, 'w')
header = "#This is a compiled vogeler plugin file. Please do not edit!!!\n"
cpf.write(header)
for filename in iglob(os.path.join(self.plugin_dir, '*.cfg')):
shutil.copyfileobj(open(filename, 'r'), cpf)
1 | 2 Next