def _remove_prefix_path()

in codeguru_profiler_agent/sdk_reporter/profile_encoder.py [0:0]


def _remove_prefix_path(module_path, sys_paths):
    if "/./" in module_path and platform.system() != "Windows":
        module_path = module_path.replace("/./", "/")
        current_path = str(Path().absolute())
        if current_path != "/": # this may be Fargate
            return module_path.replace(current_path, "")
        return module_path

    for root in sys_paths:
        if root in module_path:
            return module_path.replace(root, "")

    return module_path