<commit_before>#!/usr/bin/env python


"""
Descriptor Examples
"""


__version__ = '0.0.0'


#=============================================================================
class class_style( object ):
    """
    Class Style Descriptor
    """

    #=========================================================================
    def __init__( self, name ):
        """
        Initializes a class_style descriptor object.
        """
        self.name = name

    #=========================================================================
    def __get__( self, obj, objtype = None ):
        """
        Getter
        """
        return obj.proxied[ self.name ]

    #=========================================================================
    def __set__( self, obj, value ):
        """
        Setter
        """
        obj.proxied[ self.name ] = value


#=============================================================================
class dict_proxy( object ):
    """
    Dictionary proxy descriptor.
    """

    #=========================================================================
    def __init__( self, dname, kname ):
        """
        Initializes a dict_proxy object.
        """
        super( dict_proxy, self ).__init__()
        self._dname = dname
        self._kname = kname


    #=========================================================================
    def __get__( self, obj, objtype = None ):
        """
        Retrieves data from a proxied dictionary.
        Note: Allow underlying exceptions to be raised.
        """
        dobj = getattr( obj, self._dname )
        return dobj[ self._kname ]


    #=========================================================================
    def __set__( self, obj, value ):
        """
        Modifies data in a proxied dictionary.
        Note: Allow underlying exceptions to be raised.
        """
        dobj = getattr( obj, self._dname )
        dobj[ self._kname ] = value


    #=========================================================================
    def __del__( self, obj ):
        """
        Removes data from a proxied dictionary.
        """
        dobj = getattr( obj, self._dname )
        del dobj[ self._kname ]


#=============================================================================<commit_msg>Adding descripter pass-through.<commit_after>#!/usr/bin/env python


"""
Descriptor Examples
"""


__version__ = '0.0.0'


#=============================================================================
class class_style( object ):
    """
    Class Style Descriptor
    """

    #=========================================================================
    def __init__( self, name ):
        """
        Initializes a class_style descriptor object.
        """
        self.name = name

    #=========================================================================
    def __get__( self, obj, objtype = None ):
        """
        Getter
        """
        return obj.proxied[ self.name ]

    #=========================================================================
    def __set__( self, obj, value ):
        """
        Setter
        """
        obj.proxied[ self.name ] = value


#=============================================================================
class dict_proxy( object ):
    """
    Dictionary proxy descriptor.
    """

    #=========================================================================
    def __init__( self, dname, kname ):
        """
        Initializes a dict_proxy object.
        """
        super( dict_proxy, self ).__init__()
        self._dname = dname
        self._kname = kname


    #=========================================================================
    def __get__( self, obj, objtype = None ):
        """
        Retrieves data from a proxied dictionary.
        Note: Allow underlying exceptions to be raised.
        """
        if obj is None:
            return self
        dobj = getattr( obj, self._dname )
        return dobj[ self._kname ]


    #=========================================================================
    def __set__( self, obj, value ):
        """
        Modifies data in a proxied dictionary.
        Note: Allow underlying exceptions to be raised.
        """
        dobj = getattr( obj, self._dname )
        dobj[ self._kname ] = value


    #=========================================================================
    def __del__( self, obj ):
        """
        Removes data from a proxied dictionary.
        """
        dobj = getattr( obj, self._dname )
        del dobj[ self._kname ]


#=============================================================================
{'fraction_non_alphanumeric': 0.39364876385336744, 'fraction_numerical': 0.0012787723785166241, 'mean_word_length': 2.8310204081632655, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7451131', 'n_tokens_mistral': 1124, 'n_tokens_neox': 989, 'n_words': 274}