Skip to content

Commit 3e04c65

Browse files
authored
fix: replace unused pydantic import with importlib.util.find_spec (#1343)
* fix: replace unused pydantic import with importlib.util.find_spec Silences ruff F401 that was failing the pre-commit CI.
1 parent 4ea10a7 commit 3e04c65

2 files changed

Lines changed: 4 additions & 7 deletions

File tree

integration_tests/test_pydantic.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,13 @@
1+
import importlib.util
2+
13
import pytest
24
import requests
35

46
from integration_tests.helpers.http_methods_helpers import json_post
57

68
BASE_URL = "http://127.0.0.1:8080"
79

8-
try:
9-
import pydantic
10-
11-
_HAS_PYDANTIC = True
12-
except ImportError:
13-
_HAS_PYDANTIC = False
10+
_HAS_PYDANTIC = importlib.util.find_spec("pydantic") is not None
1411

1512
pytestmark = pytest.mark.skipif(not _HAS_PYDANTIC, reason="pydantic not installed")
1613

robyn/openapi.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@
99
from pathlib import Path
1010
from typing import Any, Callable, Dict, List, Optional, Tuple, TypedDict, is_typeddict
1111

12+
from robyn.pydantic_support import get_pydantic_openapi_schema, is_pydantic_model
1213
from robyn.responses import html
1314
from robyn.robyn import QueryParams, Response
14-
from robyn.pydantic_support import get_pydantic_openapi_schema, is_pydantic_model
1515
from robyn.types import Body, JsonBody
1616

1717
_logger = logging.getLogger(__name__)

0 commit comments

Comments
 (0)