def __init__(self, uri, *args, **kwargs):
        """
        Initialize the decorator instance

        :param uri: URI Stack-In-A-Box will use to recognize the HTTP calls
            f.e 'localhost'.
        :param text_type access_services: name of a keyword parameter in the
            test function to assign access to the services created in the
            arguments to the decorator.
        :param args: A tuple containing all the positional arguments. Any
            StackInABoxService arguments are removed before being passed to
            the actual function.
        :param kwargs: A dictionary of keyword args that are passed to the
            actual function.
        """
        self.uri = uri
        self.services = {}
        self.args = []
        self.kwargs = kwargs

        if "access_services" in self.kwargs:
            self.enable_service_access = self.kwargs["access_services"]
            del self.kwargs["access_services"]
        else:
            self.enable_service_access = None

        def process_service(arg_based_service, raise_on_type=True):
            if isinstance(arg_based_service, StackInABoxService):
                logger.debug("Registering {0}".format(arg_based_service.name))
                self.services[arg_based_service.name] = arg_based_service
                return True
            elif raise_on_type:
                raise TypeError(
                    "Generator or Iterable must provide a "
                    "StackInABoxService in all of its results."
                )
            return False

        for arg in args:
            if process_service(arg, raise_on_type=False):
                pass
            elif (
                isinstance(arg, types.GeneratorType) or
                isinstance(arg, collections.Iterable)
            ):
                for sub_arg in arg:
                    process_service(sub_arg, raise_on_type=True)
            else:
                self.args.append(arg)
def __init__ ( self , uri , * args , ** kwargs ) : self . uri = uri self . services = { } self . args = [ ] self . kwargs = kwargs if "access_services" in self . kwargs : self . enable_service_access = self . kwargs [ "access_services" ] del self . kwargs [ "access_services" ] else : self . enable_service_access = None def process_service ( arg_based_service , raise_on_type = True ) : if isinstance ( arg_based_service , StackInABoxService ) : logger . debug ( "Registering {0}" . format ( arg_based_service . name ) ) self . services [ arg_based_service . name ] = arg_based_service return True elif raise_on_type : raise TypeError ( "Generator or Iterable must provide a " "StackInABoxService in all of its results." ) return False for arg in args : if process_service ( arg , raise_on_type = False ) : pass elif ( isinstance ( arg , types . GeneratorType ) or isinstance ( arg , collections . Iterable ) ) : for sub_arg in arg : process_service ( sub_arg , raise_on_type = True ) else : self . args . append ( arg )
Initialize the decorator instance

        :param uri: URI Stack-In-A-Box will use to recognize the HTTP calls
            f.e 'localhost'.
        :param text_type access_services: name of a keyword parameter in the
            test function to assign access to the services created in the
            arguments to the decorator.
        :param args: A tuple containing all the positional arguments. Any
            StackInABoxService arguments are removed before being passed to
            the actual function.
        :param kwargs: A dictionary of keyword args that are passed to the
            actual function.