class_docstr: The mini decorator factory
class_docstr_tok: ["The","mini","decorator","factory"]
docstr: The main logic of decorator
  
  Here is how those arguments works::
  
      @out_decorator(*dec_args, *dec_kwargs)
      def func(*wrap_args, **wrap_kwargs):
          ...
  
  And in the ``wrapper``, we simply create ``self.target`` instance via
  ``with``::
  
      target = self.get_target(*args, **kwargs)
      with target(*dec_args, **dec_kwargs) as obj:
          ...
docstr_tok: ["The","main","logic","of","decorator","Here","is","how","those","arguments","works",":",":","@","out_decorator","(","*","dec_args",",","*","dec_kwargs",")","def","func","(","*","wrap_args",",","*","*","wrap_kwargs",")",":","...","And","in","the","``","wrapper","``",",","we","simply","create","``","self.target","``","instance","via","``","with","``",":",":","target","=","self.get_target","(","*","args",",","*","*","kwargs",")","with","target","(","*","dec_args",",","*","*","dec_kwargs",")","as","obj",":","..."]
code: def __call__(self, *dec_args, **dec_kwargs):
      """
      The main logic of decorator
  
      Here is how those arguments works::
  
          @out_decorator(*dec_args, *dec_kwargs)
          def func(*wrap_args, **wrap_kwargs):
              ...
  
      And in the ``wrapper``, we simply create ``self.target`` instance via
      ``with``::
  
          target = self.get_target(*args, **kwargs)
          with target(*dec_args, **dec_kwargs) as obj:
              ...
  
      """
      kw_name, dec_args, dec_kwargs = self.process_decorator_args(
          *dec_args, **dec_kwargs
      )
  
      def decorator(func):
          @wraps(func)
          def wrapper(*args, **kwargs):
              target = self.get_target(*args, **kwargs)
  
              with target(*dec_args, **dec_kwargs) as obj:
                  # insert our object into args
                  if kw_name and kw_name not in kwargs:
                      kwargs[kw_name] = obj
                  elif kw_name and kw_name in kwargs:
                      raise TypeError(
                          "{}() got multiple values for"
                          " argument '{}'".format(
                              func.__name__, kw_name
                          )
                      )
                  else:
                      args = args + (obj,)
  
                  return func(*args, **kwargs)
  
          return wrapper
  
      return decorator
  
file_path: catboost/contrib/python/pyzmq/py3/zmq/decorators.py
imports: from functools import wraps
  import zmq
label_desc: Use image node_id 2 for calling the _Decorator obj's underlying member method code with example usage: obj.__call__() and returns: decorator, wrapper, func