Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(6)  |  Call(3)  |  Derive(0)  |  Import(3)
introspect function's or method's full name.
Returns a tuple (name, normalized_args,) with
'cls' and 'self' removed from normalized_args 

        def _func_info(func, args):
    ''' introspect function's or method's full name.
    Returns a tuple (name, normalized_args,) with
    'cls' and 'self' removed from normalized_args '''

    func_type = _func_type(func)
    lineno = ":%s" % func.func_code.co_firstlineno

    if func_type == 'function':
        name = ".".join([func.__module__, func.__name__]) + lineno
        return name, args

    class_name = args[0].__class__.__name__
    if func_type == 'classmethod':
        class_name = args[0].__name__

    name = ".".join([func.__module__, class_name, func.__name__]) + lineno
    return name, args[1:]
        


src/d/j/django-cache-utils-0.7.2/cache_utils/decorators.py   django-cache-utils(Download)
#coding: utf-8
from django.core.cache import cache
from django.utils.functional import wraps
from cache_utils.utils import _cache_key, _func_info, _func_type, sanitize_memcached_key
 
        def wrapper(*args, **kwargs):
 
            # full name is stored as attribute on first call
            if not hasattr(wrapper, '_full_name'):
                name, _args = _func_info(func, args)

src/h/s/hscacheutils-0.1.6/hscacheutils/generational_cache.py   hscacheutils(Download)
from django.utils.encoding import smart_str
 
from cache_utils.utils import _cache_key, _func_info
from cache_utils.utils import sanitize_memcached_key as orig_sanitize_memcached_key
 
    def _cache_func_name(self, args):
        # full name is stored as attribute on first call
        if not hasattr(self, '_full_name'):
            name, _args = _func_info(self.func, args)
            self._full_name = name

src/d/j/django-cache-utils-0.7.2/cache_utils/tests.py   django-cache-utils(Download)
from django.core.cache import cache
from cache_utils.decorators import cached
from cache_utils.utils import sanitize_memcached_key, _func_type, _func_info
 
def foo(a,b):
    def assertFuncInfo(self, func, args_in, name, args_out):
        info = _func_info(func, args_in)
        self.assertEqual(info[0], name)
        self.assertEqual(info[1], args_out)