Skip to content

Commit 3917300

Browse files
committed
prefer code style from modern python 3.14+
1 parent dd0826a commit 3917300

File tree

15 files changed

+88
-21
lines changed

15 files changed

+88
-21
lines changed

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ dev = [
3939

4040
# ruff configuration
4141
[tool.ruff]
42-
target-version = "py313"
42+
target-version = "py314"
4343
line-length = 120
4444

4545
[tool.ruff.lint]

src/bubble_data_api_client/client/client.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,13 @@
11
"""High-level client with data validation and transformation."""
22

3+
from __future__ import annotations
4+
5+
from typing import TYPE_CHECKING
6+
37
from pydantic import BaseModel, Field
48

5-
from bubble_data_api_client.client.raw_client import RawClient
9+
if TYPE_CHECKING:
10+
from bubble_data_api_client.client.raw_client import RawClient
611

712

813
class BubbleResponseFields(BaseModel):

src/bubble_data_api_client/client/orm.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,15 @@ class User(BubbleModel, typename="user"):
1414
await user.delete()
1515
"""
1616

17+
from __future__ import annotations
18+
1719
import http
1820
import typing
19-
from collections.abc import AsyncIterator
2021
from datetime import datetime
22+
from typing import TYPE_CHECKING
23+
24+
if TYPE_CHECKING:
25+
from collections.abc import AsyncIterator
2126

2227
from pydantic import BaseModel as PydanticBaseModel
2328
from pydantic import Field

src/bubble_data_api_client/client/raw_client.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,18 @@
44
For most use cases, prefer BubbleModel which provides a higher-level interface.
55
"""
66

7+
from __future__ import annotations
8+
79
import asyncio
810
import http
911
import json
10-
import types
1112
import typing
13+
from typing import TYPE_CHECKING
14+
15+
if TYPE_CHECKING:
16+
import types
1217

13-
import httpx
18+
import httpx
1419

1520
from bubble_data_api_client.constraints import Constraint, ConstraintType, constraint
1621
from bubble_data_api_client.exceptions import (

src/bubble_data_api_client/config.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,19 @@
99
set_config_provider(lambda: get_config_for_current_user())
1010
"""
1111

12+
from __future__ import annotations
13+
1214
import sys
1315
from collections.abc import Callable
14-
from typing import NotRequired, TypedDict
16+
from typing import TYPE_CHECKING, NotRequired, TypedDict
1517

1618
if sys.version_info >= (3, 13): # noqa: UP036
1719
from typing import TypeIs
1820
else:
19-
from typing_extensions import TypeIs # noqa: UP035
21+
from typing_extensions import TypeIs # noqa: UP035, TC002
2022

21-
import tenacity
23+
if TYPE_CHECKING:
24+
import tenacity
2225

2326

2427
class _NotSet:

src/bubble_data_api_client/exceptions.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
11
"""Exception types for Bubble Data API errors."""
22

3+
from __future__ import annotations
4+
35
import typing
6+
from typing import TYPE_CHECKING
47

5-
import httpx
8+
if TYPE_CHECKING:
9+
import httpx
610

711

812
class BubbleError(Exception):

src/bubble_data_api_client/pool.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,16 @@
11
"""Client pool for efficient connection reuse."""
22

3+
from __future__ import annotations
4+
35
import asyncio
46
import atexit
57
import threading
68
import weakref
7-
from collections.abc import AsyncIterator
89
from contextlib import asynccontextmanager
10+
from typing import TYPE_CHECKING
11+
12+
if TYPE_CHECKING:
13+
from collections.abc import AsyncIterator
914

1015
import httpx
1116

src/bubble_data_api_client/transport.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,15 @@
11
"""HTTP transport layer for Bubble Data API requests."""
22

3-
import types
3+
from __future__ import annotations
4+
45
import typing
6+
from typing import TYPE_CHECKING
57

68
import httpx
79

10+
if TYPE_CHECKING:
11+
import types
12+
813
from bubble_data_api_client.config import get_config
914
from bubble_data_api_client.exceptions import BubbleAPIError
1015
from bubble_data_api_client.pool import get_client

src/bubble_data_api_client/validation.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
11
"""Validation utilities for Bubble platform data."""
22

3+
from __future__ import annotations
4+
35
import re
4-
from collections.abc import Iterable
5-
from typing import Any
6+
from typing import TYPE_CHECKING, Any
7+
8+
if TYPE_CHECKING:
9+
from collections.abc import Iterable
610

711
_BUBBLE_UID_PATTERN: re.Pattern[str] = re.compile(r"^[0-9]+x[0-9]+$")
812

src/tests/conftest.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
1-
from collections.abc import AsyncGenerator
1+
from __future__ import annotations
2+
3+
from typing import TYPE_CHECKING
24

35
import pytest
46

7+
if TYPE_CHECKING:
8+
from collections.abc import AsyncGenerator
9+
510
from bubble_data_api_client import configure
611
from bubble_data_api_client.pool import close_clients
712

0 commit comments

Comments
 (0)