def synopsis(filename, cache={}):
    mtime = os.stat(filename).st_mtime
    lastupdate, result = cache.get(filename, (0, None))
    if lastupdate < mtime:
        info = inspect.getmoduleinfo(filename)
        try:
            file = open(filename)
        except IOError:
            # module can't be opened, so skip it
            return None
        if info and 'b' in info[2]: # binary modules have to be imported
            try: module = imp.load_module('__temp__', file, filename, info[1:])
            except: return None
            result = (module.__doc__ or '').splitlines()[0]
            del sys.modules['__temp__']
        else: # text modules can be directly examined
            result = source_synopsis(file)
            file.close()
        cache[filename] = (mtime, result)
    return result
Generate signed URL to provide query-string auth'n to a resource.
dataset/ETHPy150Open deanhiller/databus/webapp/play1.3.x/python/Lib/pydoc.py/synopsis--crossover with--dataset/ETHPy150Open GoogleCloudPlatform/gcloud-python/gcloud/credentials.py/generate_signed_url