Skip to content

[documentation][python] GradingPrimary: missing expected value type doc #1640

@MrLixm

Description

@MrLixm

Hello,
When looking at the GradingPrimary class documentation (https://opencolorio.readthedocs.io/en/latest/api/grading_transforms.html),
we can see a bunch of property is available but none of them specifies which type of value is expected when set.

This would have not been an issue if they all except the same type but seems some except a GradingRGBM instance while others just expect a float.

Would be cool to have in the documentation what type is expected.

Here are the tests I ran to check who accepts what

import unittest

import PyOpenColorIO as ocio


class OcioGradingPrimary(unittest.TestCase):
    @staticmethod
    def to_rgbm(v):
        rgbm = ocio.GradingRGBM()
        rgbm.master = v
        return rgbm

    def test_properties(self):

        gp = ocio.GradingPrimary(ocio.GRADING_LIN)

        gp.brightness = self.to_rgbm(0.18)
        gp.clampBlack = 0.18
        gp.clampWhite = 0.18
        gp.contrast = self.to_rgbm(0.18)
        gp.exposure = self.to_rgbm(0.18)
        gp.gain = self.to_rgbm(0.18)
        gp.gamma = self.to_rgbm(0.18)
        gp.lift = self.to_rgbm(0.18)
        gp.offset = self.to_rgbm(0.18)
        gp.pivot = 0.18
        gp.saturation = 0.18

        gp.brightness = self.to_rgbm(0.18)
        with self.assertRaises(TypeError): gp.clampBlack = self.to_rgbm(0.18)
        with self.assertRaises(TypeError): gp.clampWhite = self.to_rgbm(0.18)
        gp.contrast = self.to_rgbm(0.18)
        gp.exposure = self.to_rgbm(0.18)
        gp.gain = self.to_rgbm(0.18)
        gp.gamma = self.to_rgbm(0.18)
        gp.lift = self.to_rgbm(0.18)
        gp.offset = self.to_rgbm(0.18)
        with self.assertRaises(TypeError): gp.pivot = self.to_rgbm(0.18)
        with self.assertRaises(TypeError): gp.saturation = self.to_rgbm(0.18)


if __name__ == "__main__":
    unittest.main()

Cheers.
Liam.

Metadata

Metadata

Assignees

No one assigned

    Labels

    DocumentationDocumentation related development and/or updates.good first issueStandard label for new developers to locate good issues to tackle to learn about OCIO development.help wantedIssues that the TSC has decided are worth implementing, but don't currently have the dev resources.

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions