Skip to content

Commit 49f47f1

Browse files
authored
fix: typing (#2334)
## Issue Link / Problem Description <!-- Link to related issue or describe the problem this PR solves --> - Fixes typing
1 parent 07655ff commit 49f47f1

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

src/ragas/backends/utils.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,20 @@
11
"""Shared utilities for project module."""
22

3+
from __future__ import annotations
4+
35
import random
46
import string
7+
import typing as t
58
import uuid
69

710

8-
def create_nano_id(size=12):
11+
def create_nano_id(size: int = 12) -> str:
912
"""Create a short, URL-safe unique identifier."""
1013
# Define characters to use (alphanumeric)
1114
alphabet = string.ascii_letters + string.digits
1215

1316
# Generate UUID and convert to int
14-
uuid_int = uuid.uuid4().int
17+
uuid_int = t.cast(int, uuid.uuid4().int)
1518

1619
# Convert to base62
1720
result = ""

src/ragas/utils.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -621,13 +621,13 @@ def find_git_root(start_path: t.Union[str, Path, None] = None) -> Path:
621621
raise ValueError(f"No git repository found in or above {start_path}")
622622

623623

624-
def create_nano_id(size=12):
624+
def create_nano_id(size: int = 12) -> str:
625625
"""Generate a short unique identifier."""
626626
# Define characters to use (alphanumeric)
627627
alphabet = string.ascii_letters + string.digits
628628

629629
# Generate UUID and convert to int
630-
uuid_int = uuid.uuid4().int
630+
uuid_int = t.cast(int, uuid.uuid4().int)
631631

632632
# Convert to base62
633633
result = ""

0 commit comments

Comments
 (0)