How to use the ttp.ttp.CachedModule function in ttp

To help you get started, we’ve selected a few ttp 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 dmulyalin / ttp / ttp / ttp.py View on Github external
break
            for target in assignment.targets:
                if target.id == "_name_map_":
                    _name_map_.update(
                        {
                            key.s: assignment.value.values[index].s
                            for index, key in enumerate(assignment.value.keys)
                        }
                    )
        # fill in _ttp_ dictionary with CachedModule class
        parent_path, filename = os.path.split(module_file.name)
        _, parent_dir = os.path.split(parent_path)
        for func_name in functions:
            name = _name_map_.get(func_name, func_name)
            path = "{}.{}".format(parent_dir, filename.replace(".py", ""))
            _ttp_.setdefault(parent_dir, {})[name] = CachedModule(
                path, parent_dir, name, functions
            )
        module_file.close()
    log.info("ttp.lazy_import_functions: finished functions lazy import")