Did I find the right examples for you? yes no

All Samples(893)  |  Call(861)  |  Derive(0)  |  Import(32)
Work out which source or compiled file an object was defined in.

        def getfile(object):
    """Work out which source or compiled file an object was defined in."""
    if ismodule(object):
        if hasattr(object, '__file__'):
            return object.__file__
        raise TypeError('{!r} is a built-in module'.format(object))
    if isclass(object):
        object = sys.modules.get(object.__module__)
        if hasattr(object, '__file__'):
            return object.__file__
        raise TypeError('{!r} is a built-in class'.format(object))
    if ismethod(object):
        object = object.im_func
    if isfunction(object):
        object = object.func_code
    if istraceback(object):
        object = object.tb_frame
    if isframe(object):
        object = object.f_code
    if iscode(object):
        return object.co_filename
    raise TypeError('{!r} is not a module, class, method, '
                    'function, traceback, frame, or code object'.format(object))
        


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/n/i/nipype-HEAD/examples/dmri_connectivity_advanced.py   nipype(Download)
 
CFFConverter = pe.Node(interface=cmtk.CFFConverter(), name="CFFConverter")
CFFConverter.inputs.script_files = op.abspath(inspect.getfile(inspect.currentframe()))
giftiSurfaces = pe.Node(interface=util.Merge(9), name="GiftiSurfaces")
giftiLabels = pe.Node(interface=util.Merge(2), name="GiftiLabels")
cmats_to_csv = create_cmats_to_csv_pipeline(name='cmats_to_csv')
NxStatsCFFConverter = pe.Node(interface=cmtk.CFFConverter(), name="NxStatsCFFConverter")
NxStatsCFFConverter.inputs.script_files = op.abspath(inspect.getfile(inspect.currentframe()))
 
tessflow = create_tessellation_flow(name='tessflow', out_format='gii')

src/m/o/modern-python-example-HEAD/lib/python2.7/site-packages/Crypto/SelfTest/PublicKey/test_RSA.py   modern-python-example(Download)
        import inspect
        _fm_path = os.path.normpath(os.path.dirname(os.path.abspath(
            inspect.getfile(inspect.currentframe())))
            +"/../../PublicKey/_fastmath"+get_config_var("SO"))
        if os.path.exists(_fm_path):

src/m/o/modern-python-example-HEAD/lib/python2.7/site-packages/Crypto/SelfTest/PublicKey/test_DSA.py   modern-python-example(Download)
        import inspect
        _fm_path = os.path.normpath(os.path.dirname(os.path.abspath(
            inspect.getfile(inspect.currentframe())))
            +"/../../PublicKey/_fastmath"+get_config_var("SO"))
        if os.path.exists(_fm_path):

src/n/i/nipype-HEAD/examples/dmri_connectivity.py   nipype(Download)
"""
 
CFFConverter.inputs.script_files = op.abspath(inspect.getfile(inspect.currentframe()))
mapping.connect([(giftiSurfaces, CFFConverter,[("out","gifti_surfaces")])])
mapping.connect([(giftiLabels, CFFConverter,[("out","gifti_labels")])])

src/a/e/Aerospace-Simulations-HEAD/morse/examples/tutorials/multinode/tutorial-socket.py   Aerospace-Simulations(Download)
# __file__ fails if someone does os.chdir() before
# sys.argv[0] also fails because it doesn't not always contains the path
cmd_folder = os.path.abspath(os.path.split(inspect.getfile( inspect.currentframe() ))[0])
if cmd_folder not in sys.path:
        sys.path.insert(0, cmd_folder)

src/a/e/Aerospace-Simulations-HEAD/morse/examples/tutorials/multinode/tutorial-hla.py   Aerospace-Simulations(Download)
# __file__ fails if someone does os.chdir() before
# sys.argv[0] also fails because it doesn't not always contains the path
cmd_folder = os.path.abspath(os.path.split(inspect.getfile( inspect.currentframe() ))[0])
if cmd_folder not in sys.path:
        sys.path.insert(0, cmd_folder)

src/a/e/Aerospace-Simulations-HEAD/morse/examples/tutorials/multinode/tutorial-hla-hybrid.py   Aerospace-Simulations(Download)
# __file__ fails if someone does os.chdir() before
# sys.argv[0] also fails because it doesn't not always contains the path
cmd_folder = os.path.abspath(os.path.split(inspect.getfile( inspect.currentframe() ))[0])
if cmd_folder not in sys.path:
        sys.path.insert(0, cmd_folder)

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/v/e/VectorDict-1.0.0/example/word_single_map.py   VectorDict(Download)
    os.path.join(
        os.path.split(
            inspect.getfile( inspect.currentframe() )
        )[0] ,
        ".."

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