Did I find the right examples for you? yes no

All Samples(1746)  |  Call(1715)  |  Derive(0)  |  Import(31)
Return the filename that can be used to locate an object's source.
Return None if no way can be identified to get the source.

        def getsourcefile(object):
    """Return the filename that can be used to locate an object's source.
    Return None if no way can be identified to get the source.
    """
    filename = getfile(object)
    if string.lower(filename[-4:]) in ('.pyc', '.pyo'):
        filename = filename[:-4] + '.py'
    for suffix, mode, kind in imp.get_suffixes():
        if 'b' in mode and string.lower(filename[-len(suffix):]) == suffix:
            # Looks like a binary file.  We want to only return a text file.
            return None
    if os.path.exists(filename):
        return filename
    # only return a non-existent filename if the module has a PEP 302 loader
    if hasattr(getmodule(object, filename), '__loader__'):
        return filename
    # or it is in the linecache
    if filename in linecache.cache:
        return filename
        


src/h/u/hunch-sample-app-HEAD/django/test/_doctest.py   hunch-sample-app(Download)
        # given object's docstring.
        try:
            file = inspect.getsourcefile(obj) or inspect.getfile(obj)
            source_lines = linecache.getlines(file)
            if not source_lines:

src/g/a/gae-twitter-oauth-example-HEAD/werkzeug/debug/tbtools.py   gae-twitter-oauth-example(Download)
        self.globals = tb.tb_frame.f_globals
 
        fn = inspect.getsourcefile(tb) or inspect.getfile(tb)
        if fn[-4:] in ('.pyo', '.pyc'):
            fn = fn[:-1]

src/b/r/brian-HEAD/dev/tools/docs/generate_examples.py   brian(Download)
    try:
        # do not add modules (e.g. synapses is a common variable name)
        if 'brian' in inspect.getsourcefile(v) and not inspect.ismodule(v):
            documentable_names.add(k)
    except TypeError:

src/g/u/gunicorn-18.0/examples/frameworks/pylonstest/ez_setup.py   gunicorn(Download)
 
    import inspect
    srcfile = inspect.getsourcefile(sys.modules[__name__])
    f = open(srcfile, 'rb'); src = f.read(); f.close()
 

src/g/u/gunicorn-HEAD/examples/frameworks/pylonstest/ez_setup.py   gunicorn(Download)
 
    import inspect
    srcfile = inspect.getsourcefile(sys.modules[__name__])
    f = open(srcfile, 'rb'); src = f.read(); f.close()
 

src/p/k/pkg-gunicorn-HEAD/examples/frameworks/pylonstest/ez_setup.py   pkg-gunicorn(Download)
 
    import inspect
    srcfile = inspect.getsourcefile(sys.modules[__name__])
    f = open(srcfile, 'rb'); src = f.read(); f.close()
 

src/k/a/kanone-HEAD/examples/pylons/form/ez_setup.py   kanone(Download)
 
    import inspect
    srcfile = inspect.getsourcefile(sys.modules[__name__])
    f = open(srcfile, 'rb'); src = f.read(); f.close()
 

src/c/o/cogen-0.2.1/examples/cogen-chat/ChatApp/ez_setup.py   cogen(Download)
 
    import inspect
    srcfile = inspect.getsourcefile(sys.modules[__name__])
    f = open(srcfile, 'rb'); src = f.read(); f.close()
 

src/r/a/raptorizemw-HEAD/examples/tg2-raptorized/ez_setup/__init__.py   raptorizemw(Download)
 
    import inspect
    srcfile = inspect.getsourcefile(sys.modules[__name__])
    f = open(srcfile, 'rb'); src = f.read(); f.close()
 

src/t/w/twMaps-0.1a0.dev-r720/twMapsSampleAppPylons/ez_setup/__init__.py   twMaps(Download)
 
    import inspect
    srcfile = inspect.getsourcefile(sys.modules[__name__])
    f = open(srcfile, 'rb'); src = f.read(); f.close()
 

  1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9  Next