Source code for plaid.containers.feature_identifier
"""Feature identifier class for PLAID containers."""# -*- coding: utf-8 -*-## This file is subject to the terms and conditions defined in# file 'LICENSE.txt', which is part of this source code package.##fromtypingimportUnion
[docs]classFeatureIdentifier(dict[str,Union[str,float]]):"""Feature identifier for a specific feature."""def__init__(self,*args,**kwargs)->None:returnsuper().__init__(*args,**kwargs)def__hash__(self)->int:# pyright: ignore[reportIncompatibleVariableOverride]"""Compute a hash for the feature identifier. Returns: int: The hash value. """returnhash(frozenset(sorted(self.items())))# return hash(tuple(sorted(self.items())))def__lt__(self,other:"FeatureIdentifier")->bool:"""Compare two feature identifiers for ordering. Args: other (FeatureIdentifier): The other feature identifier to compare against. Returns: bool: True if this feature identifier is less than the other, False otherwise. """returnsorted(self.items())<sorted(other.items())