cmph/__init__.py
def lookup(self, key):
        """
        Generate hash code for a key from the Minimal Perfect Hash (MPH)

        Parameters
        ----------
        Key : object
            The item to generate a key for, this works best for keys that
            are strings, or can be transformed fairly directly into bytes

        Returns : int
            The code for the given item

        """
        assert self._mph
        key = convert_to_bytes(key)
        box = ffi.new('char[]', key)
        try:
            result = _cmph.cmph_search(self._mph, box, len(key))
            return result
        finally:
            del box
def lookup(self, key):
        """
        Generate hash code for a key from the Minimal Perfect Hash (MPH)

        Parameters
        ----------
        Key : object
            The item to generate a key for, this works best for keys that
            are strings, or can be transformed fairly directly into bytes

        Returns : int
            The code for the given item

        """
        assert self._mph
        key = convert_to_bytes(key)
        box = ffi.new('char[]', key)
        try:
            result = _cmph.cmph_search(self._mph, box, len(key))
            return result
        finally:
            del box
Generate hash code for a key from the Minimal Perfect Hash (MPH)

        Parameters
        ----------
        Key : object
            The item to generate a key for, this works best for keys that
            are strings, or can be transformed fairly directly into bytes

        Returns : int
            The code for the given item