<commit_before>/*
Copyright (c) 2003-2010 Sony Pictures Imageworks Inc., et al.
All Rights Reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
* Redistributions of source code must retain the above copyright
  notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
  notice, this list of conditions and the following disclaimer in the
  documentation and/or other materials provided with the distribution.
* Neither the name of Sony Pictures Imageworks nor the names of its
  contributors may be used to endorse or promote products derived from
  this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/


#include <OpenColorIO/OpenColorIO.h>

#include "PyTransform.h"
#include "PyUtil.h"

OCIO_NAMESPACE_ENTER
{
    ///////////////////////////////////////////////////////////////////////////
    ///
    
    bool AddGroupTransformObjectToModule( PyObject* m )
    {
        PyOCIO_GroupTransformType.tp_new = PyType_GenericNew;
        if ( PyType_Ready(&PyOCIO_GroupTransformType) < 0 ) return false;
        
        Py_INCREF( &PyOCIO_GroupTransformType );
        PyModule_AddObject(m, "GroupTransform",
                (PyObject *)&PyOCIO_GroupTransformType);
        
        return true;
    }
    
    bool IsPyGroupTransform(PyObject * pyobject)
    {
        if(!pyobject) return false;
        return PyObject_TypeCheck(pyobject, &PyOCIO_GroupTransformType);
    }
    
    ConstGroupTransformRcPtr GetConstGroupTransform(PyObject * pyobject, bool allowCast)
    {
        ConstGroupTransformRcPtr transform = \
            DynamicPtrCast<const GroupTransform>(GetConstTransform(pyobject, allowCast));
        if(!transform)
        {
            throw Exception("PyObject must be a valid OCIO.GroupTransform.");
        }
        return transform;
    }
    
    GroupTransformRcPtr GetEditableGroupTransform(PyObject * pyobject)
    {
        GroupTransformRcPtr transform = \
            DynamicPtrCast<GroupTransform>(GetEditableTransform(pyobject));
        if(!transform)
        {
            throw Exception("PyObject must be a valid OCIO.GroupTransform.");
        }
        return transform;
    }
    
    ///////////////////////////////////////////////////////////////////////////
    ///
    
    
    
    namespace
    {
        int PyOCIO_GroupTransform_init( PyOCIO_Transform * self, PyObject * args, PyObject * kwds );
        
        PyObject * PyOCIO_GroupTransform_getTransform( PyObject * self,  PyObject *args );
        PyObject * PyOCIO_GroupTransform_getEditableTransform( PyObject * self,  PyObject *args );
        
        PyObject * PyOCIO_GroupTransform_size( PyObject * self );
        PyObject * PyOCIO_GroupTransform_push_back( PyObject * self,  PyObject *args );
        PyObject * PyOCIO_GroupTransform_clear( PyObject * self );
        PyObject * PyOCIO_GroupTransform_empty( PyObject * self );
        
        ///////////////////////////////////////////////////////////////////////
        ///<commit_msg>added comment<commit_after>/*
Copyright (c) 2003-2010 Sony Pictures Imageworks Inc., et al.
All Rights Reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
* Redistributions of source code must retain the above copyright
  notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
  notice, this list of conditions and the following disclaimer in the
  documentation and/or other materials provided with the distribution.
* Neither the name of Sony Pictures Imageworks nor the names of its
  contributors may be used to endorse or promote products derived from
  this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/


#include <OpenColorIO/OpenColorIO.h>

#include "PyTransform.h"
#include "PyUtil.h"

OCIO_NAMESPACE_ENTER
{
    ///////////////////////////////////////////////////////////////////////////
    ///
    
    bool AddGroupTransformObjectToModule( PyObject* m )
    {
        PyOCIO_GroupTransformType.tp_new = PyType_GenericNew;
        if ( PyType_Ready(&PyOCIO_GroupTransformType) < 0 ) return false;
        
        Py_INCREF( &PyOCIO_GroupTransformType );
        PyModule_AddObject(m, "GroupTransform",
                (PyObject *)&PyOCIO_GroupTransformType);
        
        return true;
    }
    
    bool IsPyGroupTransform(PyObject * pyobject)
    {
        if(!pyobject) return false;
        return PyObject_TypeCheck(pyobject, &PyOCIO_GroupTransformType);
    }
    
    ConstGroupTransformRcPtr GetConstGroupTransform(PyObject * pyobject, bool allowCast)
    {
        ConstGroupTransformRcPtr transform = \
            DynamicPtrCast<const GroupTransform>(GetConstTransform(pyobject, allowCast));
        if(!transform)
        {
            throw Exception("PyObject must be a valid OCIO.GroupTransform.");
        }
        return transform;
    }
    
    GroupTransformRcPtr GetEditableGroupTransform(PyObject * pyobject)
    {
        GroupTransformRcPtr transform = \
            DynamicPtrCast<GroupTransform>(GetEditableTransform(pyobject));
        if(!transform)
        {
            throw Exception("PyObject must be a valid OCIO.GroupTransform.");
        }
        return transform;
    }
    
    ///////////////////////////////////////////////////////////////////////////
    ///
    
    
    
    namespace
    {
        int PyOCIO_GroupTransform_init( PyOCIO_Transform * self, PyObject * args, PyObject * kwds );
        
        PyObject * PyOCIO_GroupTransform_getTransform( PyObject * self,  PyObject *args );
        PyObject * PyOCIO_GroupTransform_getEditableTransform( PyObject * self,  PyObject *args );
        
        // TODO: make these appear more like a pysequence. .append, len(), etc
        
        PyObject * PyOCIO_GroupTransform_size( PyObject * self );
        PyObject * PyOCIO_GroupTransform_push_back( PyObject * self,  PyObject *args );
        PyObject * PyOCIO_GroupTransform_clear( PyObject * self );
        PyObject * PyOCIO_GroupTransform_empty( PyObject * self );
        
        ///////////////////////////////////////////////////////////////////////
        ///
{'fraction_non_alphanumeric': 0.11341122682245365, 'fraction_numerical': 0.002286004572009144, 'mean_word_length': 2.54251012145749, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 9, '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': '7126923', 'n_tokens_mistral': 1980, 'n_tokens_neox': 1915, 'n_words': 684}