示例#1
0
 def new_func(*args, **kwargs):
     logging.warning(
         "%s (from %s) is experimental and may change or be removed at " "any time, and without warning.",
         decorator_utils.get_qualified_name(func),
         func.__module__,
     )
     return func(*args, **kwargs)
示例#2
0
 def new_func(*args, **kwargs):
     logging.warning(
         '%s (from %s) is deprecated and will be removed after %s.\n'
         'Instructions for updating:\n%s',
         decorator_utils.get_qualified_name(func), func.__module__,
         date, instructions)
     return func(*args, **kwargs)
示例#3
0
 def new_func(*args, **kwargs):
     """Deprecation wrapper."""
     named_args = inspect.getcallargs(func, *args, **kwargs)
     for arg_name, arg_value in deprecated_kwargs.items():
         if arg_name in named_args and named_args[arg_name] == arg_value:
             logging.warning(
                 'Calling %s (from %s) with %s=%s is deprecated and will be '
                 'removed after %s.\nInstructions for updating:\n%s',
                 decorator_utils.get_qualified_name(func),
                 func.__module__, arg_name, arg_value, date,
                 instructions)
     return func(*args, **kwargs)
示例#4
0
 def new_func(*args, **kwargs):
     """Deprecation wrapper."""
     invalid_args = []
     for (i, arg_name) in deprecated_positions:
         if i < len(args):
             invalid_args.append(arg_name)
     if is_varargs_deprecated and len(args) > len(arg_spec.args):
         invalid_args.append(arg_spec.varargs)
     if is_kwargs_deprecated and kwargs:
         invalid_args.append(arg_spec.keywords)
     for arg_name in deprecated_arg_names:
         if arg_name in kwargs:
             invalid_args.append(arg_name)
     for arg_name in invalid_args:
         logging.warning(
             'Calling %s (from %s) with %s is deprecated and will be removed '
             'after %s.\nInstructions for updating:\n%s',
             decorator_utils.get_qualified_name(func), func.__module__,
             arg_name, date, instructions)
     return func(*args, **kwargs)
示例#5
0
 def new_func(*args, **kwargs):
     logging.warning(
         '%s (from %s) is experimental and may change or be removed at '
         'any time, and without warning.',
         decorator_utils.get_qualified_name(func), func.__module__)
     return func(*args, **kwargs)
示例#6
0
 def test_function(self):
   self.assertEqual(
       "_test_function",
       decorator_utils.get_qualified_name(_test_function))
示例#7
0
 def test_method(self):
   self.assertEqual(
       "GetQualifiedNameTest.test_method",
       decorator_utils.get_qualified_name(GetQualifiedNameTest.test_method))