Skip to content

Commit 955118b

Browse files
Add ruff (#215)
* add ruff Signed-off-by: Ashwin Vaidya <[email protected]> * remove black from pre-commit tests Signed-off-by: Ashwin Vaidya <[email protected]> * ignore unused import for tests Signed-off-by: Ashwin Vaidya <[email protected]> * add annotations Signed-off-by: Ashwin Vaidya <[email protected]> * remove strict Signed-off-by: Ashwin Vaidya <[email protected]> * pre-commit after merge Signed-off-by: Ashwin Vaidya <[email protected]> --------- Signed-off-by: Ashwin Vaidya <[email protected]>
1 parent d64d907 commit 955118b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+1286
-1182
lines changed

.github/workflows/test_precommit.yml

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -5,31 +5,6 @@ concurrency:
55
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
66
cancel-in-progress: true
77
jobs:
8-
Python-Code-Quality:
9-
runs-on: ubuntu-latest
10-
steps:
11-
- uses: actions/checkout@v3
12-
- uses: actions/setup-python@v4
13-
with:
14-
python-version: 3.9
15-
cache: pip
16-
- name: Create and start a virtual environment
17-
run: |
18-
python -m venv venv
19-
source venv/bin/activate
20-
- name: Install dependencies
21-
run: |
22-
source venv/bin/activate
23-
pip install --upgrade pip
24-
pip install isort black
25-
- name: Check style with black
26-
run: |
27-
source venv/bin/activate
28-
black --check .
29-
- name: Check style with isort
30-
run: |
31-
source venv/bin/activate
32-
isort --check .
338
Python-Precommit:
349
runs-on: ubuntu-latest
3510
steps:

.pre-commit-config.yaml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,16 @@ repos:
1313
- id: debug-statements
1414
- id: detect-private-key
1515

16+
# Ruff version.
17+
- repo: https://github.com/charliermarsh/ruff-pre-commit
18+
rev: "v0.6.2"
19+
hooks:
20+
# Run the linter.
21+
- id: ruff
22+
args: ["--fix"]
23+
# Run the formatter
24+
- id: ruff-format
25+
1626
- repo: https://github.com/pre-commit/mirrors-prettier
1727
rev: v4.0.0-alpha.8
1828
hooks:

docs/source/conf.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@
1515
# Insert the path to sys.path
1616
sys.path.insert(0, str(module_path.resolve()))
1717

18-
project = 'InferenceSDK'
19-
copyright = '2024, Intel OpenVINO'
20-
author = 'Intel OpenVINO'
21-
release = '2024'
18+
project = "InferenceSDK"
19+
copyright = "2024, Intel OpenVINO"
20+
author = "Intel OpenVINO"
21+
release = "2024"
2222

2323
# -- General configuration ---------------------------------------------------
2424
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration
@@ -33,15 +33,15 @@
3333
"sphinx.ext.napoleon",
3434
"sphinx_autodoc_typehints",
3535
"sphinx_copybutton",
36-
"sphinx.ext.graphviz"
36+
"sphinx.ext.graphviz",
3737
]
3838

3939
myst_enable_extensions = [
4040
"colon_fence",
4141
# other MyST extensions...
4242
]
4343

44-
templates_path = ['_templates']
44+
templates_path = ["_templates"]
4545
exclude_patterns = []
4646

4747
# Automatic exclusion of prompts from the copies
@@ -52,11 +52,11 @@
5252
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output
5353

5454
html_theme = "pydata_sphinx_theme"
55-
html_static_path = ['_static']
55+
html_static_path = ["_static"]
5656

57-
breathe_projects = {"InferenceSDK": Path(__file__).parent.parent/"build_cpp"/ "xml"}
57+
breathe_projects = {"InferenceSDK": Path(__file__).parent.parent / "build_cpp" / "xml"}
5858
breathe_default_project = "InferenceSDK"
59-
breathe_default_members = ('members', 'undoc-members', 'private-members')
59+
breathe_default_members = ("members", "undoc-members", "private-members")
6060

6161
autodoc_docstring_signature = True
6262
autodoc_member_order = "bysource"

examples/python/asynchronous_api/run.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
#!/usr/bin/env python3
22
"""
3-
Copyright (C) 2018-2022 Intel Corporation
3+
Copyright (C) 2018-2022 Intel Corporation
44
5-
Licensed under the Apache License, Version 2.0 (the "License");
6-
you may not use this file except in compliance with the License.
7-
You may obtain a copy of the License at
5+
Licensed under the Apache License, Version 2.0 (the "License");
6+
you may not use this file except in compliance with the License.
7+
You may obtain a copy of the License at
88
9-
http://www.apache.org/licenses/LICENSE-2.0
9+
http://www.apache.org/licenses/LICENSE-2.0
1010
11-
Unless required by applicable law or agreed to in writing, software
12-
distributed under the License is distributed on an "AS IS" BASIS,
13-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14-
See the License for the specific language governing permissions and
15-
limitations under the License.
11+
Unless required by applicable law or agreed to in writing, software
12+
distributed under the License is distributed on an "AS IS" BASIS,
13+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
See the License for the specific language governing permissions and
15+
limitations under the License.
1616
"""
1717

1818
import sys

examples/python/serving_api/run.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
#!/usr/bin/env python3
22
"""
3-
Copyright (C) 2018-2022 Intel Corporation
3+
Copyright (C) 2018-2022 Intel Corporation
44
5-
Licensed under the Apache License, Version 2.0 (the "License");
6-
you may not use this file except in compliance with the License.
7-
You may obtain a copy of the License at
5+
Licensed under the Apache License, Version 2.0 (the "License");
6+
you may not use this file except in compliance with the License.
7+
You may obtain a copy of the License at
88
9-
http://www.apache.org/licenses/LICENSE-2.0
9+
http://www.apache.org/licenses/LICENSE-2.0
1010
11-
Unless required by applicable law or agreed to in writing, software
12-
distributed under the License is distributed on an "AS IS" BASIS,
13-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14-
See the License for the specific language governing permissions and
15-
limitations under the License.
11+
Unless required by applicable law or agreed to in writing, software
12+
distributed under the License is distributed on an "AS IS" BASIS,
13+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
See the License for the specific language governing permissions and
15+
limitations under the License.
1616
"""
1717

1818
import sys

examples/python/synchronous_api/run.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
#!/usr/bin/env python3
22
"""
3-
Copyright (C) 2018-2022 Intel Corporation
3+
Copyright (C) 2018-2022 Intel Corporation
44
5-
Licensed under the Apache License, Version 2.0 (the "License");
6-
you may not use this file except in compliance with the License.
7-
You may obtain a copy of the License at
5+
Licensed under the Apache License, Version 2.0 (the "License");
6+
you may not use this file except in compliance with the License.
7+
You may obtain a copy of the License at
88
9-
http://www.apache.org/licenses/LICENSE-2.0
9+
http://www.apache.org/licenses/LICENSE-2.0
1010
11-
Unless required by applicable law or agreed to in writing, software
12-
distributed under the License is distributed on an "AS IS" BASIS,
13-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14-
See the License for the specific language governing permissions and
15-
limitations under the License.
11+
Unless required by applicable law or agreed to in writing, software
12+
distributed under the License is distributed on an "AS IS" BASIS,
13+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
See the License for the specific language governing permissions and
15+
limitations under the License.
1616
"""
1717

1818
import sys

examples/python/visual_prompting/run.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
#!/usr/bin/env python3
22
"""
3-
Copyright (C) 2024 Intel Corporation
3+
Copyright (C) 2024 Intel Corporation
44
5-
Licensed under the Apache License, Version 2.0 (the "License");
6-
you may not use this file except in compliance with the License.
7-
You may obtain a copy of the License at
5+
Licensed under the Apache License, Version 2.0 (the "License");
6+
you may not use this file except in compliance with the License.
7+
You may obtain a copy of the License at
88
9-
http://www.apache.org/licenses/LICENSE-2.0
9+
http://www.apache.org/licenses/LICENSE-2.0
1010
11-
Unless required by applicable law or agreed to in writing, software
12-
distributed under the License is distributed on an "AS IS" BASIS,
13-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14-
See the License for the specific language governing permissions and
15-
limitations under the License.
11+
Unless required by applicable law or agreed to in writing, software
12+
distributed under the License is distributed on an "AS IS" BASIS,
13+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
See the License for the specific language governing permissions and
15+
limitations under the License.
1616
"""
1717

1818
import argparse

examples/python/zsl_visual_prompting/run.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
#!/usr/bin/env python3
22
"""
3-
Copyright (C) 2024 Intel Corporation
3+
Copyright (C) 2024 Intel Corporation
44
5-
Licensed under the Apache License, Version 2.0 (the "License");
6-
you may not use this file except in compliance with the License.
7-
You may obtain a copy of the License at
5+
Licensed under the Apache License, Version 2.0 (the "License");
6+
you may not use this file except in compliance with the License.
7+
You may obtain a copy of the License at
88
9-
http://www.apache.org/licenses/LICENSE-2.0
9+
http://www.apache.org/licenses/LICENSE-2.0
1010
11-
Unless required by applicable law or agreed to in writing, software
12-
distributed under the License is distributed on an "AS IS" BASIS,
13-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14-
See the License for the specific language governing permissions and
15-
limitations under the License.
11+
Unless required by applicable law or agreed to in writing, software
12+
distributed under the License is distributed on an "AS IS" BASIS,
13+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
See the License for the specific language governing permissions and
15+
limitations under the License.
1616
"""
1717

1818
import argparse

model_api/python/model_api/adapters/__init__.py

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,16 @@
1-
"""
2-
Copyright (C) 2021-2024 Intel Corporation
1+
"""Copyright (C) 2021-2024 Intel Corporation
32
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
3+
Licensed under the Apache License, Version 2.0 (the "License");
4+
you may not use this file except in compliance with the License.
5+
You may obtain a copy of the License at
76
8-
http://www.apache.org/licenses/LICENSE-2.0
7+
http://www.apache.org/licenses/LICENSE-2.0
98
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.
9+
Unless required by applicable law or agreed to in writing, software
10+
distributed under the License is distributed on an "AS IS" BASIS,
11+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
See the License for the specific language governing permissions and
13+
limitations under the License.
1514
"""
1615

1716
from .onnx_adapter import ONNXRuntimeAdapter

0 commit comments

Comments
 (0)