Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def create_factory_proxy(proxy_base, classifier, factory_table):
proxy_class = type(
'ring.create_factory_proxy.._FactoryProxy', (proxy_base,), {})
proxy_class.classifier = staticmethod(classifier)
proxy_class.factory_table = staticmethod(factory_table)
sample_factory = factory_table[0]
proxy_class.__call__ = functools.wraps(sample_factory)(proxy_class.__call__)
proxy_class.__doc__ = sample_factory.__doc__
return proxy_class
pass
attr = getattr(self._rope.config.user_interface, name)
if callable(attr):
transform_args = getattr(
attr, 'transform_args', None)
def impl_f(*args, **kwargs):
if transform_args:
transform_func, transform_rules = transform_args
args, kwargs = transform_func(
self, transform_rules, args, kwargs)
return attr(self, *args, **kwargs)
cc = self._callable.wrapped_callable
functools.wraps(cc)(impl_f)
impl_f.__name__ = '.'.join((cc.__name__, name))
if six.PY34:
impl_f.__qualname__ = '.'.join((cc.__qualname__, name))
annotations = getattr(
impl_f, '__annotations__', {})
annotations_override = getattr(
attr, '__annotations_override__', {})
for field, override in annotations_override.items():
if isinstance(override, types.FunctionType):
new_annotation = override(annotations)
else:
new_annotation = override
annotations[field] = new_annotation
setattr(self, name, impl_f)