Skip to content

File tree

3 files changed

+61
-15
lines changed

3 files changed

+61
-15
lines changed

.github/workflows/test_precommit.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ jobs:
4545
- name: Check style with black
4646
run: |
4747
source venv/bin/activate
48-
black --check .
48+
black --extend-exclude model_api/python/openvino/__init__.py --check .
4949
- name: Check style with isort
5050
run: |
5151
source venv/bin/activate

.isort.cfg

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
[settings]
2-
profile = black
2+
profile = black
3+
extend_skip = model_api/python/openvino/__init__.py

model_api/python/openvino/__init__.py

+58-13
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,62 @@
1-
"""
2-
Copyright (C) 2021-2023 Intel Corporation
1+
# -*- coding: utf-8 -*-
2+
# Copyright (C) 2018-2023 Intel Corporation
3+
# SPDX-License-Identifier: Apache-2.0
34

4-
Licensed under the Apache License, Version 2.0 (the "License");
5-
you may not use this file except in compliance with the License.
6-
You may obtain a copy of the License at
5+
__path__ = __import__("pkgutil").extend_path(__path__, __name__)
76

8-
http://www.apache.org/licenses/LICENSE-2.0
7+
# Required for Windows OS platforms
8+
# Note: always top-level
9+
try:
10+
from openvino.utils import _add_openvino_libs_to_search_path
11+
_add_openvino_libs_to_search_path()
12+
except ImportError:
13+
pass
914

10-
Unless required by applicable law or agreed to in writing, software
11-
distributed under the License is distributed on an "AS IS" BASIS,
12-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13-
See the License for the specific language governing permissions and
14-
limitations under the License.
15-
"""
15+
# API 2.0
16+
try:
17+
# Import all public modules
18+
from openvino import runtime as runtime
19+
from openvino import frontend as frontend
20+
from openvino import helpers as helpers
21+
from openvino import preprocess as preprocess
22+
from openvino import utils as utils
23+
from openvino.runtime import properties as properties
1624

17-
__path__ = __import__("pkgutil").extend_path(__path__, __name__)
25+
# Import most important classes and functions from openvino.runtime
26+
from openvino.runtime import Model
27+
from openvino.runtime import Core
28+
from openvino.runtime import CompiledModel
29+
from openvino.runtime import InferRequest
30+
from openvino.runtime import AsyncInferQueue
31+
32+
from openvino.runtime import Dimension
33+
from openvino.runtime import Strides
34+
from openvino.runtime import PartialShape
35+
from openvino.runtime import Shape
36+
from openvino.runtime import Layout
37+
from openvino.runtime import Type
38+
from openvino.runtime import Tensor
39+
from openvino.runtime import OVAny
40+
41+
from openvino.runtime import compile_model
42+
from openvino.runtime import get_batch
43+
from openvino.runtime import set_batch
44+
from openvino.runtime import serialize
45+
from openvino.runtime import shutdown
46+
from openvino.runtime import tensor_from_file
47+
from openvino.runtime import save_model
48+
from openvino.runtime import layout_helpers
49+
50+
# Set version for openvino package
51+
from openvino.runtime import get_version
52+
__version__ = get_version()
53+
except ImportError:
54+
import warnings
55+
warnings.warn("openvino package has problems with imports!", ImportWarning, stacklevel=2)
56+
57+
# Tools
58+
try:
59+
# Model Conversion API - ovc should reside in the main namespace
60+
from openvino.tools.ovc import convert_model
61+
except ImportError:
62+
pass

0 commit comments

Comments
 (0)