Skip to content

Commit 0f731f1

Browse files
committed
refactor: move string_hash function to internal.py
The string_hash utility function was defined in context.py but belongs with other utility functions in internal.py. This improves code organization.
1 parent c0429ca commit 0f731f1

2 files changed

Lines changed: 10 additions & 8 deletions

File tree

oocana/oocana/context.py

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,21 +10,14 @@
1010
from .throttler import throttle
1111
from .preview import PreviewPayload, DataFrame, PreviewPayloadInternal, ShapeDataFrame
1212
from .data import EXECUTOR_NAME
13-
from .internal import random_string, InternalAPI
13+
from .internal import random_string, InternalAPI, string_hash
1414
from .credential import CredentialInput
1515
import os.path
1616
import logging
17-
import hashlib
1817

1918
__all__ = ["Context", "HandleDefDict", "BlockJob", "BlockExecuteException"]
2019

2120

22-
def string_hash(text: str) -> str:
23-
"""
24-
Generates a deterministic hash for a given string.
25-
"""
26-
return hashlib.sha256(text.encode('utf-8')).hexdigest()
27-
2821
class ToNode(TypedDict):
2922
node_id: str
3023

oocana/oocana/internal.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,15 @@
33
import random
44
import string
55
import math
6+
import hashlib
7+
8+
9+
def string_hash(text: str) -> str:
10+
"""
11+
Generates a deterministic hash for a given string.
12+
"""
13+
return hashlib.sha256(text.encode('utf-8')).hexdigest()
14+
615

716
class InternalAPI:
817

0 commit comments

Comments
 (0)