Enforce quotes consistency.
authorThomas Mansencal <thomas.mansencal@gmail.com>
Mon, 19 Jan 2015 10:49:57 +0000 (11:49 +0100)
committerThomas Mansencal <thomas.mansencal@gmail.com>
Mon, 19 Jan 2015 10:49:57 +0000 (11:49 +0100)
aces_1.0.0/python/aces_ocio/__init__.py
aces_1.0.0/python/aces_ocio/create_aces_config.py
aces_1.0.0/python/aces_ocio/create_arri_colorspaces.py
aces_1.0.0/python/aces_ocio/create_canon_colorspaces.py
aces_1.0.0/python/aces_ocio/create_red_colorspaces.py
aces_1.0.0/python/aces_ocio/create_sony_colorspaces.py
aces_1.0.0/python/aces_ocio/generate_lut.py
aces_1.0.0/python/aces_ocio/process.py

index 55576c9..73ec153 100644 (file)
@@ -12,10 +12,10 @@ Python
 ******
 
 >>> import sys
->>> sys.path.append("/path/to/script")
+>>> sys.path.append('/path/to/script')
 >>> import create_aces_config as cac
->>> acesReleaseCTLDir = "/path/to/github/checkout/releases/v0.7.1/transforms/ctl"
->>> configDir = "/path/to/config/dir"
+>>> acesReleaseCTLDir = '/path/to/github/checkout/releases/v0.7.1/transforms/ctl'
+>>> configDir = '/path/to/config/dir'
 >>> cac.createACESConfig(acesReleaseCTLDir, configDir, 1024, 33, True)
 
 Command Line
@@ -23,7 +23,7 @@ Command Line
 
 From the directory with 'create_aces_config.py':
 
-$ python create_aces_config.py -a "/path/to/github/checkout/releases/v0.7.1/transforms/ctl" -c "/path/to/config/dir" --lut_resolution_1d 1024 --lut_resolution_3d 33 --keepTempImages
+$ python create_aces_config.py -a '/path/to/github/checkout/releases/v0.7.1/transforms/ctl' -c '/path/to/config/dir' --lut_resolution_1d 1024 --lut_resolution_3d 33 --keepTempImages
 
 Build
 -----
index a18ba48..d5aa5e8 100755 (executable)
@@ -58,15 +58,15 @@ ACES_OCIO_CONFIGURATION_DIRECTORY_ENVIRON = 'ACES_OCIO_CONFIGURATION_DIRECTORY'
 
 
 def set_config_default_roles(config,
-                             color_picking="",
-                             color_timing="",
-                             compositing_log="",
-                             data="",
-                             default="",
-                             matte_paint="",
-                             reference="",
-                             scene_linear="",
-                             texture_paint=""):
+                             color_picking='',
+                             color_timing='',
+                             compositing_log='',
+                             data='',
+                             default='',
+                             matte_paint='',
+                             reference='',
+                             scene_linear='',
+                             texture_paint=''):
     """
     Sets given *OCIO* configuration default roles.
 
@@ -141,7 +141,7 @@ def write_config(config, config_path, sanity_check=True):
             config.sanityCheck()
         except Exception, e:
             print e
-            print "Configuration was not written due to a failed Sanity Check"
+            print 'Configuration was not written due to a failed Sanity Check'
             return
             # sys.exit()
 
@@ -165,7 +165,7 @@ def generate_OCIO_transform(transforms):
          Return value description.
     """
 
-    # print("Generating transforms")
+    # print('Generating transforms')
 
     interpolation_options = {
         'linear': OCIO.Constants.INTERP_LINEAR,
@@ -212,7 +212,7 @@ def generate_OCIO_transform(transforms):
 
             ocio_transforms.append(ocio_transform)
         else:
-            print("Ignoring unknown transform type : %s" % transform['type'])
+            print('Ignoring unknown transform type : %s' % transform['type'])
 
     # Build a group transform if necessary
     if len(ocio_transforms) > 1:
@@ -249,14 +249,14 @@ def create_config(config_data, nuke=False):
     #
     # Set config wide values
     #
-    config.setDescription("An ACES config generated from python")
-    config.setSearchPath("luts")
+    config.setDescription('An ACES config generated from python')
+    config.setSearchPath('luts')
 
     #
     # Define the reference color space
     #
     reference_data = config_data['referenceColorSpace']
-    print("Adding the reference color space : %s" % reference_data.name)
+    print('Adding the reference color space : %s' % reference_data.name)
 
     # Create a color space
     reference = OCIO.ColorSpace(
@@ -276,7 +276,7 @@ def create_config(config_data, nuke=False):
     # Create the rest of the color spaces
     #
     for colorspace in sorted(config_data['colorSpaces']):
-        print("Creating new color space : %s" % colorspace.name)
+        print('Creating new color space : %s' % colorspace.name)
 
         ocio_colorspace = OCIO.ColorSpace(
             name=colorspace.name,
@@ -289,7 +289,7 @@ def create_config(config_data, nuke=False):
             allocationVars=colorspace.allocation_vars)
 
         if colorspace.to_reference_transforms != []:
-            print("Generating To-Reference transforms")
+            print('Generating To-Reference transforms')
             ocio_transform = generate_OCIO_transform(
                 colorspace.to_reference_transforms)
             ocio_colorspace.setTransform(
@@ -297,7 +297,7 @@ def create_config(config_data, nuke=False):
                 OCIO.Constants.COLORSPACE_DIR_TO_REFERENCE)
 
         if colorspace.from_reference_transforms != []:
-            print("Generating From-Reference transforms")
+            print('Generating From-Reference transforms')
             ocio_transform = generate_OCIO_transform(
                 colorspace.from_reference_transforms)
             ocio_colorspace.setTransform(
@@ -306,7 +306,7 @@ def create_config(config_data, nuke=False):
 
         config.addColorSpace(ocio_colorspace)
 
-        print("")
+        print('')
 
     #
     # Define the views and displays
@@ -393,7 +393,7 @@ def generate_LUTs(odt_info,
          the reference colorspace, *ACES*.
     """
 
-    print("generateLUTs - begin")
+    print('generateLUTs - begin')
     config_data = {}
 
     #
@@ -438,7 +438,7 @@ def generate_LUTs(odt_info,
                       max_value=1.0,
                       input_scale=1.0):
         cs = ColorSpace(name)
-        cs.description = "The %s color space" % name
+        cs.description = 'The %s color space' % name
         cs.equality_group = ''
         cs.family = 'ACES'
         cs.is_data = False
@@ -450,13 +450,13 @@ def generate_LUTs(odt_info,
             # The primaries switch is covered by the matrix below
             '%s/ACEScg/ACEScsc.ACES_to_ACEScg.a1.0.0.ctl' % aces_CTL_directory
         ]
-        lut = "%s_to_ACES.spi1d" % name
+        lut = '%s_to_ACES.spi1d' % name
 
         # Remove spaces and parentheses
         lut = lut.replace(' ', '_').replace(')', '_').replace('(', '_')
 
         generate_1d_LUT_from_CTL(
-            lut_directory + "/" + lut,
+            lut_directory + '/' + lut,
             ctls,
             lut_resolution_1d,
             'float',
@@ -494,7 +494,7 @@ def generate_LUTs(odt_info,
     #
     def create_ACESproxy(name='ACESproxy'):
         cs = ColorSpace(name)
-        cs.description = "The %s color space" % name
+        cs.description = 'The %s color space' % name
         cs.equality_group = ''
         cs.family = 'ACES'
         cs.is_data = False
@@ -507,13 +507,13 @@ def generate_LUTs(odt_info,
             # The primaries switch is covered by the matrix below
             '%s/ACEScg/ACEScsc.ACES_to_ACEScg.a1.0.0.ctl' % aces_CTL_directory
         ]
-        lut = "%s_to_aces.spi1d" % name
+        lut = '%s_to_aces.spi1d' % name
 
         # Remove spaces and parentheses
         lut = lut.replace(' ', '_').replace(')', '_').replace('(', '_')
 
         generate_1d_LUT_from_CTL(
-            lut_directory + "/" + lut,
+            lut_directory + '/' + lut,
             ctls,
             lut_resolution_1d,
             'uint16',
@@ -549,7 +549,7 @@ def generate_LUTs(odt_info,
     #
     def create_ACEScg(name='ACEScg'):
         cs = ColorSpace(name)
-        cs.description = "The %s color space" % name
+        cs.description = 'The %s color space' % name
         cs.equality_group = ''
         cs.family = 'ACES'
         cs.is_data = False
@@ -573,9 +573,9 @@ def generate_LUTs(odt_info,
     # ADX
     #
     def create_ADX(bit_depth=10, name='ADX'):
-        name = "%s%s" % (name, bit_depth)
+        name = '%s%s' % (name, bit_depth)
         cs = ColorSpace(name)
-        cs.description = "%s color space - used for film scans" % name
+        cs.description = '%s color space - used for film scans' % name
         cs.equality_group = ''
         cs.family = 'ADX'
         cs.is_data = False
@@ -655,7 +655,7 @@ def generate_LUTs(odt_info,
 
             def fit(value, from_min, from_max, to_min, to_max):
                 if from_min == from_max:
-                    raise ValueError("from_min == from_max")
+                    raise ValueError('from_min == from_max')
                 return (value - from_min) / (from_max - from_min) * (
                     to_max - to_min) + to_min
 
@@ -668,7 +668,7 @@ def generate_LUTs(odt_info,
                 data.append(cid_to_rle(x))
 
             lut = 'ADX_CID_to_RLE.spi1d'
-            write_SPI_1d(lut_directory + "/" + lut, RANGE[0], RANGE[1],
+            write_SPI_1d(lut_directory + '/' + lut, RANGE[0], RANGE[1],
                          data,
                          NUM_SAMPLES, 1)
 
@@ -749,7 +749,7 @@ def generate_LUTs(odt_info,
                            max_exposure=6.5,
                            lut_resolution_1d=lut_resolution_1d):
         cs = ColorSpace(name)
-        cs.description = "The %s color space" % name
+        cs.description = 'The %s color space' % name
         cs.equality_group = name
         cs.family = 'Utility'
         cs.is_data = False
@@ -757,13 +757,13 @@ def generate_LUTs(odt_info,
         ctls = [
             '%s/utilities/ACESlib.OCIO_shaper_log2_to_lin_param.a1.0.0.ctl' % (
                 aces_CTL_directory)]
-        lut = "%s_to_aces.spi1d" % name
+        lut = '%s_to_aces.spi1d' % name
 
         # Remove spaces and parentheses
         lut = lut.replace(' ', '_').replace(')', '_').replace('(', '_')
 
         generate_1d_LUT_from_CTL(
-            lut_directory + "/" + lut,
+            lut_directory + '/' + lut,
             ctls,
             lut_resolution_1d,
             'float',
@@ -799,8 +799,8 @@ def generate_LUTs(odt_info,
                         lut_resolution_1d=1024,
                         lut_resolution_3d=64,
                         cleanup=True):
-        cs = ColorSpace("%s" % lmt_name)
-        cs.description = "The ACES Look Transform: %s" % lmt_name
+        cs = ColorSpace('%s' % lmt_name)
+        cs.description = 'The ACES Look Transform: %s' % lmt_name
         cs.equality_group = ''
         cs.family = 'Look'
         cs.is_data = False
@@ -816,8 +816,8 @@ def generate_LUTs(odt_info,
          shaper_input_scale,
          shaper_params) = shaper_info
 
-        shaper_lut = "%s_to_aces.spi1d" % shaper_name
-        if (not os.path.exists(lut_directory + "/" + shaper_lut)):
+        shaper_lut = '%s_to_aces.spi1d' % shaper_name
+        if (not os.path.exists(lut_directory + '/' + shaper_lut)):
             ctls = [shaper_to_ACES_CTL % aces_CTL_directory]
 
             # Remove spaces and parentheses
@@ -825,7 +825,7 @@ def generate_LUTs(odt_info,
                 ' ', '_').replace(')', '_').replace('(', '_')
 
             generate_1d_LUT_from_CTL(
-                lut_directory + "/" + shaper_lut,
+                lut_directory + '/' + shaper_lut,
                 ctls,
                 lut_resolution_1d,
                 'float',
@@ -852,13 +852,13 @@ def generate_LUTs(odt_info,
                 shaper_to_ACES_CTL % aces_CTL_directory,
                 '%s/%s' % (aces_CTL_directory, lmt_values['transformCTL'])
             ]
-            lut = "%s.%s.spi3d" % (shaper_name, lmt_name)
+            lut = '%s.%s.spi3d' % (shaper_name, lmt_name)
 
             # Remove spaces and parentheses
             lut = lut.replace(' ', '_').replace(')', '_').replace('(', '_')
 
             generate_3d_LUT_from_CTL(
-                lut_directory + "/" + lut,
+                lut_directory + '/' + lut,
                 ctls,
                 lut_resolution_3d,
                 'float',
@@ -887,13 +887,13 @@ def generate_LUTs(odt_info,
                     aces_CTL_directory, odt_values['transformCTLInverse']),
                 shaper_from_ACES_CTL % aces_CTL_directory
             ]
-            lut = "Inverse.%s.%s.spi3d" % (odt_name, shaper_name)
+            lut = 'Inverse.%s.%s.spi3d' % (odt_name, shaper_name)
 
             # Remove spaces and parentheses
             lut = lut.replace(' ', '_').replace(')', '_').replace('(', '_')
 
             generate_3d_LUT_from_CTL(
-                lut_directory + "/" + lut,
+                lut_directory + '/' + lut,
                 ctls,
                 lut_resolution_3d,
                 'half',
@@ -970,8 +970,8 @@ def generate_LUTs(odt_info,
                                  lut_resolution_1d=1024,
                                  lut_resolution_3d=64,
                                  cleanup=True):
-        cs = ColorSpace("%s" % odt_name)
-        cs.description = "%s - %s Output Transform" % (
+        cs = ColorSpace('%s' % odt_name)
+        cs.description = '%s - %s Output Transform' % (
             odt_values['transformUserNamePrefix'], odt_name)
         cs.equality_group = ''
         cs.family = 'Output'
@@ -994,8 +994,8 @@ def generate_LUTs(odt_info,
         else:
             shaper_params['legalRange'] = 0
 
-        shaper_lut = "%s_to_aces.spi1d" % shaper_name
-        if (not os.path.exists(lut_directory + "/" + shaper_lut)):
+        shaper_lut = '%s_to_aces.spi1d' % shaper_name
+        if (not os.path.exists(lut_directory + '/' + shaper_lut)):
             ctls = [shaper_to_ACES_CTL % aces_CTL_directory]
 
             # Remove spaces and parentheses
@@ -1003,7 +1003,7 @@ def generate_LUTs(odt_info,
                 ' ', '_').replace(')', '_').replace('(', '_')
 
             generate_1d_LUT_from_CTL(
-                lut_directory + "/" + shaper_lut,
+                lut_directory + '/' + shaper_lut,
                 ctls,
                 lut_resolution_1d,
                 'float',
@@ -1029,7 +1029,7 @@ def generate_LUTs(odt_info,
             # Copy into the lut dir
             transform_LUT_file_name = os.path.basename(
                 odt_values['transformLUT'])
-            lut = lut_directory + "/" + transform_LUT_file_name
+            lut = lut_directory + '/' + transform_LUT_file_name
             shutil.copy(odt_values['transformLUT'], lut)
 
             cs.from_reference_transforms.append(shaper_OCIO_transform)
@@ -1047,12 +1047,12 @@ def generate_LUTs(odt_info,
                 '%s/rrt/RRT.a1.0.0.ctl' % aces_CTL_directory,
                 '%s/odt/%s' % (aces_CTL_directory, odt_values['transformCTL'])
             ]
-            lut = "%s.RRT.a1.0.0.%s.spi3d" % (shaper_name, odt_name)
+            lut = '%s.RRT.a1.0.0.%s.spi3d' % (shaper_name, odt_name)
 
             # Remove spaces and parentheses
             lut = lut.replace(' ', '_').replace(')', '_').replace('(', '_')
 
-            generate_3d_LUT_from_CTL(lut_directory + "/" + lut,
+            generate_3d_LUT_from_CTL(lut_directory + '/' + lut,
                                      # shaperLUT,
                                      ctls,
                                      lut_resolution_3d,
@@ -1080,7 +1080,7 @@ def generate_LUTs(odt_info,
             # Copy into the lut dir
             transform_LUT_inverse_file_name = os.path.basename(
                 odt_values['transformLUTInverse'])
-            lut = lut_directory + "/" + transform_LUT_inverse_file_name
+            lut = lut_directory + '/' + transform_LUT_inverse_file_name
             shutil.copy(odt_values['transformLUTInverse'], lut)
 
             cs.to_reference_transforms.append({
@@ -1100,13 +1100,13 @@ def generate_LUTs(odt_info,
                 '%s/rrt/InvRRT.a1.0.0.ctl' % aces_CTL_directory,
                 shaper_from_ACES_CTL % aces_CTL_directory
             ]
-            lut = "InvRRT.a1.0.0.%s.%s.spi3d" % (odt_name, shaper_name)
+            lut = 'InvRRT.a1.0.0.%s.%s.spi3d' % (odt_name, shaper_name)
 
             # Remove spaces and parentheses
             lut = lut.replace(' ', '_').replace(')', '_').replace('(', '_')
 
             generate_3d_LUT_from_CTL(
-                lut_directory + "/" + lut,
+                lut_directory + '/' + lut,
                 # None,
                 ctls,
                 lut_resolution_3d,
@@ -1171,7 +1171,7 @@ def generate_LUTs(odt_info,
         middle_grey=log2_params['middleGrey'],
         min_exposure=log2_params['minExposure'],
         max_exposure=log2_params['maxExposure'])
-    log2_shaper_AP1.name = "%s - AP1" % log2_shaper_AP1.name
+    log2_shaper_AP1.name = '%s - AP1' % log2_shaper_AP1.name
     # AP1 primaries to AP0 primaries
     log2_shaper_AP1.to_reference_transforms.append({
         'type': 'matrix',
@@ -1223,9 +1223,9 @@ def generate_LUTs(odt_info,
         if odt_name in ['Academy.Rec2020_100nits_dim.a1.0.0',
                         'Academy.Rec709_100nits_dim.a1.0.0',
                         'Academy.Rec709_D60sim_100nits_dim.a1.0.0']:
-            print("Generating full range ODT for %s" % odt_name)
+            print('Generating full range ODT for %s' % odt_name)
 
-            odt_name_full = "%s - Full" % odt_values['transformUserName']
+            odt_name_full = '%s - Full' % odt_values['transformUserName']
             odt_full = odt_values.copy()
             odt_full['legalRange'] = 0
 
@@ -1251,7 +1251,7 @@ def generate_LUTs(odt_info,
                               from_reference_values=[],
                               to_reference_values=[]):
         cs = ColorSpace(name)
-        cs.description = "The %s color space" % name
+        cs.description = 'The %s color space' % name
         cs.equality_group = name
         cs.family = 'Utility'
         cs.is_data = False
@@ -1323,7 +1323,7 @@ def generate_LUTs(odt_info,
         from_reference_values=[ACES_AP0_to_XYZ, XYZ_to_Rec2020])
     config_data['colorSpaces'].append(cs)
 
-    print("generateLUTs - end")
+    print('generateLUTs - end')
     return config_data
 
 
@@ -1354,103 +1354,103 @@ def generate_baked_LUTs(odt_info,
         if odt_CTL_name in ['Academy.Rec2020_100nits_dim.a1.0.0',
                             'Academy.Rec709_100nits_dim.a1.0.0',
                             'Academy.Rec709_D60sim_100nits_dim.a1.0.0']:
-            odt_name = odt_values["transformUserName"]
+            odt_name = odt_values['transformUserName']
 
             odt_values_legal = dict(odt_values)
-            odt_values_legal["transformUserName"] = "%s - Legal" % odt_name
-            odt_info_C["%s - Legal" % odt_CTL_name] = odt_values_legal
+            odt_values_legal['transformUserName'] = '%s - Legal' % odt_name
+            odt_info_C['%s - Legal' % odt_CTL_name] = odt_values_legal
 
             odt_values_full = dict(odt_values)
-            odt_values_full["transformUserName"] = "%s - Full" % odt_name
-            odt_info_C["%s - Full" % odt_CTL_name] = odt_values_full
+            odt_values_full['transformUserName'] = '%s - Full' % odt_name
+            odt_info_C['%s - Full' % odt_CTL_name] = odt_values_full
 
             del (odt_info_C[odt_CTL_name])
 
     for odt_CTL_name, odt_values in odt_info_C.iteritems():
-        odt_prefix = odt_values["transformUserNamePrefix"]
-        odt_name = odt_values["transformUserName"]
+        odt_prefix = odt_values['transformUserNamePrefix']
+        odt_name = odt_values['transformUserName']
 
         # For Photoshop
-        for input_space in ["ACEScc", "ACESproxy"]:
-            args = ["--iconfig", config_path,
-                    "-v",
-                    "--inputspace", input_space]
-            args += ["--outputspace", "%s" % odt_name]
-            args += ["--description",
-                     "%s - %s for %s data" % (odt_prefix,
+        for input_space in ['ACEScc', 'ACESproxy']:
+            args = ['--iconfig', config_path,
+                    '-v',
+                    '--inputspace', input_space]
+            args += ['--outputspace', '%s' % odt_name]
+            args += ['--description',
+                     '%s - %s for %s data' % (odt_prefix,
                                               odt_name,
                                               input_space)]
-            args += ["--shaperspace", shaper_name,
-                     "--shapersize", str(lut_resolution_shaper)]
-            args += ["--cubesize", str(lut_resolution_3d)]
-            args += ["--format",
-                     "icc",
-                     "%s/photoshop/%s for %s.icc" % (baked_directory,
+            args += ['--shaperspace', shaper_name,
+                     '--shapersize', str(lut_resolution_shaper)]
+            args += ['--cubesize', str(lut_resolution_3d)]
+            args += ['--format',
+                     'icc',
+                     '%s/photoshop/%s for %s.icc' % (baked_directory,
                                                      odt_name,
                                                      input_space)]
 
-            bake_LUT = Process(description="bake a LUT",
-                               cmd="ociobakelut",
+            bake_LUT = Process(description='bake a LUT',
+                               cmd='ociobakelut',
                                args=args)
             bake_LUT.execute()
 
         # For Flame, Lustre
-        for input_space in ["ACEScc", "ACESproxy"]:
-            args = ["--iconfig", config_path,
-                    "-v",
-                    "--inputspace", input_space]
-            args += ["--outputspace", "%s" % odt_name]
-            args += ["--description",
-                     "%s - %s for %s data" % (
+        for input_space in ['ACEScc', 'ACESproxy']:
+            args = ['--iconfig', config_path,
+                    '-v',
+                    '--inputspace', input_space]
+            args += ['--outputspace', '%s' % odt_name]
+            args += ['--description',
+                     '%s - %s for %s data' % (
                          odt_prefix, odt_name, input_space)]
-            args += ["--shaperspace", shaper_name,
-                     "--shapersize", str(lut_resolution_shaper)]
-            args += ["--cubesize", str(lut_resolution_3d)]
+            args += ['--shaperspace', shaper_name,
+                     '--shapersize', str(lut_resolution_shaper)]
+            args += ['--cubesize', str(lut_resolution_3d)]
 
-            fargs = ["--format", "flame", "%s/flame/%s for %s Flame.3dl" % (
+            fargs = ['--format', 'flame', '%s/flame/%s for %s Flame.3dl' % (
                 baked_directory, odt_name, input_space)]
-            bake_LUT = Process(description="bake a LUT",
-                               cmd="ociobakelut",
+            bake_LUT = Process(description='bake a LUT',
+                               cmd='ociobakelut',
                                args=(args + fargs))
             bake_LUT.execute()
 
-            largs = ["--format", "lustre", "%s/lustre/%s for %s Lustre.3dl" % (
+            largs = ['--format', 'lustre', '%s/lustre/%s for %s Lustre.3dl' % (
                 baked_directory, odt_name, input_space)]
-            bake_LUT = Process(description="bake a LUT",
-                               cmd="ociobakelut",
+            bake_LUT = Process(description='bake a LUT',
+                               cmd='ociobakelut',
                                args=(args + largs))
             bake_LUT.execute()
 
         # For Maya, Houdini
-        for input_space in ["ACEScg", "ACES2065-1"]:
-            args = ["--iconfig", config_path,
-                    "-v",
-                    "--inputspace", input_space]
-            args += ["--outputspace", "%s" % odt_name]
-            args += ["--description",
-                     "%s - %s for %s data" % (
+        for input_space in ['ACEScg', 'ACES2065-1']:
+            args = ['--iconfig', config_path,
+                    '-v',
+                    '--inputspace', input_space]
+            args += ['--outputspace', '%s' % odt_name]
+            args += ['--description',
+                     '%s - %s for %s data' % (
                          odt_prefix, odt_name, input_space)]
             if input_space == 'ACEScg':
-                lin_shaper_name = "%s - AP1" % shaper_name
+                lin_shaper_name = '%s - AP1' % shaper_name
             else:
                 lin_shaper_name = shaper_name
-            args += ["--shaperspace", lin_shaper_name,
-                     "--shapersize", str(lut_resolution_shaper)]
+            args += ['--shaperspace', lin_shaper_name,
+                     '--shapersize', str(lut_resolution_shaper)]
 
-            args += ["--cubesize", str(lut_resolution_3d)]
+            args += ['--cubesize', str(lut_resolution_3d)]
 
-            margs = ["--format", "cinespace", "%s/maya/%s for %s Maya.csp" % (
+            margs = ['--format', 'cinespace', '%s/maya/%s for %s Maya.csp' % (
                 baked_directory, odt_name, input_space)]
-            bake_LUT = Process(description="bake a LUT",
-                               cmd="ociobakelut",
+            bake_LUT = Process(description='bake a LUT',
+                               cmd='ociobakelut',
                                args=(args + margs))
             bake_LUT.execute()
 
-            hargs = ["--format", "houdini",
-                     "%s/houdini/%s for %s Houdini.lut" % (
+            hargs = ['--format', 'houdini',
+                     '%s/houdini/%s for %s Houdini.lut' % (
                          baked_directory, odt_name, input_space)]
-            bake_LUT = Process(description="bake a LUT",
-                               cmd="ociobakelut",
+            bake_LUT = Process(description='bake a LUT',
+                               cmd='ociobakelut',
                                args=(args + hargs))
             bake_LUT.execute()
 
@@ -1470,14 +1470,14 @@ def create_config_dir(config_directory, bake_secondary_LUTs):
          Return value description.
     """
 
-    dirs = [config_directory, "%s/luts" % config_directory]
+    dirs = [config_directory, '%s/luts' % config_directory]
     if bake_secondary_LUTs:
-        dirs.extend(["%s/baked" % config_directory,
-                     "%s/baked/flame" % config_directory,
-                     "%s/baked/photoshop" % config_directory,
-                     "%s/baked/houdini" % config_directory,
-                     "%s/baked/lustre" % config_directory,
-                     "%s/baked/maya" % config_directory])
+        dirs.extend(['%s/baked' % config_directory,
+                     '%s/baked/flame' % config_directory,
+                     '%s/baked/photoshop' % config_directory,
+                     '%s/baked/houdini' % config_directory,
+                     '%s/baked/lustre' % config_directory,
+                     '%s/baked/maya' % config_directory])
 
     for d in dirs:
         not os.path.exists(d) and os.mkdir(d)
@@ -1536,14 +1536,14 @@ def get_ODT_info(aces_CTL_directory):
 
     # TODO: Investigate usage of *files_walker* definition here.
     # Credit to Alex Fry for the original approach here
-    odt_dir = os.path.join(aces_CTL_directory, "odt")
+    odt_dir = os.path.join(aces_CTL_directory, 'odt')
     all_odt = []
     for dir_name, subdir_list, file_list in os.walk(odt_dir):
         for fname in file_list:
             all_odt.append((os.path.join(dir_name, fname)))
 
     odt_CTLs = [x for x in all_odt if
-                ("InvODT" not in x) and (os.path.split(x)[-1][0] != '.')]
+                ('InvODT' not in x) and (os.path.split(x)[-1][0] != '.')]
 
     # print odtCTLs
 
@@ -1561,7 +1561,7 @@ def get_ODT_info(aces_CTL_directory):
             odt_dir = os.path.join(odt_path_tokens[-1], odt_dir)
 
         # Build full name
-        # print("odtDir : %s" % odtDir)
+        # print('odtDir : %s' % odtDir)
         transform_CTL = odt_tokens[-1]
         # print(transformCTL)
         odt_name = string.join(transform_CTL.split('.')[1:-1], '.')
@@ -1571,10 +1571,10 @@ def get_ODT_info(aces_CTL_directory):
         (transform_ID,
          transform_user_name,
          transform_user_name_prefix) = get_transform_info(
-            "%s/odt/%s/%s" % (aces_CTL_directory, odt_dir, transform_CTL))
+            '%s/odt/%s/%s' % (aces_CTL_directory, odt_dir, transform_CTL))
 
         # Find inverse
-        transform_CTL_inverse = "InvODT.%s.ctl" % odt_name
+        transform_CTL_inverse = 'InvODT.%s.ctl' % odt_name
         if not os.path.exists(
                 os.path.join(odt_tokens[-2], transform_CTL_inverse)):
             transform_CTL_inverse = None
@@ -1591,19 +1591,19 @@ def get_ODT_info(aces_CTL_directory):
         odts[odt_name]['transformUserNamePrefix'] = transform_user_name_prefix
         odts[odt_name]['transformUserName'] = transform_user_name
 
-        print("ODT : %s" % odt_name)
-        print("\tTransform ID               : %s" % transform_ID)
-        print("\tTransform User Name Prefix : %s" % transform_user_name_prefix)
-        print("\tTransform User Name        : %s" % transform_user_name)
-        print("\tForward ctl                : %s" % (
+        print('ODT : %s' % odt_name)
+        print('\tTransform ID               : %s' % transform_ID)
+        print('\tTransform User Name Prefix : %s' % transform_user_name_prefix)
+        print('\tTransform User Name        : %s' % transform_user_name)
+        print('\tForward ctl                : %s' % (
             odts[odt_name]['transformCTL']))
         if 'transformCTLInverse' in odts[odt_name]:
-            print("\tInverse ctl                : %s" % (
+            print('\tInverse ctl                : %s' % (
                 odts[odt_name]['transformCTLInverse']))
         else:
-            print("\tInverse ctl                : %s" % "None")
+            print('\tInverse ctl                : %s' % 'None')
 
-    print("\n")
+    print('\n')
 
     return odts
 
@@ -1628,14 +1628,14 @@ def get_LMT_info(aces_CTL_directory):
     # TODO: Investigate refactoring with previous definition.
 
     # Credit to Alex Fry for the original approach here
-    lmt_dir = os.path.join(aces_CTL_directory, "lmt")
+    lmt_dir = os.path.join(aces_CTL_directory, 'lmt')
     all_lmt = []
     for dir_name, subdir_list, file_list in os.walk(lmt_dir):
         for fname in file_list:
             all_lmt.append((os.path.join(dir_name, fname)))
 
     lmt_CTLs = [x for x in all_lmt if
-                ("InvLMT" not in x) and ("README" not in x) and (
+                ('InvLMT' not in x) and ('README' not in x) and (
                     os.path.split(x)[-1][0] != '.')]
 
     # print lmtCTLs
@@ -1654,7 +1654,7 @@ def get_LMT_info(aces_CTL_directory):
             lmt_dir = os.path.join(lmt_path_tokens[-1], lmt_dir)
 
         # Build full name
-        # print("lmtDir : %s" % lmtDir)
+        # print('lmtDir : %s' % lmtDir)
         transform_CTL = lmt_tokens[-1]
         # print(transformCTL)
         lmt_name = string.join(transform_CTL.split('.')[1:-1], '.')
@@ -1664,10 +1664,10 @@ def get_LMT_info(aces_CTL_directory):
         (transform_ID,
          transform_user_name,
          transform_user_name_prefix) = get_transform_info(
-            "%s/%s/%s" % (aces_CTL_directory, lmt_dir, transform_CTL))
+            '%s/%s/%s' % (aces_CTL_directory, lmt_dir, transform_CTL))
 
         # Find inverse
-        transform_CTL_inverse = "InvLMT.%s.ctl" % lmt_name
+        transform_CTL_inverse = 'InvLMT.%s.ctl' % lmt_name
         if not os.path.exists(
                 os.path.join(lmt_tokens[-2], transform_CTL_inverse)):
             transform_CTL_inverse = None
@@ -1685,18 +1685,18 @@ def get_LMT_info(aces_CTL_directory):
         lmts[lmt_name]['transformUserNamePrefix'] = transform_user_name_prefix
         lmts[lmt_name]['transformUserName'] = transform_user_name
 
-        print("LMT : %s" % lmt_name)
-        print("\tTransform ID               : %s" % transform_ID)
-        print("\tTransform User Name Prefix : %s" % transform_user_name_prefix)
-        print("\tTransform User Name        : %s" % transform_user_name)
-        print("\t Forward ctl : %s" % lmts[lmt_name]['transformCTL'])
+        print('LMT : %s' % lmt_name)
+        print('\tTransform ID               : %s' % transform_ID)
+        print('\tTransform User Name Prefix : %s' % transform_user_name_prefix)
+        print('\tTransform User Name        : %s' % transform_user_name)
+        print('\t Forward ctl : %s' % lmts[lmt_name]['transformCTL'])
         if 'transformCTLInverse' in lmts[lmt_name]:
-            print("\t Inverse ctl : %s" % (
+            print('\t Inverse ctl : %s' % (
                 lmts[lmt_name]['transformCTLInverse']))
         else:
-            print("\t Inverse ctl : %s" % "None")
+            print('\t Inverse ctl : %s' % 'None')
 
-    print("\n")
+    print('\n')
 
     return lmts
 
@@ -1731,7 +1731,7 @@ def create_ACES_config(aces_CTL_directory,
     create_config_dir(config_directory, bake_secondary_LUTs)
 
     # Generate config data and LUTs for different transforms
-    lut_directory = "%s/luts" % config_directory
+    lut_directory = '%s/luts' % config_directory
     shaper_name = 'Output Shaper'
     config_data = generate_LUTs(odt_info,
                                 lmt_info,
@@ -1743,28 +1743,28 @@ def create_ACES_config(aces_CTL_directory,
                                 cleanup)
 
     # Create the config using the generated LUTs
-    print("Creating generic config")
+    print('Creating generic config')
     config = create_config(config_data)
-    print("\n\n\n")
+    print('\n\n\n')
 
     # Write the config to disk
-    write_config(config, "%s/config.ocio" % config_directory)
+    write_config(config, '%s/config.ocio' % config_directory)
 
     # Create a config that will work well with Nuke using the previously
     # generated LUTs.
-    print("Creating Nuke-specific config")
+    print('Creating Nuke-specific config')
     nuke_config = create_config(config_data, nuke=True)
-    print("\n\n\n")
+    print('\n\n\n')
 
     # Write the config to disk
-    write_config(nuke_config, "%s/nuke_config.ocio" % config_directory)
+    write_config(nuke_config, '%s/nuke_config.ocio' % config_directory)
 
     # Bake secondary LUTs using the config
     if bake_secondary_LUTs:
         generate_baked_LUTs(odt_info,
                             shaper_name,
-                            "%s/baked" % config_directory,
-                            "%s/config.ocio" % config_directory,
+                            '%s/baked' % config_directory,
+                            '%s/config.ocio' % config_directory,
                             lut_resolution_1d,
                             lut_resolution_3d,
                             lut_resolution_1d)
@@ -1799,8 +1799,8 @@ def main():
         'ACES_OCIO_CONFIGURATION_DIRECTORY', None))
     p.add_option('--lutResolution1d', default=4096)
     p.add_option('--lutResolution3d', default=64)
-    p.add_option('--dontBakeSecondaryLUTs', action="store_true")
-    p.add_option('--keepTempImages', action="store_true")
+    p.add_option('--dontBakeSecondaryLUTs', action='store_true')
+    p.add_option('--keepTempImages', action='store_true')
 
     options, arguments = p.parse_args()
 
@@ -1821,14 +1821,14 @@ def main():
         args_start = len(sys.argv) + 1
         args = []
 
-    print("command line : \n%s\n" % " ".join(sys.argv))
+    print('command line : \n%s\n' % ' '.join(sys.argv))
 
     # TODO: Use assertion and mention environment variables.
     if not aces_CTL_directory:
-        print("process: No ACES CTL directory specified")
+        print('process: No ACES CTL directory specified')
         return
     if not config_directory:
-        print("process: No configuration directory specified")
+        print('process: No configuration directory specified')
         return
     #
     # Generate the configuration
index be56c9d..b428a57 100644 (file)
@@ -45,11 +45,11 @@ def create_log_c(gamut,
          Return value description.
     """
 
-    name = "%s (EI%s) - %s" % (transfer_function, exposure_index, gamut)
-    if transfer_function == "":
-        name = "Linear - %s" % gamut
-    if gamut == "":
-        name = "%s (EI%s)" % (transfer_function, exposure_index)
+    name = '%s (EI%s) - %s' % (transfer_function, exposure_index, gamut)
+    if transfer_function == '':
+        name = 'Linear - %s' % gamut
+    if gamut == '':
+        name = '%s (EI%s)' % (transfer_function, exposure_index)
 
     cs = ColorSpace(name)
     cs.description = name
@@ -58,7 +58,7 @@ def create_log_c(gamut,
     cs.is_data = False
 
     # Globals
-    IDT_maker_version = "0.08"
+    IDT_maker_version = '0.08'
 
     nominal_EI = 400.0
     black_signal = 0.003907
@@ -118,26 +118,26 @@ def create_log_c(gamut,
 
     cs.to_reference_transforms = []
 
-    if transfer_function == "V3 LogC":
-        data = array.array('f', "\0" * lut_resolution_1d * 4)
+    if transfer_function == 'V3 LogC':
+        data = array.array('f', '\0' * lut_resolution_1d * 4)
         for c in range(lut_resolution_1d):
             data[c] = log_c_to_linear(1023.0 * c / (lut_resolution_1d - 1),
                                       int(exposure_index))
 
-        lut = "%s_to_linear.spi1d" % (
-            "%s_%s" % (transfer_function, exposure_index))
+        lut = '%s_to_linear.spi1d' % (
+            '%s_%s' % (transfer_function, exposure_index))
 
         # Remove spaces and parentheses
         lut = lut.replace(' ', '_').replace(')', '_').replace('(', '_')
 
-        genlut.write_SPI_1d(lut_directory + "/" + lut,
+        genlut.write_SPI_1d(lut_directory + '/' + lut,
                             0.0,
                             1.0,
                             data,
                             lut_resolution_1d,
                             1)
 
-        # print("Writing %s" % lut)
+        # print('Writing %s' % lut)
         cs.to_reference_transforms.append({
             'type': 'lutFile',
             'path': lut,
@@ -175,8 +175,8 @@ def create_colorspaces(lut_directory, lut_resolution_1d):
 
     colorspaces = []
 
-    transfer_function = "V3 LogC"
-    gamut = "Wide Gamut"
+    transfer_function = 'V3 LogC'
+    gamut = 'Wide Gamut'
 
     # EIs = [160.0, 200.0, 250.0, 320.0, 400.0, 500.0, 640.0, 800.0,
     # 1000.0, 1280.0, 1600.0, 2000.0, 2560.0, 3200.0]
@@ -190,7 +190,7 @@ def create_colorspaces(lut_directory, lut_resolution_1d):
             gamut,
             transfer_function,
             EI,
-            "LogC",
+            'LogC',
             lut_directory,
             lut_resolution_1d)
         colorspaces.append(log_c_EI_full)
@@ -198,10 +198,10 @@ def create_colorspaces(lut_directory, lut_resolution_1d):
     # Linearization only
     for EI in [800]:
         log_c_EI_linearization = create_log_c(
-            "",
+            '',
             transfer_function,
             EI,
-            "LogC",
+            'LogC',
             lut_directory,
             lut_resolution_1d)
         colorspaces.append(log_c_EI_linearization)
@@ -209,9 +209,9 @@ def create_colorspaces(lut_directory, lut_resolution_1d):
     # Primaries
     log_c_EI_primaries = create_log_c(
         gamut,
-        "",
+        '',
         default_EI,
-        "LogC",
+        'LogC',
         lut_directory,
         lut_resolution_1d)
     colorspaces.append(log_c_EI_primaries)
index 5ac15b3..87e5e3c 100644 (file)
@@ -42,11 +42,11 @@ def create_c_log(gamut,
          Return value description.
     """
 
-    name = "%s - %s" % (transfer_function, gamut)
-    if transfer_function == "":
-        name = "Linear - %s" % gamut
-    if gamut == "":
-        name = "%s" % transfer_function
+    name = '%s - %s' % (transfer_function, gamut)
+    if transfer_function == '':
+        name = 'Linear - %s' % gamut
+    if gamut == '':
+        name = '%s' % transfer_function
 
     cs = ColorSpace(name)
     cs.description = name
@@ -71,13 +71,13 @@ def create_c_log(gamut,
 
     cs.to_reference_transforms = []
 
-    if transfer_function == "Canon-Log":
-        data = array.array('f', "\0" * lut_resolution_1d * 4)
+    if transfer_function == 'Canon-Log':
+        data = array.array('f', '\0' * lut_resolution_1d * 4)
         for c in range(lut_resolution_1d):
             data[c] = c_log_to_linear(1023.0 * c / (lut_resolution_1d - 1))
 
-        lut = "%s_to_linear.spi1d" % transfer_function
-        genlut.write_SPI_1d(lut_directory + "/" + lut,
+        lut = '%s_to_linear.spi1d' % transfer_function
+        genlut.write_SPI_1d(lut_directory + '/' + lut,
                             0.0,
                             1.0,
                             data,
@@ -162,49 +162,49 @@ def create_colorspaces(lut_directory, lut_resolution_1d):
 
     # Full conversion
     c_log_1 = create_c_log(
-        "Rec. 709 Daylight",
-        "Canon-Log",
-        "Canon-Log",
+        'Rec. 709 Daylight',
+        'Canon-Log',
+        'Canon-Log',
         lut_directory,
         lut_resolution_1d)
     colorspaces.append(c_log_1)
 
     c_log_2 = create_c_log(
-        "Rec. 709 Tungsten",
-        "Canon-Log",
-        "Canon-Log",
+        'Rec. 709 Tungsten',
+        'Canon-Log',
+        'Canon-Log',
         lut_directory,
         lut_resolution_1d)
     colorspaces.append(c_log_2)
 
     c_log_3 = create_c_log(
-        "DCI-P3 Daylight",
-        "Canon-Log",
-        "Canon-Log",
+        'DCI-P3 Daylight',
+        'Canon-Log',
+        'Canon-Log',
         lut_directory,
         lut_resolution_1d)
     colorspaces.append(c_log_3)
 
     c_log_4 = create_c_log(
-        "DCI-P3 Tungsten",
-        "Canon-Log",
-        "Canon-Log",
+        'DCI-P3 Tungsten',
+        'Canon-Log',
+        'Canon-Log',
         lut_directory,
         lut_resolution_1d)
     colorspaces.append(c_log_4)
 
     c_log_5 = create_c_log(
-        "Cinema Gamut Daylight",
-        "Canon-Log",
-        "Canon-Log",
+        'Cinema Gamut Daylight',
+        'Canon-Log',
+        'Canon-Log',
         lut_directory,
         lut_resolution_1d)
     colorspaces.append(c_log_5)
 
     c_log_6 = create_c_log(
-        "Cinema Gamut Tungsten",
-        "Canon-Log",
-        "Canon-Log",
+        'Cinema Gamut Tungsten',
+        'Canon-Log',
+        'Canon-Log',
         lut_directory,
         lut_resolution_1d)
     colorspaces.append(c_log_6)
@@ -212,57 +212,57 @@ def create_colorspaces(lut_directory, lut_resolution_1d):
     # Linearization only
     c_log_7 = create_c_log(
         '',
-        "Canon-Log",
-        "Canon-Log",
+        'Canon-Log',
+        'Canon-Log',
         lut_directory,
         lut_resolution_1d)
     colorspaces.append(c_log_7)
 
     # Primaries only
     c_log_8 = create_c_log(
-        "Rec. 709 Daylight",
-        "",
-        "Canon-Log",
+        'Rec. 709 Daylight',
+        '',
+        'Canon-Log',
         lut_directory,
         lut_resolution_1d)
     colorspaces.append(c_log_8)
 
     c_log_9 = create_c_log(
-        "Rec. 709 Tungsten",
-        "",
-        "Canon-Log",
+        'Rec. 709 Tungsten',
+        '',
+        'Canon-Log',
         lut_directory,
         lut_resolution_1d)
     colorspaces.append(c_log_9)
 
     c_log_10 = create_c_log(
-        "DCI-P3 Daylight",
-        "",
-        "Canon-Log",
+        'DCI-P3 Daylight',
+        '',
+        'Canon-Log',
         lut_directory,
         lut_resolution_1d)
     colorspaces.append(c_log_10)
 
     c_log_11 = create_c_log(
-        "DCI-P3 Tungsten",
-        "",
-        "Canon-Log",
+        'DCI-P3 Tungsten',
+        '',
+        'Canon-Log',
         lut_directory,
         lut_resolution_1d)
     colorspaces.append(c_log_11)
 
     c_log_12 = create_c_log(
-        "Cinema Gamut Daylight",
-        "",
-        "Canon-Log",
+        'Cinema Gamut Daylight',
+        '',
+        'Canon-Log',
         lut_directory,
         lut_resolution_1d)
     colorspaces.append(c_log_12)
 
     c_log_13 = create_c_log(
-        "Cinema Gamut Tungsten",
-        "",
-        "Canon-Log",
+        'Cinema Gamut Tungsten',
+        '',
+        'Canon-Log',
         lut_directory,
         lut_resolution_1d)
     colorspaces.append(c_log_13)
index 4c09151..b87eb4a 100644 (file)
@@ -42,11 +42,11 @@ def create_RED_log_film(gamut,
          Return value description.
     """
 
-    name = "%s - %s" % (transfer_function, gamut)
-    if transfer_function == "":
-        name = "Linear - %s" % gamut
-    if gamut == "":
-        name = "%s" % transfer_function
+    name = '%s - %s' % (transfer_function, gamut)
+    if transfer_function == '':
+        name = 'Linear - %s' % gamut
+    if gamut == '':
+        name = '%s' % transfer_function
 
     cs = ColorSpace(name)
     cs.description = name
@@ -70,12 +70,12 @@ def create_RED_log_film(gamut,
     cs.to_reference_transforms = []
 
     if transfer_function == 'REDlogFilm':
-        data = array.array('f', "\0" * lut_resolution_1d * 4)
+        data = array.array('f', '\0' * lut_resolution_1d * 4)
         for c in range(lut_resolution_1d):
             data[c] = cineon_to_linear(1023.0 * c / (lut_resolution_1d - 1))
 
-        lut = "CineonLog_to_linear.spi1d"
-        genlut.write_SPI_1d(lut_directory + "/" + lut,
+        lut = 'CineonLog_to_linear.spi1d'
+        genlut.write_SPI_1d(lut_directory + '/' + lut,
                             0.0,
                             1.0,
                             data,
@@ -92,36 +92,36 @@ def create_RED_log_film(gamut,
         cs.to_reference_transforms.append({
             'type': 'matrix',
             'matrix': mat44_from_mat33([0.532279, 0.376648, 0.091073,
-                                      0.046344, 0.974513, -0.020860,
-                                      -0.053976, -0.000320, 1.054267]),
+                                        0.046344, 0.974513, -0.020860,
+                                        -0.053976, -0.000320, 1.054267]),
             'direction': 'forward'})
     elif gamut == 'DRAGONcolor2':
         cs.to_reference_transforms.append({
             'type': 'matrix',
             'matrix': mat44_from_mat33([0.468452, 0.331484, 0.200064,
-                                      0.040787, 0.857658, 0.101553,
-                                      -0.047504, -0.000282, 1.047756]),
+                                        0.040787, 0.857658, 0.101553,
+                                        -0.047504, -0.000282, 1.047756]),
             'direction': 'forward'})
     elif gamut == 'REDcolor2':
         cs.to_reference_transforms.append({
             'type': 'matrix',
             'matrix': mat44_from_mat33([0.480997, 0.402289, 0.116714,
-                                      -0.004938, 1.000154, 0.004781,
-                                      -0.105257, 0.025320, 1.079907]),
+                                        -0.004938, 1.000154, 0.004781,
+                                        -0.105257, 0.025320, 1.079907]),
             'direction': 'forward'})
     elif gamut == 'REDcolor3':
         cs.to_reference_transforms.append({
             'type': 'matrix',
             'matrix': mat44_from_mat33([0.512136, 0.360370, 0.127494,
-                                      0.070377, 0.903884, 0.025737,
-                                      -0.020824, 0.017671, 1.003123]),
+                                        0.070377, 0.903884, 0.025737,
+                                        -0.020824, 0.017671, 1.003123]),
             'direction': 'forward'})
     elif gamut == 'REDcolor4':
         cs.to_reference_transforms.append({
             'type': 'matrix',
             'matrix': mat44_from_mat33([0.474202, 0.333677, 0.192121,
-                                      0.065164, 0.836932, 0.097901,
-                                      -0.019281, 0.016362, 1.002889]),
+                                        0.065164, 0.836932, 0.097901,
+                                        -0.019281, 0.016362, 1.002889]),
             'direction': 'forward'})
 
     cs.from_reference_transforms = []
@@ -147,91 +147,91 @@ def create_colorspaces(lut_directory, lut_resolution_1d):
 
     # Full conversion
     RED_log_film_dragon = create_RED_log_film(
-        "DRAGONcolor",
-        "REDlogFilm",
-        "REDlogFilm",
+        'DRAGONcolor',
+        'REDlogFilm',
+        'REDlogFilm',
         lut_directory,
         lut_resolution_1d)
     colorspaces.append(RED_log_film_dragon)
 
     RED_log_film_dragon2 = create_RED_log_film(
-        "DRAGONcolor2",
-        "REDlogFilm",
-        "REDlogFilm",
+        'DRAGONcolor2',
+        'REDlogFilm',
+        'REDlogFilm',
         lut_directory,
         lut_resolution_1d)
     colorspaces.append(RED_log_film_dragon2)
 
     RED_log_film_color2 = create_RED_log_film(
-        "REDcolor2",
-        "REDlogFilm",
-        "REDlogFilm",
+        'REDcolor2',
+        'REDlogFilm',
+        'REDlogFilm',
         lut_directory,
         lut_resolution_1d)
     colorspaces.append(RED_log_film_color2)
 
     RED_log_film_color3 = create_RED_log_film(
-        "REDcolor3",
-        "REDlogFilm",
-        "REDlogFilm",
+        'REDcolor3',
+        'REDlogFilm',
+        'REDlogFilm',
         lut_directory,
         lut_resolution_1d)
     colorspaces.append(RED_log_film_color3)
 
     RED_log_film_color4 = create_RED_log_film(
-        "REDcolor4",
-        "REDlogFilm",
-        "REDlogFilm",
+        'REDcolor4',
+        'REDlogFilm',
+        'REDlogFilm',
         lut_directory,
         lut_resolution_1d)
     colorspaces.append(RED_log_film_color4)
 
     # Linearization only
     RED_log_film_dragon = create_RED_log_film(
-        "",
-        "REDlogFilm",
-        "REDlogFilm",
+        '',
+        'REDlogFilm',
+        'REDlogFilm',
         lut_directory,
         lut_resolution_1d)
     colorspaces.append(RED_log_film_dragon)
 
     # Primaries only
     RED_log_film_dragon = create_RED_log_film(
-        "DRAGONcolor",
-        "",
-        "REDlogFilm",
+        'DRAGONcolor',
+        '',
+        'REDlogFilm',
         lut_directory,
         lut_resolution_1d)
     colorspaces.append(RED_log_film_dragon)
 
     RED_log_film_dragon2 = create_RED_log_film(
-        "DRAGONcolor2",
-        "",
-        "REDlogFilm",
+        'DRAGONcolor2',
+        '',
+        'REDlogFilm',
         lut_directory,
         lut_resolution_1d)
     colorspaces.append(RED_log_film_dragon2)
 
     RED_log_film_color2 = create_RED_log_film(
-        "REDcolor2",
-        "",
-        "REDlogFilm",
+        'REDcolor2',
+        '',
+        'REDlogFilm',
         lut_directory,
         lut_resolution_1d)
     colorspaces.append(RED_log_film_color2)
 
     RED_log_film_color3 = create_RED_log_film(
-        "REDcolor3",
-        "",
-        "REDlogFilm",
+        'REDcolor3',
+        '',
+        'REDlogFilm',
         lut_directory,
         lut_resolution_1d)
     colorspaces.append(RED_log_film_color3)
 
     RED_log_film_color4 = create_RED_log_film(
-        "REDcolor4",
-        "",
-        "REDlogFilm",
+        'REDcolor4',
+        '',
+        'REDlogFilm',
         lut_directory,
         lut_resolution_1d)
     colorspaces.append(RED_log_film_color4)
index 3867e87..7a428ac 100644 (file)
@@ -42,11 +42,11 @@ def create_s_log(gamut,
          Return value description.
     """
 
-    name = "%s - %s" % (transfer_function, gamut)
-    if transfer_function == "":
-        name = "Linear - %s" % gamut
-    if gamut == "":
-        name = "%s" % transfer_function
+    name = '%s - %s' % (transfer_function, gamut)
+    if transfer_function == '':
+        name = 'Linear - %s' % gamut
+    if gamut == '':
+        name = '%s' % transfer_function
 
     cs = ColorSpace(name)
     cs.description = name
@@ -96,20 +96,20 @@ def create_s_log(gamut,
 
     cs.to_reference_transforms = []
 
-    if transfer_function == "S-Log1":
-        data = array.array('f', "\0" * lut_resolution_1d * 4)
+    if transfer_function == 'S-Log1':
+        data = array.array('f', '\0' * lut_resolution_1d * 4)
         for c in range(lut_resolution_1d):
             data[c] = s_log1_to_linear(1023.0 * c / (lut_resolution_1d - 1))
 
-        lut = "%s_to_linear.spi1d" % transfer_function
-        genlut.write_SPI_1d(lut_directory + "/" + lut,
+        lut = '%s_to_linear.spi1d' % transfer_function
+        genlut.write_SPI_1d(lut_directory + '/' + lut,
                             0.0,
                             1.0,
                             data,
                             lut_resolution_1d,
                             1)
 
-        # print("Writing %s" % lut)
+        # print('Writing %s' % lut)
 
         cs.to_reference_transforms.append({
             'type': 'lutFile',
@@ -117,20 +117,20 @@ def create_s_log(gamut,
             'interpolation': 'linear',
             'direction': 'forward'
         })
-    elif transfer_function == "S-Log2":
-        data = array.array('f', "\0" * lut_resolution_1d * 4)
+    elif transfer_function == 'S-Log2':
+        data = array.array('f', '\0' * lut_resolution_1d * 4)
         for c in range(lut_resolution_1d):
             data[c] = s_log2_to_linear(1023.0 * c / (lut_resolution_1d - 1))
 
-        lut = "%s_to_linear.spi1d" % transfer_function
-        genlut.write_SPI_1d(lut_directory + "/" + lut,
+        lut = '%s_to_linear.spi1d' % transfer_function
+        genlut.write_SPI_1d(lut_directory + '/' + lut,
                             0.0,
                             1.0,
                             data,
                             lut_resolution_1d,
                             1)
 
-        # print("Writing %s" % lut)
+        # print('Writing %s' % lut)
 
         cs.to_reference_transforms.append({
             'type': 'lutFile',
@@ -138,20 +138,20 @@ def create_s_log(gamut,
             'interpolation': 'linear',
             'direction': 'forward'
         })
-    elif transfer_function == "S-Log3":
-        data = array.array('f', "\0" * lut_resolution_1d * 4)
+    elif transfer_function == 'S-Log3':
+        data = array.array('f', '\0' * lut_resolution_1d * 4)
         for c in range(lut_resolution_1d):
             data[c] = s_log3_to_linear(1023.0 * c / (lut_resolution_1d - 1))
 
-        lut = "%s_to_linear.spi1d" % transfer_function
-        genlut.write_SPI_1d(lut_directory + "/" + lut,
+        lut = '%s_to_linear.spi1d' % transfer_function
+        genlut.write_SPI_1d(lut_directory + '/' + lut,
                             0.0,
                             1.0,
                             data,
                             lut_resolution_1d,
                             1)
 
-        # print("Writing %s" % lut)
+        # print('Writing %s' % lut)
 
         cs.to_reference_transforms.append({
             'type': 'lutFile',
@@ -224,117 +224,117 @@ def create_colorspaces(lut_directory, lut_resolution_1d):
 
     # S-Log1
     s_log1_s_gamut = create_s_log(
-        "S-Gamut",
-        "S-Log1",
-        "S-Log",
+        'S-Gamut',
+        'S-Log1',
+        'S-Log',
         lut_directory,
         lut_resolution_1d)
     colorspaces.append(s_log1_s_gamut)
 
     # S-Log2
     s_log2_s_gamut = create_s_log(
-        "S-Gamut",
-        "S-Log2",
-        "S-Log2",
+        'S-Gamut',
+        'S-Log2',
+        'S-Log2',
         lut_directory,
         lut_resolution_1d)
     colorspaces.append(s_log2_s_gamut)
 
     s_log2_s_gamut_daylight = create_s_log(
-        "S-Gamut Daylight",
-        "S-Log2",
-        "S-Log2",
+        'S-Gamut Daylight',
+        'S-Log2',
+        'S-Log2',
         lut_directory,
         lut_resolution_1d)
     colorspaces.append(s_log2_s_gamut_daylight)
 
     s_log2_s_gamut_tungsten = create_s_log(
-        "S-Gamut Tungsten",
-        "S-Log2",
-        "S-Log2",
+        'S-Gamut Tungsten',
+        'S-Log2',
+        'S-Log2',
         lut_directory,
         lut_resolution_1d)
     colorspaces.append(s_log2_s_gamut_tungsten)
 
     # S-Log3
     s_log3_s_gamut3Cine = create_s_log(
-        "S-Gamut3.Cine",
-        "S-Log3",
-        "S-Log3",
+        'S-Gamut3.Cine',
+        'S-Log3',
+        'S-Log3',
         lut_directory,
         lut_resolution_1d)
     colorspaces.append(s_log3_s_gamut3Cine)
 
     s_log3_s_gamut3 = create_s_log(
-        "S-Gamut3",
-        "S-Log3",
-        "S-Log3",
+        'S-Gamut3',
+        'S-Log3',
+        'S-Log3',
         lut_directory,
         lut_resolution_1d)
     colorspaces.append(s_log3_s_gamut3)
 
     # Linearization only
     s_log1 = create_s_log(
-        "",
-        "S-Log1",
-        "S-Log",
+        '',
+        'S-Log1',
+        'S-Log',
         lut_directory,
         lut_resolution_1d)
     colorspaces.append(s_log1)
 
     s_log2 = create_s_log(
-        "",
-        "S-Log2",
-        "S-Log2",
+        '',
+        'S-Log2',
+        'S-Log2',
         lut_directory,
         lut_resolution_1d)
     colorspaces.append(s_log2)
 
     s_log3 = create_s_log(
-        "",
-        "S-Log3",
-        "S-Log3",
+        '',
+        'S-Log3',
+        'S-Log3',
         lut_directory,
         lut_resolution_1d)
     colorspaces.append(s_log3)
 
     # Primaries only
     s_gamut = create_s_log(
-        "S-Gamut",
-        "",
-        "S-Log",
+        'S-Gamut',
+        '',
+        'S-Log',
         lut_directory,
         lut_resolution_1d)
     colorspaces.append(s_gamut)
 
     s_gamut_daylight = create_s_log(
-        "S-Gamut Daylight",
-        "",
-        "S-Log2",
+        'S-Gamut Daylight',
+        '',
+        'S-Log2',
         lut_directory,
         lut_resolution_1d)
     colorspaces.append(s_gamut_daylight)
 
     s_gamut_tungsten = create_s_log(
-        "S-Gamut Tungsten",
-        "",
-        "S-Log2",
+        'S-Gamut Tungsten',
+        '',
+        'S-Log2',
         lut_directory,
         lut_resolution_1d)
     colorspaces.append(s_gamut_tungsten)
 
     s_gamut3Cine = create_s_log(
-        "S-Gamut3.Cine",
-        "",
-        "S-Log3",
+        'S-Gamut3.Cine',
+        '',
+        'S-Log3',
         lut_directory,
         lut_resolution_1d)
     colorspaces.append(s_gamut3Cine)
 
     s_gamut3 = create_s_log(
-        "S-Gamut3",
-        "",
-        "S-Log3",
+        'S-Gamut3',
+        '',
+        'S-Log3',
         lut_directory,
         lut_resolution_1d)
     colorspaces.append(s_gamut3)
index e0d4dfa..78bc9f6 100644 (file)
@@ -52,7 +52,7 @@ def generate_1d_LUT_image(ramp_1d_path,
          Return value description.
     """
 
-    # print("Generate 1d LUT image - %s" % ramp1dPath)
+    # print('Generate 1d LUT image - %s' % ramp1dPath)
 
     # open image
     format = os.path.splitext(ramp_1d_path)[1]
@@ -68,8 +68,8 @@ def generate_1d_LUT_image(ramp_1d_path,
 
     ramp.open(ramp_1d_path, spec, oiio.Create)
 
-    data = array.array("f",
-                       "\0" * spec.width * spec.height * spec.nchannels * 4)
+    data = array.array('f',
+                       '\0' * spec.width * spec.height * spec.nchannels * 4)
     for i in range(resolution):
         value = float(i) / (resolution - 1) * (
             max_value - min_value) + min_value
@@ -100,17 +100,17 @@ def write_SPI_1d(filename, from_min, from_max, data, entries, channels):
     """
 
     f = file(filename, 'w')
-    f.write("Version 1\n")
-    f.write("From %f %f\n" % (from_min, from_max))
-    f.write("Length %d\n" % entries)
-    f.write("Components %d\n" % (min(3, channels)))
-    f.write("{\n")
+    f.write('Version 1\n')
+    f.write('From %f %f\n' % (from_min, from_max))
+    f.write('Length %d\n' % entries)
+    f.write('Components %d\n' % (min(3, channels)))
+    f.write('{\n')
     for i in range(0, entries):
-        entry = ""
+        entry = ''
         for j in range(0, min(3, channels)):
-            entry = "%s %s" % (entry, data[i * channels + j])
-        f.write("        %s\n" % entry)
-    f.write("}\n")
+            entry = '%s %s' % (entry, data[i * channels + j])
+        f.write('        %s\n' % entry)
+    f.write('}\n')
     f.close()
 
 
@@ -133,7 +133,7 @@ def generate_1d_LUT_from_image(ramp_1d_path,
     """
 
     if output_path is None:
-        output_path = ramp_1d_path + ".spi1d"
+        output_path = ramp_1d_path + '.spi1d'
 
     # open image
     ramp = oiio.ImageInput.open(ramp_1d_path)
@@ -169,15 +169,15 @@ def generate_3d_LUT_image(ramp_3d_path, resolution=32):
          Return value description.
     """
 
-    args = ["--generate",
-            "--cubesize",
+    args = ['--generate',
+            '--cubesize',
             str(resolution),
-            "--maxwidth",
+            '--maxwidth',
             str(resolution * resolution),
-            "--output",
+            '--output',
             ramp_3d_path]
-    lut_extract = Process(description="generate a 3d LUT image",
-                          cmd="ociolutimage",
+    lut_extract = Process(description='generate a 3d LUT image',
+                          cmd='ociolutimage',
                           args=args)
     lut_extract.execute()
 
@@ -198,19 +198,19 @@ def generate_3d_LUT_from_image(ramp_3d_path, output_path=None, resolution=32):
     """
 
     if output_path is None:
-        output_path = ramp_3d_path + ".spi3d"
+        output_path = ramp_3d_path + '.spi3d'
 
-    args = ["--extract",
-            "--cubesize",
+    args = ['--extract',
+            '--cubesize',
             str(resolution),
-            "--maxwidth",
+            '--maxwidth',
             str(resolution * resolution),
-            "--input",
+            '--input',
             ramp_3d_path,
-            "--output",
+            '--output',
             output_path]
-    lut_extract = Process(description="extract a 3d LUT",
-                          cmd="ociolutimage",
+    lut_extract = Process(description='extract a 3d LUT',
+                          cmd='ociolutimage',
                           args=args)
     lut_extract.execute()
 
@@ -239,8 +239,8 @@ def apply_CTL_to_image(input_image,
     if len(ctl_paths) > 0:
         ctlenv = os.environ
         if aces_CTL_directory != None:
-            if os.path.split(aces_CTL_directory)[1] != "utilities":
-                ctl_module_path = "%s/utilities" % aces_CTL_directory
+            if os.path.split(aces_CTL_directory)[1] != 'utilities':
+                ctl_module_path = '%s/utilities' % aces_CTL_directory
             else:
                 ctl_module_path = aces_CTL_directory
             ctlenv['CTL_MODULE_PATH'] = ctl_module_path
@@ -248,20 +248,20 @@ def apply_CTL_to_image(input_image,
         args = []
         for ctl in ctl_paths:
             args += ['-ctl', ctl]
-        args += ["-force"]
-        # args += ["-verbose"]
-        args += ["-input_scale", str(input_scale)]
-        args += ["-output_scale", str(output_scale)]
-        args += ["-global_param1", "aIn", "1.0"]
+        args += ['-force']
+        # args += ['-verbose']
+        args += ['-input_scale', str(input_scale)]
+        args += ['-output_scale', str(output_scale)]
+        args += ['-global_param1', 'aIn', '1.0']
         for key, value in global_params.iteritems():
-            args += ["-global_param1", key, str(value)]
+            args += ['-global_param1', key, str(value)]
         args += [input_image]
         args += [output_image]
 
-        # print("args : %s" % args)
+        # print('args : %s' % args)
 
-        ctlp = Process(description="a ctlrender process",
-                       cmd="ctlrender",
+        ctlp = Process(description='a ctlrender process',
+                       cmd='ctlrender',
                        args=args, env=ctlenv)
 
         ctlp.execute()
@@ -283,12 +283,12 @@ def convert_bit_depth(input_image, output_image, depth):
     """
 
     args = [input_image,
-            "-d",
+            '-d',
             depth,
-            "-o",
+            '-o',
             output_image]
-    convert = Process(description="convert image bit depth",
-                      cmd="oiiotool",
+    convert = Process(description='convert image bit depth',
+                      cmd='oiiotool',
                       args=args)
     convert.execute()
 
@@ -323,21 +323,21 @@ def generate_1d_LUT_from_CTL(lut_path,
 
     lut_path_base = os.path.splitext(lut_path)[0]
 
-    identity_LUT_image_float = lut_path_base + ".float.tiff"
+    identity_LUT_image_float = lut_path_base + '.float.tiff'
     generate_1d_LUT_image(identity_LUT_image_float,
                           lut_resolution,
                           min_value,
                           max_value)
 
     if identity_LUT_bit_depth != 'half':
-        identity_LUT_image = lut_path_base + ".uint16.tiff"
+        identity_LUT_image = lut_path_base + '.uint16.tiff'
         convert_bit_depth(identity_LUT_image_float,
                           identity_LUT_image,
                           identity_LUT_bit_depth)
     else:
         identity_LUT_image = identity_LUT_image_float
 
-    transformed_LUT_image = lut_path_base + ".transformed.exr"
+    transformed_LUT_image = lut_path_base + '.transformed.exr'
     apply_CTL_to_image(identity_LUT_image,
                        transformed_LUT_image,
                        ctl_paths,
@@ -387,13 +387,13 @@ def correct_LUT_image(transformed_LUT_image,
 
     # rotate or not
     if width != lut_resolution * lut_resolution or height != lut_resolution:
-        print(("Correcting image as resolution is off. "
-               "Found %d x %d. Expected %d x %d") % (
+        print(('Correcting image as resolution is off. '
+               'Found %d x %d. Expected %d x %d') % (
                   width,
                   height,
                   lut_resolution * lut_resolution,
                   lut_resolution))
-        print("Generating %s" % corrected_LUT_image)
+        print('Generating %s' % corrected_LUT_image)
 
         #
         # We're going to generate a new correct image
@@ -417,8 +417,8 @@ def correct_LUT_image(transformed_LUT_image,
 
         correct.open(corrected_LUT_image, correct_spec, oiio.Create)
 
-        dest_data = array.array("f",
-                                ("\0" * correct_spec.width *
+        dest_data = array.array('f',
+                                ('\0' * correct_spec.width *
                                  correct_spec.height *
                                  correct_spec.nchannels * 4))
         for j in range(0, correct_spec.height):
@@ -471,21 +471,21 @@ def generate_3d_LUT_from_CTL(lut_path,
 
     lut_path_base = os.path.splitext(lut_path)[0]
 
-    identity_LUT_image_float = lut_path_base + ".float.tiff"
+    identity_LUT_image_float = lut_path_base + '.float.tiff'
     generate_3d_LUT_image(identity_LUT_image_float, lut_resolution)
 
     if identity_LUT_bit_depth != 'half':
         identity_LUT_image = (lut_path_base +
-                              "." +
+                              '.' +
                               identity_LUT_bit_depth +
-                              ".tiff")
+                              '.tiff')
         convert_bit_depth(identity_LUT_image_float,
                           identity_LUT_image,
                           identity_LUT_bit_depth)
     else:
         identity_LUT_image = identity_LUT_image_float
 
-    transformed_LUT_image = lut_path_base + ".transformed.exr"
+    transformed_LUT_image = lut_path_base + '.transformed.exr'
     apply_CTL_to_image(identity_LUT_image,
                        transformed_LUT_image,
                        ctl_paths,
@@ -494,7 +494,7 @@ def generate_3d_LUT_from_CTL(lut_path,
                        global_params,
                        aces_CTL_directory)
 
-    corrected_LUT_image = lut_path_base + ".correct.exr"
+    corrected_LUT_image = lut_path_base + '.correct.exr'
     corrected_LUT_image = correct_LUT_image(transformed_LUT_image,
                                             corrected_LUT_image,
                                             lut_resolution)
@@ -534,22 +534,22 @@ def main():
         version='0.01',
         usage='%prog [options]')
 
-    p.add_option('--lut', '-l', type="string", default="")
-    p.add_option('--ctl', '-c', type="string", action="append")
-    p.add_option('--lut_resolution_1d', '', type="int", default=1024)
-    p.add_option('--lut_resolution_3d', '', type="int", default=33)
-    p.add_option('--ctlReleasePath', '-r', type="string", default="")
-    p.add_option('--bitDepth', '-b', type="string", default="float")
-    p.add_option('--keepTempImages', '', action="store_true")
-    p.add_option('--minValue', '', type="float", default=0.0)
-    p.add_option('--maxValue', '', type="float", default=1.0)
-    p.add_option('--inputScale', '', type="float", default=1.0)
-    p.add_option('--outputScale', '', type="float", default=1.0)
-    p.add_option('--ctlRenderParam', '-p', type="string", nargs=2,
-                 action="append")
-
-    p.add_option('--generate1d', '', action="store_true")
-    p.add_option('--generate3d', '', action="store_true")
+    p.add_option('--lut', '-l', type='string', default='')
+    p.add_option('--ctl', '-c', type='string', action='append')
+    p.add_option('--lut_resolution_1d', '', type='int', default=1024)
+    p.add_option('--lut_resolution_3d', '', type='int', default=33)
+    p.add_option('--ctlReleasePath', '-r', type='string', default='')
+    p.add_option('--bitDepth', '-b', type='string', default='float')
+    p.add_option('--keepTempImages', '', action='store_true')
+    p.add_option('--minValue', '', type='float', default=0.0)
+    p.add_option('--maxValue', '', type='float', default=1.0)
+    p.add_option('--inputScale', '', type='float', default=1.0)
+    p.add_option('--outputScale', '', type='float', default=1.0)
+    p.add_option('--ctlRenderParam', '-p', type='string', nargs=2,
+                 action='append')
+
+    p.add_option('--generate1d', '', action='store_true')
+    p.add_option('--generate3d', '', action='store_true')
 
     options, arguments = p.parse_args()
 
@@ -582,28 +582,28 @@ def main():
         args_start = len(sys.argv) + 1
         args = []
 
-    # print("command line : \n%s\n" % " ".join(sys.argv))
+    # print('command line : \n%s\n' % ' '.join(sys.argv))
 
     #
     # Generate LUTs
     #
     if generate_1d:
-        print("1D LUT generation options")
+        print('1D LUT generation options')
     else:
-        print("3D LUT generation options")
-
-    print("lut                 : %s" % lut)
-    print("ctls                : %s" % ctls)
-    print("lut res 1d          : %s" % lut_resolution_1d)
-    print("lut res 3d          : %s" % lut_resolution_3d)
-    print("min value           : %s" % min_value)
-    print("max value           : %s" % max_value)
-    print("input scale         : %s" % input_scale)
-    print("output scale        : %s" % output_scale)
-    print("ctl render params   : %s" % params)
-    print("ctl release path    : %s" % ctl_release_path)
-    print("bit depth of input  : %s" % bitdepth)
-    print("cleanup temp images : %s" % cleanup)
+        print('3D LUT generation options')
+
+    print('lut                 : %s' % lut)
+    print('ctls                : %s' % ctls)
+    print('lut res 1d          : %s' % lut_resolution_1d)
+    print('lut res 3d          : %s' % lut_resolution_3d)
+    print('min value           : %s' % min_value)
+    print('max value           : %s' % max_value)
+    print('input scale         : %s' % input_scale)
+    print('output scale        : %s' % output_scale)
+    print('ctl render params   : %s' % params)
+    print('ctl release path    : %s' % ctl_release_path)
+    print('bit depth of input  : %s' % bitdepth)
+    print('cleanup temp images : %s' % cleanup)
 
     if generate_1d:
         generate_1d_LUT_from_CTL(lut,
@@ -629,8 +629,8 @@ def main():
                                  cleanup,
                                  ctl_release_path)
     else:
-        print(("\n\nNo LUT generated. "
-               "You must choose either 1D or 3D LUT generation\n\n"))
+        print(('\n\nNo LUT generated. '
+               'You must choose either 1D or 3D LUT generation\n\n'))
 
 
 if __name__ == '__main__':
index 6445b46..ad0b02e 100755 (executable)
@@ -39,7 +39,7 @@ def read_text(text_file):
          Return value description.\r
     """\r
 \r
-    if (text_file != ""):\r
+    if (text_file != ''):\r
         fp = open(text_file, 'rb')\r
         # Create a text/plain message\r
         text = (fp.read())\r
@@ -62,7 +62,7 @@ def write_text(text, text_file):
          Return value description.\r
     """\r
 \r
-    if (text_file != ""):\r
+    if (text_file != ''):\r
         fp = open(text_file, 'wb')\r
         # Create a text/plain message\r
         fp.write(text)\r
@@ -131,7 +131,7 @@ class Process:
 \r
         if self.end and self.start:\r
             delta = (self.end - self.start)\r
-            formatted = "%s.%s" % (delta.days * 86400 + delta.seconds,\r
+            formatted = '%s.%s' % (delta.days * 86400 + delta.seconds,\r
                                    int(math.floor(delta.microseconds / 1e3)))\r
         else:\r
             formatted = None\r
@@ -156,15 +156,15 @@ class Process:
             indent = '\t' * write_dict['indentationLevel']\r
             if write_dict['format'] == 'xml':\r
                 if start_stop == 'start':\r
-                    write_dict['logHandle'].write("%s<%s>\n" % (indent, key))\r
+                    write_dict['logHandle'].write('%s<%s>\n' % (indent, key))\r
                 elif start_stop == 'stop':\r
-                    write_dict['logHandle'].write("%s</%s>\n" % (indent, key))\r
+                    write_dict['logHandle'].write('%s</%s>\n' % (indent, key))\r
                 else:\r
                     write_dict['logHandle'].write(\r
-                        "%s<%s>%s</%s>\n" % (indent, key, value, key))\r
+                        '%s<%s>%s</%s>\n' % (indent, key, value, key))\r
             else:  # writeDict['format'] == 'txt':\r
                 write_dict['logHandle'].write(\r
-                    "%s%40s : %s\n" % (indent, key, value))\r
+                    '%s%40s : %s\n' % (indent, key, value))\r
 \r
     def write_log_header(self, write_dict):\r
         """\r
@@ -189,22 +189,22 @@ class Process:
             user = os.getlogin()\r
         except:\r
             try:\r
-                user = os.getenv("USERNAME")\r
+                user = os.getenv('USERNAME')\r
                 if user is None:\r
-                    user = os.getenv("USER")\r
+                    user = os.getenv('USER')\r
             except:\r
-                user = "unknown_user"\r
+                user = 'unknown_user'\r
         try:\r
             (sysname, nodename, release, version, machine,\r
              processor) = platform.uname()\r
         except:\r
             (sysname, nodename, release, version, machine, processor) = (\r
-                "unknown_sysname", "unknown_nodename", "unknown_release",\r
-                "unknown_version", "unknown_machine", "unknown_processor")\r
+                'unknown_sysname', 'unknown_nodename', 'unknown_release',\r
+                'unknown_version', 'unknown_machine', 'unknown_processor')\r
         try:\r
             hostname = platform.node()\r
         except:\r
-            hostname = "unknown_hostname"\r
+            hostname = 'unknown_hostname'\r
 \r
         self.write_key(write_dict, 'process', None, 'start')\r
         write_dict['indentationLevel'] += 1\r
@@ -283,11 +283,11 @@ class Process:
             if self.log:\r
                 self.write_key(write_dict, 'output', None, 'start')\r
                 if format == 'xml':\r
-                    log_handle.write("<![CDATA[\n")\r
+                    log_handle.write('<![CDATA[\n')\r
                 for line in self.log:\r
-                    log_handle.write('%s%s\n' % ("", line))\r
+                    log_handle.write('%s%s\n' % ('', line))\r
                 if format == 'xml':\r
-                    log_handle.write("]]>\n")\r
+                    log_handle.write(']]>\n')\r
                 self.write_key(write_dict, 'output', None, 'stop')\r
 \r
             self.write_log_footer(write_dict)\r
@@ -314,22 +314,22 @@ class Process:
                 try:\r
                     log_handle = open(log_filename,\r
                                       mode='wt',\r
-                                      encoding="utf-8")\r
+                                      encoding='utf-8')\r
                 # 2.6\r
                 except:\r
                     log_handle = open(log_filename,\r
                                       mode='wt')\r
             except:\r
-                print("Couldn't open log : %s" % log_filename)\r
+                print('Couldn\'t open log : %s' % log_filename)\r
                 log_handle = None\r
 \r
         if log_handle:\r
             if header:\r
                 if format == 'xml':\r
-                    log_handle.write("<![CDATA[\n")\r
+                    log_handle.write('<![CDATA[\n')\r
                 log_handle.write(header)\r
                 if format == 'xml':\r
-                    log_handle.write("]]>\n")\r
+                    log_handle.write(']]>\n')\r
             self.write_log(log_handle)\r
             log_handle.close()\r
 \r
@@ -350,7 +350,7 @@ class Process:
 \r
         self.log.append(line.rstrip())\r
         if self.echo:\r
-            print("%s" % line.rstrip())\r
+            print('%s' % line.rstrip())\r
 \r
     def execute(self):\r
         """\r
@@ -383,9 +383,9 @@ class Process:
         if self.echo:\r
             if sp:\r
                 print(\r
-                    "\n%s : %s\n" % (self.__class__, sp.list2cmdline(cmdargs)))\r
+                    '\n%s : %s\n' % (self.__class__, sp.list2cmdline(cmdargs)))\r
             else:\r
-                print("\n%s : %s\n" % (self.__class__, " ".join(cmdargs)))\r
+                print('\n%s : %s\n' % (self.__class__, ' '.join(cmdargs)))\r
 \r
         # intialize a few variables that may or may not be set later\r
         process = None\r
@@ -399,10 +399,10 @@ class Process:
             # Using subprocess\r
             if sp:\r
                 if self.batch_wrapper:\r
-                    cmd = " ".join(cmdargs)\r
-                    tmp_wrapper = os.path.join(self.cwd, "process.bat")\r
+                    cmd = ' '.join(cmdargs)\r
+                    tmp_wrapper = os.path.join(self.cwd, 'process.bat')\r
                     write_text(cmd, tmp_wrapper)\r
-                    print("%s : Running process through wrapper %s\n" % (\r
+                    print('%s : Running process through wrapper %s\n' % (\r
                         self.__class__, tmp_wrapper))\r
                     process = sp.Popen([tmp_wrapper], stdout=sp.PIPE,\r
                                        stderr=sp.STDOUT,\r
@@ -421,14 +421,14 @@ class Process:
 \r
                 stdin, stdout = os.popen4(cmdargs, 'r')\r
         except:\r
-            print("Couldn't execute command : %s" % cmdargs[0])\r
+            print('Couldn\'t execute command : %s' % cmdargs[0])\r
             traceback.print_exc()\r
 \r
         # Using subprocess\r
         if sp:\r
             if process != None:\r
                 # pid = process.pid\r
-                # log.logLine("process id %s\n" % pid)\r
+                # log.logLine('process id %s\n' % pid)\r
 \r
                 try:\r
                     # This is more proper python, and resolves some issues with\r
@@ -443,7 +443,7 @@ class Process:
                     # So we go with the, um, uglier  option below\r
 \r
                     # This is now used to ensure that the process has finished\r
-                    line = ""\r
+                    line = ''\r
                     while line != None and process.poll() is None:\r
                         try:\r
                             line = process.stdout.readline()\r
@@ -451,12 +451,12 @@ class Process:
                             break\r
                         # 3.1\r
                         try:\r
-                            self.log_line(str(line, encoding="utf-8"))\r
+                            self.log_line(str(line, encoding='utf-8'))\r
                         # 2.6\r
                         except:\r
                             self.log_line(line)\r
                 except:\r
-                    self.log_line("Logging error : %s" % sys.exc_info()[0])\r
+                    self.log_line('Logging error : %s' % sys.exc_info()[0])\r
 \r
                 self.status = process.returncode\r
 \r
@@ -465,14 +465,14 @@ class Process:
                         os.remove(tmp_wrapper)\r
                     except:\r
                         print(\r
-                            "Couldn't remove temp wrapper : %s" % tmp_wrapper)\r
+                            'Couldn\'t remove temp wrapper : %s' % tmp_wrapper)\r
                         traceback.print_exc()\r
 \r
         # Using os.popen4\r
         else:\r
             exit_code = -1\r
             try:\r
-                # print("reading stdout lines")\r
+                # print('reading stdout lines')\r
                 stdout_lines = stdout.readlines()\r
                 exit_code = stdout.close()\r
 \r
@@ -491,7 +491,7 @@ class Process:
                 if not exit_code:\r
                     exit_code = 0\r
             except:\r
-                self.log_line("Logging error : %s" % sys.exc_info()[0])\r
+                self.log_line('Logging error : %s' % sys.exc_info()[0])\r
 \r
             self.status = exit_code\r
 \r
@@ -519,7 +519,7 @@ class ProcessList(Process):
         """\r
 \r
         Process.__init__(self, description, None, None, cwd, env)\r
-        "Initialize the standard class variables"\r
+        'Initialize the standard class variables'\r
         self.processes = []\r
         self.blocking = blocking\r
 \r
@@ -548,15 +548,15 @@ class ProcessList(Process):
                 if isinstance(child, ProcessList):\r
                     child.generate_report(write_dict)\r
 \r
-                child_result = ""\r
+                child_result = ''\r
                 key = child.description\r
                 value = child.status\r
                 if write_dict['format'] == 'xml':\r
                     child_result = (\r
-                        "%s<result description=\"%s\">%s</result>" % (\r
+                        '%s<result description=\'%s\'>%s</result>' % (\r
                             indent, key, value))\r
                 else:  # writeDict['format'] == 'txt':\r
-                    child_result = ("%s%40s : %s" % (indent, key, value))\r
+                    child_result = ('%s%40s : %s' % (indent, key, value))\r
                 self.log.append(child_result)\r
 \r
                 if child.status != 0:\r
@@ -566,7 +566,7 @@ class ProcessList(Process):
             else:\r
                 self.status = 0\r
         else:\r
-            self.log = ["No child processes available to generate a report"]\r
+            self.log = ['No child processes available to generate a report']\r
             self.status = -1\r
 \r
     def write_log_header(self, write_dict):\r
@@ -643,7 +643,7 @@ class ProcessList(Process):
             if self.log:\r
                 self.write_key(write_dict, 'output', None, 'start')\r
                 for line in self.log:\r
-                    log_handle.write('%s%s\n' % ("", line))\r
+                    log_handle.write('%s%s\n' % ('', line))\r
                 self.write_key(write_dict, 'output', None, 'stop')\r
 \r
             if self.processes:\r
@@ -680,13 +680,13 @@ class ProcessList(Process):
                     try:\r
                         child.execute()\r
                     except:\r
-                        print("%s : caught exception in child class %s" % (\r
+                        print('%s : caught exception in child class %s' % (\r
                             self.__class__, child.__class__))\r
                         traceback.print_exc()\r
                         child.status = -1\r
 \r
                     if self.blocking and child.status != 0:\r
-                        print("%s : child class %s finished with an error" % (\r
+                        print('%s : child class %s finished with an error' % (\r
                             self.__class__, child.__class__))\r
                         self.status = -1\r
                         break\r
@@ -735,17 +735,17 @@ def main():
         args = []\r
 \r
     if cmd is None:\r
-        print("process: No command specified")\r
+        print('process: No command specified')\r
 \r
     #\r
     # Test regular logging\r
     #\r
-    process = Process(description="a process", cmd=cmd, args=args)\r
+    process = Process(description='a process', cmd=cmd, args=args)\r
 \r
     #\r
     # Test report generation and writing a log\r
     #\r
-    process_list = ProcessList("a process list")\r
+    process_list = ProcessList('a process list')\r
     process_list.processes.append(process)\r
     process_list.echo = True\r
     process_list.execute()\r