Coverage for /opt/cloud/slavespace/usr1/096471637100f3de0fcfc01072822a80/dttest/api/python/ge/ge/onnx_plugin/bootstrap.py: 100%

6 statements  

« prev     ^ index     » next       coverage.py v7.15.4, created at 2026-08-18 20:50 +0800

1#!/usr/bin/env python3 

2# -*- coding: utf-8 -*- 

3# ----------------------------------------------------------------------------------------------------------- 

4# Copyright (c) 2026 Huawei Technologies Co., Ltd. 

5# This program is free software, you can redistribute it and/or modify it under the terms and conditions of 

6# CANN Open Software License Agreement Version 2.0 (the "License"). 

7# Please refer to the License for details. You may not use this file except in compliance with the License. 

8# THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED, 

9# INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE. 

10# See LICENSE in the root of the software repository for the full text of the License. 

11# ----------------------------------------------------------------------------------------------------------- 

12 

13"""Discovery and loading utilities for Python ONNX Plugins.""" 

14 

15from types import ModuleType 

16from typing import List 

17 

18from ge._internal.plugin_loader import load_plugins_from_env 

19 

20 

21ENV_PY_ONNX_PLUGIN_PATH = "ASCEND_CUSTOM_OPP_PATH" 

22 

23 

24def load_onnx_plugins() -> List[ModuleType]: 

25 """Load ONNX Plugins from the shared custom OPP path list.""" 

26 

27 return load_plugins_from_env( 

28 ENV_PY_ONNX_PLUGIN_PATH, 

29 module_prefix="_ge_py_onnx_plugin_", 

30 plugin_kind="python ONNX Plugin", 

31 )