Skip to content

Commit

Permalink
Merge pull request #494 from sanders41/bugbear
Browse files Browse the repository at this point in the history
Add stacklevel to depreciation warnings
  • Loading branch information
sanders41 committed Apr 20, 2024
2 parents c3e2862 + 91f92f4 commit bd776d6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
7 changes: 5 additions & 2 deletions camel_converter/pydantic_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@

try:
import pydantic # type: ignore
except ImportError:
raise ImportError("camel-converter must be installed with the pydantic extra to use this class")
except ImportError as e:
raise ImportError(
"camel-converter must be installed with the pydantic extra to use this class"
) from e

from camel_converter import to_camel

Expand All @@ -24,6 +26,7 @@ class CamelBase(pydantic.BaseModel):
warn(
"The use of Pydantic less than version 2 is depreciated and will be removed in a future release",
DeprecationWarning,
stacklevel=2,
)

# Raise an AttributeError to match the AttributeError on __version__ because in either
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ fix = true
target-version = "py38"

[tool.ruff.lint]
select=["E", "F", "T201", "T203", "I001", "UP"]
select=["E", "B", "F", "T201", "T203", "I001", "UP"]
ignore=[
# Recommened ignores by ruff when using formatter
"E501",
Expand Down

0 comments on commit bd776d6

Please sign in to comment.