Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
import wrapt
from wrapt import six
DECORATORS_CODE = """
import wrapt
def prototype(arg1, arg2, *, arg3=None, **kwargs): pass
@wrapt.decorator(adapter=prototype)
def adapter1(wrapped, instance, args, kwargs):
'''adapter documentation'''
return wrapped(*args, **kwargs)
"""
decorators = imp.new_module('decorators')
six.exec_(DECORATORS_CODE, decorators.__dict__, decorators.__dict__)
def function1(arg1, arg2):
'''documentation'''
return arg1, arg2
function1o = function1
@decorators.adapter1
def function1(arg1, arg2):
'''documentation'''
return arg1, arg2
function1d = function1
class TestArgumentSpecification(unittest.TestCase):
import imp
import wrapt
from wrapt import six
DECORATORS_CODE = """
import wrapt
@wrapt.decorator
def passthru_decorator(wrapped, instance, args, kwargs):
return wrapped(*args, **kwargs)
"""
decorators = imp.new_module('decorators')
six.exec_(DECORATORS_CODE, decorators.__dict__, decorators.__dict__)
def function1(arg):
'''documentation'''
return arg
function1o = function1
@decorators.passthru_decorator
def function(arg):
'''documentation'''
return arg
function1d = function1
class TestNamingFunction(unittest.TestCase):
import imp
import wrapt
from wrapt import six
DECORATORS_CODE = """
import wrapt
@wrapt.decorator
def passthru_decorator(wrapped, instance, args, kwargs):
return wrapped(*args, **kwargs)
"""
decorators = imp.new_module('decorators')
six.exec_(DECORATORS_CODE, decorators.__dict__, decorators.__dict__)
class OldClass1():
def function(self, arg):
'''documentation'''
return arg
OldClass1o = OldClass1
class OldClass1():
@decorators.passthru_decorator
def function(self, arg):
'''documentation'''
return arg
OldClass1d = OldClass1
import wrapt
from wrapt import six
DECORATORS_CODE = """
import wrapt
def prototype(arg1, arg2, arg3=None, *args, **kwargs): pass
@wrapt.decorator(adapter=prototype)
def adapter1(wrapped, instance, args, kwargs):
'''adapter documentation'''
return wrapped(*args, **kwargs)
"""
decorators = imp.new_module('decorators')
six.exec_(DECORATORS_CODE, decorators.__dict__, decorators.__dict__)
def function1(arg1, arg2):
'''documentation'''
return arg1, arg2
function1o = function1
@decorators.adapter1
def function1(arg1, arg2):
'''documentation'''
return arg1, arg2
function1d = function1
class TestAdapterAttributes(unittest.TestCase):