Did I find the right examples for you? yes no

All Samples(5299)  |  Call(4750)  |  Derive(0)  |  Import(549)
Get the names and default values of a function's arguments.

A tuple of four things is returned: (args, varargs, varkw, defaults).
'args' is a list of the argument names (it may contain nested lists).
'varargs' and 'varkw' are the names of the * and ** arguments or None.
'defaults' is an n-tuple of the default values of the last n arguments.

        def getargspec(func):
    """Get the names and default values of a function's arguments.

    A tuple of four things is returned: (args, varargs, varkw, defaults).
    'args' is a list of the argument names (it may contain nested lists).
    'varargs' and 'varkw' are the names of the * and ** arguments or None.
    'defaults' is an n-tuple of the default values of the last n arguments.
    """

    if ismethod(func):
        func = func.im_func
    if not isfunction(func):
        raise TypeError('{!r} is not a Python function'.format(func))
    args, varargs, varkw = getargs(func.func_code)
    return ArgSpec(args, varargs, varkw, func.func_defaults)
        


src/a/u/AutobahnPython-HEAD/examples/twisted/wamp/work/test2.py   AutobahnPython(Download)
def get_class_default_arg(fn, klass):
   argspec = inspect.getargspec(fn)
   if argspec and argspec.defaults:
      for i in range(len(argspec.defaults)):
         if argspec.defaults[-i] == klass:
            return argspec.args[-i]
   return None
 
print(inspect.signature(add2))
print(inspect.getargspec(add2))

src/b/a/baepython_sdk-HEAD/examples/weibotest/0/mako/util.py   baepython_sdk(Download)
    def inspect_func_args(fn):
        return inspect.getargspec(fn)
 

src/s/a/sampledoc-HEAD/sphinxext/docscrape.py   sampledoc(Download)
            try:
                # try to read signature
                argspec = inspect.getargspec(func)
                argspec = inspect.formatargspec(*argspec)
                argspec = argspec.replace('*','\*')

src/m/o/modern-python-example-HEAD/lib/python2.7/site-packages/pep8.py   modern-python-example(Download)
        if not inspect.isfunction(function):
            continue
        args = inspect.getargspec(function)[0]
        if args and args[0].startswith(argument_name):
            codes = ERRORCODE_REGEX.findall(inspect.getdoc(function) or '')

src/m/o/modern-python-example-HEAD/lib/python2.7/site-packages/logilab/astng/raw_building.py   modern-python-example(Download)
import sys
from os.path import abspath
from inspect import (getargspec, isdatadescriptor, isfunction, ismethod,
                     ismethoddescriptor, isclass, isbuiltin)
 
def object_build_function(node, member, localname):
    """create astng for a living function object"""
    args, varargs, varkw, defaults = getargspec(member)
    if varargs is not None:
        args.append(varargs)

src/h/u/hunch-sample-app-HEAD/django/contrib/admindocs/views.py   hunch-sample-app(Download)
    # Gather model methods.
    for func_name, func in model.__dict__.items():
        if (inspect.isfunction(func) and len(inspect.getargspec(func)[0]) == 1):
            try:
                for exclude in MODEL_METHODS_EXCLUDE:

src/h/u/hunch-sample-app-HEAD/django/db/models/fields/subclassing.py   hunch-sample-app(Download)
"""
 
from inspect import getargspec
from warnings import warn
 
def call_with_connection(func):
    arg_names, varargs, varkwargs, defaults = getargspec(func)
def call_with_connection_and_prepared(func):
    arg_names, varargs, varkwargs, defaults = getargspec(func)
    updated = (
        ('connection' in arg_names or varkwargs) and
        ('prepared' in arg_names or varkwargs)

src/h/u/hunch-sample-app-HEAD/django/template/__init__.py   hunch-sample-app(Download)
import imp
import re
from inspect import getargspec
 
from django.conf import settings
        # Check to see if a decorator is providing the real function.
        func = getattr(func, '_decorated_function', func)
        args, varargs, varkw, defaults = getargspec(func)
        # First argument is filter input.
        args.pop(0)
    def simple_tag(self,func):
        params, xx, xxx, defaults = getargspec(func)
 
        class SimpleNode(Node):
            def __init__(self, vars_to_resolve):
        def dec(func):
            params, xx, xxx, defaults = getargspec(func)
            if takes_context:
                if params[0] == 'context':
                    params = params[1:]

src/h/u/hunch-sample-app-HEAD/django/dispatch/dispatcher.py   hunch-sample-app(Download)
            # callables.
            try:
                argspec = inspect.getargspec(receiver)
            except TypeError:
                try:
                    argspec = inspect.getargspec(receiver.__call__)

src/g/a/gae-twitter-oauth-example-HEAD/werkzeug/script.py   gae-twitter-oauth-example(Download)
def analyse_action(func):
    """Analyse a function."""
    description = inspect.getdoc(func) or 'undocumented action'
    arguments = []
    args, varargs, kwargs, defaults = inspect.getargspec(func)

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