How to use the omniduct.duct.Duct.for_protocol function in omniduct

To help you get started, we’ve selected a few omniduct examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github airbnb / omniduct / omniduct / registry.py View on Github external
aliases are to be used, names should be a comma separated list.
                See `.register` for more details.
            protocol (str): The protocol of the new service.
            override (bool): Whether to override any existing `Duct` instance
                of the same name. If `False`, any overrides will result in an
                exception.
            register_magics (bool): Whether to register the magics if running in
                and IPython session (default: `True`).
            **kwargs (dict): Additional arguments to pass to the constructor of
                the class associated with the nominated protocol.

        Returns:
            Duct: The `Duct` instance registered into the registry.
        """
        return self.register(
            Duct.for_protocol(protocol)(
                name=name.split(',')[0].strip(),
                registry=self,
                **kwargs
            ),
            name=name,
            override=override,
            register_magics=register_magics
        )