Skip to content

Commit 42470a6

Browse files
committed
Standardize code style across pagination implementation
- Make TYPE_CHECKING comments consistent across all files - Remove redundant comments about circular imports - Maintain consistent formatting and documentation style
1 parent a946c8e commit 42470a6

File tree

5 files changed

+9
-14
lines changed

5 files changed

+9
-14
lines changed

fitbit_client/resources/activity.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,9 @@
2323
from fitbit_client.utils.types import JSONList
2424
from fitbit_client.utils.types import ParamDict
2525

26-
# We use TYPE_CHECKING to avoid circular imports at runtime.
27-
# PaginatedIterator is only needed for type annotations, not for runtime code.
28-
# This pattern is recommended by the Python typing documentation:
29-
# https://docs.python.org/3/library/typing.html#typing.TYPE_CHECKING
26+
# Use TYPE_CHECKING to avoid circular imports
3027
if TYPE_CHECKING:
3128
# Local imports - only imported during type checking
32-
# Local imports
3329
from fitbit_client.resources.pagination import PaginatedIterator
3430

3531

@@ -271,7 +267,6 @@ def get_activity_log_list(
271267
return cast(JSONDict, result)
272268

273269
# Return as iterator if requested
274-
# We use string literal type annotation 'PaginatedIterator' to avoid circular imports
275270
if as_iterator:
276271
return create_paginated_iterator(
277272
response=cast(JSONDict, result),

fitbit_client/resources/electrocardiogram.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,9 @@
1717
from fitbit_client.utils.types import JSONDict
1818
from fitbit_client.utils.types import ParamDict
1919

20+
# Use TYPE_CHECKING to avoid circular imports
2021
if TYPE_CHECKING:
21-
# Local imports
22+
# Local imports - only imported during type checking
2223
from fitbit_client.resources.pagination import PaginatedIterator
2324

2425

@@ -128,7 +129,6 @@ def get_ecg_log_list(
128129
return cast(JSONDict, result)
129130

130131
# Return as iterator if requested
131-
# We use TYPE_CHECKING for PaginatedIterator type to avoid circular imports
132132
if as_iterator:
133133
return create_paginated_iterator(
134134
response=cast(JSONDict, result),

fitbit_client/resources/irregular_rhythm_notifications.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,9 @@
1515
from fitbit_client.utils.types import JSONDict
1616
from fitbit_client.utils.types import ParamDict
1717

18+
# Use TYPE_CHECKING to avoid circular imports
1819
if TYPE_CHECKING:
19-
# Local imports
20+
# Local imports - only imported during type checking
2021
from fitbit_client.resources.pagination import PaginatedIterator
2122

2223

@@ -129,7 +130,6 @@ def get_irn_alerts_list(
129130
return cast(JSONDict, result)
130131

131132
# Return as iterator if requested
132-
# We use TYPE_CHECKING for PaginatedIterator type to avoid circular imports
133133
if as_iterator:
134134
return create_paginated_iterator(
135135
response=cast(JSONDict, result),

fitbit_client/resources/pagination.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@
1717
# Set up logging
1818
logger = logging.getLogger(__name__)
1919

20-
# Avoid circular imports
20+
# Use TYPE_CHECKING to avoid circular imports
2121
if TYPE_CHECKING:
22-
# Local imports
22+
# Local imports - only imported during type checking
2323
from fitbit_client.resources.base import BaseResource
2424

2525

fitbit_client/resources/sleep.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,9 @@
1919
from fitbit_client.utils.types import JSONDict
2020
from fitbit_client.utils.types import ParamDict
2121

22+
# Use TYPE_CHECKING to avoid circular imports
2223
if TYPE_CHECKING:
23-
# Local imports
24+
# Local imports - only imported during type checking
2425
from fitbit_client.resources.pagination import PaginatedIterator
2526

2627

@@ -391,7 +392,6 @@ def get_sleep_log_list(
391392
return cast(JSONDict, result)
392393

393394
# Return as iterator if requested
394-
# We use TYPE_CHECKING for PaginatedIterator type to avoid circular imports
395395
if as_iterator:
396396
return create_paginated_iterator(
397397
response=cast(JSONDict, result),

0 commit comments

Comments
 (0)