[docs]@dataclass(frozen=True,slots=True)classResourcePolicy:"""Bounds untrusted tensor-bearing records and their descriptors."""max_encoded_record_bytes:int=64*1024**3max_descriptor_bytes:int=16*1024**2max_fields:int=10_000max_axes_per_field:int=128max_coordinate_values:int=10_000_000max_tensor_bytes:int=16*1024**3max_total_tensor_bytes:int=64*1024**3max_metadata_bytes:int=16*1024**2max_json_depth:int=128max_json_nodes:int=1_000_000def__post_init__(self)->None:fornameinself.__dataclass_fields__:value=getattr(self,name)ifisinstance(value,bool)ornotisinstance(value,int)orvalue<0:raiseValueError(f"{name} must be a nonnegative integer")
[docs]@dataclass(frozen=True,slots=True)classControlPolicy:"""Bounds untrusted dataset roots, snapshots, manifests, and shard references."""max_document_bytes:int=64*1024**2max_json_depth:int=128max_json_nodes:int=1_000_000def__post_init__(self)->None:fornameinself.__dataclass_fields__:value=getattr(self,name)ifisinstance(value,bool)ornotisinstance(value,int)orvalue<1:raiseValueError(f"{name} must be a positive integer")