src.pydasa.structs.tables.htme ============================== .. py:module:: src.pydasa.structs.tables.htme .. autoapi-nested-parse:: Module htme.py =========================================== Module to represent the **MapEntry** data structure for the **Hash Table** in *PyDASA*. classes: **MapEntry**: Represents a key-value pair in a hash table with type validation and error handling. *IMPORTANT:* based on the implementations proposed by the following authors/books: # . Algorithms, 4th Edition, Robert Sedgewick and Kevin Wayne. # . Data Structure and Algorithms in Python, M.T. Goodrich, R. Tamassia, M.H. Goldwasser. Classes ------- .. autoapisummary:: src.pydasa.structs.tables.htme.MapEntry Module Contents --------------- .. py:class:: MapEntry Bases: :py:obj:`Generic`\ [\ :py:obj:`pydasa.structs.types.generics.T`\ ] **MapEntry** class for creating a map entry in the **Hash Table**. Fundamental for the **Hash Table** data structure. :param Generic: Generic type for a Python data structure. :type Generic: T :returns: A map entry object with the following attributes: - `_key`: The key of the map entry. - `_value`: The value of the map entry. :rtype: MapEntry .. py:attribute:: _key :type: Optional[pydasa.structs.types.generics.T] :value: None Es la llave del registro del mapa. .. py:attribute:: _value :type: Optional[pydasa.structs.types.generics.T] :value: None Es el valor del registro del mapa. .. py:method:: _error_handler(err) *_error_handler()* to process the context (package/class), function name (method), and the error (exception) that was raised to format a detailed error message and traceback. :param err: Python raised exception. :type err: Exception .. py:method:: _validate_key_type(key) *_validate_key_type()* checks if the type of the key is the same as the type of the *MapEntry*. :param key: _key to process in the *MapEntry*. :type key: T :raises TypeError: error if the type of the key to be added is not the same as the type of the keys already contained in the *MapEntry*. :returns: True if the type of the key is the same as the type of the *MapEntry*. :rtype: bool .. py:method:: _validate_value_type(value) *_validate_value_type()* checks if the type of the value is the same as the type of the *MapEntry*. :param value: value to process in the *MapEntry*. :type value: T :raises TypeError: error if the type of the value to be added is not the same as the type of the values already contained in the *MapEntry*. :returns: True if the type of the value is the same as the type of the *MapEntry*. :rtype: bool .. py:property:: key :type: Optional[pydasa.structs.types.generics.T] *key* Property to read the key in the *MapEntry*. Acts as a getter (*get()*) for the *_key* attribute. :returns: recovered key in the *MapEntry*. None if the key is not set. :rtype: Optional[T] .. py:property:: value :type: Optional[pydasa.structs.types.generics.T] *value* Property to read the value in the *MapEntry*. Acts as a getter (*get()*) for the *_value* attribute. :returns: recovered value in the *MapEntry*. None if the value is not set. :rtype: Optional[T]