Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
return [result]
else:
return []
def callback(func, *args):
return func(*args[:func.__code__.co_argcount])
class NoDefault(object):
def __repr__(self):
"""clean representation in Sphinx"""
return ''
no_default = NoDefault()
del NoDefault
class FlexibleElement(object):
"""property to allow a flexible api"""
def __init__(self, pget, pset=no_default, pdel=no_default):
self.pget = pget
self.pset = pset
self.pdel = pdel
def __get__(self, instance, klass):
class _element(object):
"""real element to support set/get/del attr and item and js call
style"""
def __call__(prop, *args, **kwargs):
return self.pget(instance, *args, **kwargs)
if type(result) is list:
return result
elif isinstance(result, etree._ElementTree):
return [result.getroot()]
else:
return [result]
def callback(func, *args):
return func(*args[:func_code(func).co_argcount])
class NoDefault(object):
def __repr__(self):
"""clean representation in Sphinx"""
return ''
no_default = NoDefault()
del NoDefault
class FlexibleElement(object):
"""property to allow a flexible api"""
def __init__(self, pget, pset=no_default, pdel=no_default):
self.pget = pget
self.pset = pset
self.pdel = pdel
def __get__(self, instance, klass):
class _element(object):
"""real element to support set/get/del attr and item and js call
style"""
def __call__(prop, *args, **kwargs):
return self.pget(instance, *args, **kwargs)
__getattr__ = __getitem__ = __setattr__ = __setitem__ = __call__
def __delitem__(prop, name):