How to use the ciphey.iface._fwd.registry.get_named function in ciphey

To help you get started, weโ€™ve selected a few ciphey 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 brandonskerritt / Ciphey / ciphey / iface / _config.py View on Github external
def load_objs(self):
        # Basic type conversion
        if self.timeout is not None:
            self.objs["timeout"] = datetime.timedelta(seconds=int(self.timeout))
        self.objs["format"] = {
            key: pydoc.locate(value) for key, value in self.format.items()
        }

        # Checkers do not depend on anything
        self.objs["checker"] = self(_fwd.registry.get_named(self.checker, Checker))
        # Searchers only depend on checkers
        self.objs["searcher"] = self(_fwd.registry.get_named(self.searcher, Searcher))
github brandonskerritt / Ciphey / ciphey / iface / _config.py View on Github external
def get_resource(self, res_name: str, t: Optional[Type] = None) -> Any:
        logger.trace(f"Loading resource {res_name} of type {t}")

        # FIXME: Actually returns obj of type `t`, but python is bad
        loader, name = split_resource_name(res_name)
        if t is None:
            return self(_fwd.registry.get_named(loader, ResourceLoader))(name)
        else:
            return self(_fwd.registry.get_named(loader, ResourceLoader[t]))(name)