mirror of
https://github.com/zama-ai/concrete.git
synced 2026-02-08 19:44:57 -05:00
dev: remove unique_id system, not needed for now
- wrong assumption when reading hnp's code, for now unique ids are not needed
This commit is contained in:
@@ -1,2 +1,2 @@
|
||||
"""HDK's top import"""
|
||||
from . import common, utils
|
||||
from . import common
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
"""HDK's utils module"""
|
||||
from . import misc
|
||||
from .misc import *
|
||||
@@ -1,18 +0,0 @@
|
||||
"""Misc. utils for hdk"""
|
||||
from typing import Iterator
|
||||
|
||||
|
||||
def get_unique_id() -> int:
|
||||
"""Function to get a unique ID"""
|
||||
|
||||
if not hasattr(get_unique_id, "generator"):
|
||||
|
||||
def generator() -> Iterator[int]:
|
||||
current_id = 0
|
||||
while True:
|
||||
yield current_id
|
||||
current_id += 1
|
||||
|
||||
setattr(get_unique_id, "generator", generator())
|
||||
|
||||
return next(getattr(get_unique_id, "generator"))
|
||||
@@ -1,17 +0,0 @@
|
||||
"""Test file for HDK's misc utils"""
|
||||
import random
|
||||
|
||||
import hdk
|
||||
|
||||
|
||||
def test_get_unique_id():
|
||||
"""Test get_unique_id"""
|
||||
how_many_ids = random.randint(2, 100)
|
||||
generated_ids = [hdk.utils.get_unique_id() for __ in range(how_many_ids)]
|
||||
|
||||
len_generated_ids = len(generated_ids)
|
||||
len_unique_ids = len(set(generated_ids))
|
||||
|
||||
assert (
|
||||
len_generated_ids == len_unique_ids
|
||||
), f"Expected to have uniques ids, generated {len_generated_ids}, only had {len_unique_ids}"
|
||||
Reference in New Issue
Block a user