<commit_before>import wx
import string
import sys
import traceback
import vtk

def clampVariable(v, min, max):
    """Make sure variable is on the range [min,max].  Return clamped variable.
    """
    if v < min:
        v = min
    elif v > max:
        v = max

    return v

def logError(msg):
    # create nice formatted string with tracebacks and all
    ei = sys.exc_info()
    dmsg = \
         string.join(traceback.format_exception(ei[0],
                                                ei[1],
                                                ei[2]))
    # we can't disable the timestamp yet
    # wxLog_SetTimestamp()
    # set the detail message
    wx.LogError(dmsg)
    # then the most recent
    wx.LogError(msg)
    # and flush... the last message will be the actual error
    # message, what we did before will add to it to become the
    # detail message
    wx.Log_FlushActive()

def logWarning(msg):
    # create nice formatted string with tracebacks and all
    ei = sys.exc_info()
    dmsg = \
         string.join(traceback.format_exception(ei[0],
                                                ei[1],
                                                ei[2]))
    # we can't disable the timestamp yet
    # wxLog_SetTimestamp()
    # set the detail message
    wx.LogWarning(dmsg)
    # then the most recent
    wx.LogWarning(msg)
    # and flush... the last message will be the actual error
    # message, what we did before will add to it to become the
    # detail message
    wx.Log_FlushActive()
    

def flattenProp3D(prop3D):
    """Get rid of the UserTransform() of an actor by integrating it with
    the 'main' matrix.
    """

    if not prop3D.GetUserTransform():
        # no flattening here, move along
        return

    # get the current "complete" matrix (combining internal and user)<commit_msg>ENH: Changes to support wxPython 2.6.0.1<commit_after>import wx
import string
import sys
import traceback
import vtk

def clampVariable(v, min, max):
    """Make sure variable is on the range [min,max].  Return clamped variable.
    """
    if v < min:
        v = min
    elif v > max:
        v = max

    return v

def logError(msg):
    # create nice formatted string with tracebacks and all
    ei = sys.exc_info()
    #dmsg = \
    #     string.join(traceback.format_exception(ei[0],
    #                                            ei[1],
    #                                            ei[2]))

    dmsgs = traceback.format_exception(ei[0], ei[1], ei[2])
    
    # we can't disable the timestamp yet
    # wxLog_SetTimestamp()
    # set the detail message
    for dmsg in dmsgs:
        wx.LogError(dmsg)

    # then the most recent
    wx.LogError(msg)
    print msg
    # and flush... the last message will be the actual error
    # message, what we did before will add to it to become the
    # detail message
    wx.Log_FlushActive()

def logWarning(msg):
    # create nice formatted string with tracebacks and all
    ei = sys.exc_info()
    #dmsg = \
    #     string.join(traceback.format_exception(ei[0],
    #                                            ei[1],
    #                                            ei[2]))

    dmsgs = traceback.format_exception(ei[0], ei[1], ei[2])
    
    # we can't disable the timestamp yet
    # wxLog_SetTimestamp()
    # set the detail message
    for dmsg in dmsgs:
        wx.LogWarning(dmsg)
    # then the most recent
    wx.LogWarning(msg)
    # and flush... the last message will be the actual error
    # message, what we did before will add to it to become the
    # detail message
    wx.Log_FlushActive()
    

def flattenProp3D(prop3D):
    """Get rid of the UserTransform() of an actor by integrating it with
    the 'main' matrix.
    """

    if not prop3D.GetUserTransform():
        # no flattening here, move along
        return

    # get the current "complete" matrix (combining internal and user)
{'fraction_non_alphanumeric': 0.0834186284544524, 'fraction_numerical': 0.007164790174002047, 'mean_word_length': 1.8912721893491125, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 1, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 16, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5340599', 'n_tokens_mistral': 1134, 'n_tokens_neox': 1091, 'n_words': 398}