• Facebook
  • Twitter
  • Reddit
  • StumbleUpon
  • Digg
  • email

All Samples(287)  |  Call(263)  |  Derive(0)  |  Import(24)
Return the text of the source code for an object.

The argument may be a module, class, method, function, traceback, frame,
or code object.  The source code is returned as a single string.  An
IOError is raised if the source code cannot be retrieved.

        def getsource(object):
    """Return the text of the source code for an object.

    The argument may be a module, class, method, function, traceback, frame,
    or code object.  The source code is returned as a single string.  An
    IOError is raised if the source code cannot be retrieved."""
    lines, lnum = getsourcelines(object)
    return string.join(lines, '')
        


src/s/y/sympy-old-HEAD/doc/generate_reference.py   sympy-old(Download)
def get_method_args(x):
    from inspect import getsource
    try:
        s = getsource(x)
    except TypeError:
        return ""
    s = s[s.find("("):s.find(":")]

src/s/y/sympy-tensor-HEAD/doc/generate_reference.py   sympy-tensor(Download)
def get_method_args(x):
    from inspect import getsource
    try:
        s = getsource(x)
    except TypeError:
        return ""
    s = s[s.find("("):s.find(":")]

src/s/y/sympy-HEAD/doc/generate_reference.py   sympy(Download)
def get_method_args(x):
    from inspect import getsource
    try:
        s = getsource(x)
    except TypeError:
        return ""
    s = s[s.find("("):s.find(":")]

src/s/i/simplegrate-HEAD/sympy/doc/generate_reference.py   simplegrate(Download)
def get_method_args(x):
    from inspect import getsource
    try:
        s = getsource(x)
    except TypeError:
        return ""
    s = s[s.find("("):s.find(":")]

src/s/y/sympy-0.6.6/doc/generate_reference.py   sympy(Download)
def get_method_args(x):
    from inspect import getsource
    try:
        s = getsource(x)
    except TypeError:
        return ""
    s = s[s.find("("):s.find(":")]

src/c/l/CleverHarold-0.1/harold/publishers/common.py   CleverHarold(Download)
#
##
 
from inspect import getargspec, getfile, getsource, ismodule
from itertools import chain
from os import path
from sys import maxint
    @return template object
    """
    if layout:
        dom = parse_dom_string(getsource(layout))
    else:
        dom = parse_dom_string(getsource(view))        
 

src/p/a/papy-1.0b1/src/IMap/IMap.py   papy(Download)
from heapq import heappush, heappop
# Misc.
from itertools import izip, repeat
from inspect import getsource, isbuiltin, isfunction
# sets-up logging
from logging import getLogger
log = getLogger(__name__)
        except IndexError:
            pass
        conn = rpyc.classic.connect(*host_port)
        conn.execute(getsource(imports)) # provide @imports on server
 
    while True:
        try:
        if isbuiltin(func):
            inject_code = '%s = %s' % (name, name)
        elif isfunction(func):
            inject_code = getsource(func)
        conn.execute(inject_code)
    return conn.namespace[name]
 

src/b/r/brian-HEAD/trunk/brian/unused/credits.py   brian(Download)
 
from types import StringType
 
from inspect import getmodule,getsource
import re
 
def credits(obj=None):
def author(obj):
    '''
    A stupid function that returns the most likely author(s) of the object (Dan or Romain),
    guessing from code style.
    TODO: remove comments from code.
    '''
    text=getsource(obj)

src/b/r/brian-HEAD/brian/unused/credits.py   brian(Download)
 
from types import StringType
 
from inspect import getmodule,getsource
import re
 
def credits(obj=None):
def author(obj):
    '''
    A stupid function that returns the most likely author(s) of the object (Dan or Romain),
    guessing from code style.
    TODO: remove comments from code.
    '''
    text=getsource(obj)

src/s/y/sympy-old-HEAD/sympy/utilities/benchmarking.py   sympy-old(Download)
from time import time
import timeit
 
from inspect import getsource
 
 
# from IPython.Magic.magic_timeit
    def execute(self, target, *args):
        # get func source without first 'def func(...):' line
        src = getsource(target)
        src = '\n'.join( src.splitlines()[1:] )
 
        # extract benchmark title
        if target.func_doc is not None:

  1 | 2 | 3  Next