Skip to content

Commit ac15151

Browse files
authored
chore: update pre-commit config and fix lint errors (#5511)
Signed-off-by: Frost Ming <[email protected]>
1 parent 28870f0 commit ac15151

File tree

8 files changed

+33
-26
lines changed

8 files changed

+33
-26
lines changed

.pre-commit-config.yaml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,11 @@ repos:
1010
- repo: https://github.com/astral-sh/ruff-pre-commit
1111
rev: 'v0.14.3'
1212
hooks:
13-
- id: ruff
13+
- id: ruff-check
1414
args: [--fix, --exit-non-zero-on-fix, --show-fixes]
1515
types_or: [python, pyi]
1616
- id: ruff-format
1717
types_or: [python, pyi]
18-
files: '(src|tests|docs|examples|typings)/'
1918
- repo: https://github.com/pre-commit/pre-commit-hooks
2019
rev: v6.0.0
2120
hooks:

pyproject.toml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,13 @@ testpaths = ["tests"]
232232
# similar to black's
233233
line-length = 88
234234
target-version = "py310"
235+
extend-exclude = [
236+
"docs/**/*.py",
237+
"**/*_grpc.py",
238+
"**/*_pb2.py",
239+
"**/*_grpc.pyi",
240+
"**/*_pb2.pyi",
241+
]
235242

236243
[tool.ruff.lint]
237244
# We ignore E501 (line too long) here because we keep user-visible strings on one line.

src/_bentoml_impl/frameworks/catboost.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ def load_model(bento_model: str | Tag | bentoml.Model) -> cb.CatBoost:
6464
import bentoml
6565
# target model must be from the BentoML model store
6666
booster = bentoml.catboost.load_model("my_catboost_model")
67-
""" # noqa: LN001
67+
"""
6868
if not isinstance(bento_model, bentoml.Model):
6969
bento_model = bentoml.models.get(bento_model)
7070

src/_bentoml_impl/frameworks/xgboost.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ def load_model(bento_model: str | Tag | bentoml.Model) -> xgb.Booster | xgb.XGBM
7575
import bentoml
7676
# target model must be from the BentoML model store
7777
booster = bentoml.xgboost.load_model("my_xgboost_model")
78-
""" # noqa: LN001
78+
"""
7979
if not isinstance(bento_model, bentoml.Model):
8080
bento_model = bentoml.models.get(bento_model)
8181
assert isinstance(bento_model, bentoml.Model)
@@ -179,7 +179,7 @@ def save_model(
179179
180180
# `save` the booster to BentoML modelstore:
181181
bento_model = bentoml.xgboost.save_model("my_xgboost_model", bst, booster_params=param)
182-
""" # noqa: LN001
182+
"""
183183
if isinstance(model, xgb.Booster):
184184
model_class = "Booster"
185185
elif isinstance(model, XGBModel):

src/bentoml/grpc/interceptors/opentelemetry.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@ async def new_behaviour(
266266
except Exception as e:
267267
# We are interested in uncaught exception, otherwise
268268
# it will be handled by gRPC.
269-
if type(e) != Exception:
269+
if type(e) is not Exception:
270270
span.record_exception(e)
271271
raise e
272272

src/bentoml/grpc/types.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
"""
33
Specific types for BentoService gRPC server.
44
"""
5+
56
from __future__ import annotations
67

78
from typing import TYPE_CHECKING

typings/tritonclient/grpc/__init__.pyi

Lines changed: 9 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

typings/tritonclient/grpc/aio/__init__.pyi

Lines changed: 11 additions & 11 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)