Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/toon_format/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
the TOON implementation. Centralizes magic values for maintainability.
"""

from typing import TYPE_CHECKING
from typing import TYPE_CHECKING, Dict

if TYPE_CHECKING:
from .types import Delimiter
Expand Down Expand Up @@ -45,7 +45,7 @@
# endregion

# region Delimiters
DELIMITERS: dict[str, "Delimiter"] = {
DELIMITERS: Dict[str, "Delimiter"] = {
"comma": COMMA,
"tab": TAB,
"pipe": PIPE,
Expand Down
4 changes: 2 additions & 2 deletions src/toon_format/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

import functools
import json
from typing import Any
from typing import Any, Dict

# Import encode from parent package (defined in __init__.py before this module is imported)
# __init__.py defines encode() before importing utils, so this is safe
Expand Down Expand Up @@ -91,7 +91,7 @@ def count_tokens(text: str, encoding: str = "o200k_base") -> int:
return len(enc.encode(text))


def estimate_savings(data: Any, encoding: str = "o200k_base") -> dict[str, Any]:
def estimate_savings(data: Any, encoding: str = "o200k_base") -> Dict[str, Any]:
"""Compare token counts between JSON and TOON formats.

Args:
Expand Down
4 changes: 2 additions & 2 deletions src/toon_format/writer.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
indent string caching for performance.
"""

from typing import List
from typing import Dict, List

from .types import Depth

Expand All @@ -24,7 +24,7 @@ def __init__(self, indent_size: int) -> None:
# Ensure nested structures remain distinguishable even for indent=0
normalized_indent = indent_size if indent_size > 0 else 1
self._indentation_string = " " * normalized_indent
self._indent_cache: dict[int, str] = {0: ""}
self._indent_cache: Dict[int, str] = {0: ""}
self._indent_size = indent_size

def push(self, depth: Depth, content: str) -> None:
Expand Down
Loading