external.mglob

Module: external.mglob

mglob - enhanced file list expansion module

Use as stand-alone utility (for xargs, backticks etc.), or a globbing library for own python programs. Globbing the sys.argv is something that almost every Windows script has to perform manually, and this module is here to help with that task. Also Unix users will benefit from enhanced modes such as recursion, exclusion, directory omission...

Unlike glob.glob, directories are not included in the glob unless specified with ‘dir:’

‘expand’ is the function to use in python programs. Typical use to expand argv (esp. in windows):

try:
    import mglob 
    files = mglob.expand(sys.argv[1:])
except ImportError:
    print "mglob not found; try 'easy_install mglob' for extra features"
    files = sys.argv[1:] 

Note that for unix, shell expands normal wildcards (*.cpp, etc.) in argv. Therefore, you might want to use quotes with normal wildcards to prevent this expansion, in order for mglob to see the wildcards and get the wanted behaviour. Not quoting the wildcards is harmless and typically has equivalent results, though.

Author: Ville Vainio <vivainio@gmail.com> License: MIT Open Source license

Functions

IPython.external.mglob.expand(flist, exp_dirs=False)

Expand the glob(s) in flist.

flist may be either a whitespace-separated list of globs/files or an array of globs/files.

if exp_dirs is true, directory names in glob are expanded to the files contained in them - otherwise, directory names are returned as is.

IPython.external.mglob.init_ipython(ip)
register %mglob for IPython
IPython.external.mglob.main()
IPython.external.mglob.mglob_f(self, arg)
IPython.external.mglob.test()