Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PR: Add various new literals for typing annotations. #1198

Merged
merged 4 commits into from
Sep 15, 2023

Conversation

KelSolaar
Copy link
Member

@KelSolaar KelSolaar commented Sep 14, 2023

Summary

This PR adds various new literals for typing annotations. They should be convenient for packages using Colour and willing to add typing annotations.

They are automatically generated as part of the build/release process using a new invoke tasks.

# NOTE: The following literals are automatically generated by the *invoke*
# *literalise* task. Please do not edit this section manually!

# LITERALISE::BEGIN
LiteralChromaticAdaptationTransform = Literal[
    "Bianco 2010",
    "Bianco PC 2010",
    "Bradford",
    "CAT02",
    "CAT02 Brill 2008",
    "CAT16",
    "CMCCAT2000",
    "CMCCAT97",
    "Fairchild",
    "Sharp",
    "Von Kries",
    "XYZ Scaling",
]
LiteralColourspaceModel = Literal[
    "CAM02LCD",
    "CAM02SCD",
    "CAM02UCS",
    "CAM16LCD",
    "CAM16SCD",
    "CAM16UCS",
    "CIE Lab",
    "CIE Luv",
    "CIE UCS",
    "CIE UVW",
    "CIE XYZ",
    "CIE xyY",
    "DIN99",
    "Hunter Lab",
    "Hunter Rdab",
    "ICaCb",
    "ICtCp",
    "IPT",
    "IPT Ragoo 2021",
    "IgPgTg",
    "Jzazbz",
    "OSA UCS",
    "Oklab",
    "Yrg",
    "hdr-CIELAB",
    "hdr-IPT",
]
LiteralRGBColourspace = Literal[
    "ACES2065-1",
    "ACEScc",
    "ACEScct",
    "ACEScg",
    "ACESproxy",
    "ALEXA Wide Gamut",
    "ARRI Wide Gamut 3",
    "ARRI Wide Gamut 4",
    "Adobe RGB (1998)",
    "Adobe Wide Gamut RGB",
    "Apple RGB",
    "Best RGB",
    "Beta RGB",
    "Blackmagic Wide Gamut",
    "CIE RGB",
    "Cinema Gamut",
    "ColorMatch RGB",
    "DCDM XYZ",
    "DCI-P3",
    "DCI-P3-P",
    "DJI D-Gamut",
    "DRAGONcolor",
    "DRAGONcolor2",
    "DaVinci Wide Gamut",
    "Display P3",
    "Don RGB 4",
    "EBU Tech. 3213-E",
    "ECI RGB v2",
    "ERIMM RGB",
    "Ekta Space PS 5",
    "F-Gamut",
    "FilmLight E-Gamut",
    "ITU-R BT.2020",
    "ITU-R BT.470 - 525",
    "ITU-R BT.470 - 625",
    "ITU-R BT.709",
    "ITU-T H.273 - 22 Unspecified",
    "ITU-T H.273 - Generic Film",
    "Max RGB",
    "N-Gamut",
    "NTSC (1953)",
    "NTSC (1987)",
    "P3-D65",
    "PLASA ANSI E1.54",
    "Pal/Secam",
    "ProPhoto RGB",
    "Protune Native",
    "REDWideGamutRGB",
    "REDcolor",
    "REDcolor2",
    "REDcolor3",
    "REDcolor4",
    "RIMM RGB",
    "ROMM RGB",
    "Russell RGB",
    "S-Gamut",
    "S-Gamut3",
    "S-Gamut3.Cine",
    "SMPTE 240M",
    "SMPTE C",
    "Sharp RGB",
    "V-Gamut",
    "Venice S-Gamut3",
    "Venice S-Gamut3.Cine",
    "Xtreme RGB",
    "aces",
    "adobe1998",
    "prophoto",
    "sRGB",
]
LiteralLogEncoding = Literal[
    "ACEScc",
    "ACEScct",
    "ACESproxy",
    "ARRI LogC3",
    "ARRI LogC4",
    "Canon Log",
    "Canon Log 2",
    "Canon Log 3",
    "Cineon",
    "D-Log",
    "ERIMM RGB",
    "F-Log",
    "F-Log2",
    "Filmic Pro 6",
    "L-Log",
    "Log2",
    "Log3G10",
    "Log3G12",
    "N-Log",
    "PLog",
    "Panalog",
    "Protune",
    "REDLog",
    "REDLogFilm",
    "S-Log",
    "S-Log2",
    "S-Log3",
    "T-Log",
    "V-Log",
    "ViperLog",
]
LiteralLogDecoding = Literal[
    "ACEScc",
    "ACEScct",
    "ACESproxy",
    "ARRI LogC3",
    "ARRI LogC4",
    "Canon Log",
    "Canon Log 2",
    "Canon Log 3",
    "Cineon",
    "D-Log",
    "ERIMM RGB",
    "F-Log",
    "F-Log2",
    "Filmic Pro 6",
    "L-Log",
    "Log2",
    "Log3G10",
    "Log3G12",
    "N-Log",
    "PLog",
    "Panalog",
    "Protune",
    "REDLog",
    "REDLogFilm",
    "S-Log",
    "S-Log2",
    "S-Log3",
    "T-Log",
    "V-Log",
    "ViperLog",
]
LiteralOETF = Literal[
    "ARIB STD-B67",
    "Blackmagic Film Generation 5",
    "DaVinci Intermediate",
    "ITU-R BT.2020",
    "ITU-R BT.2100 HLG",
    "ITU-R BT.2100 PQ",
    "ITU-R BT.601",
    "ITU-R BT.709",
    "ITU-T H.273 IEC 61966-2",
    "ITU-T H.273 Log",
    "ITU-T H.273 Log Sqrt",
    "SMPTE 240M",
]
LiteralOETFInverse = Literal[
    "ARIB STD-B67",
    "Blackmagic Film Generation 5",
    "DaVinci Intermediate",
    "ITU-R BT.2020",
    "ITU-R BT.2100 HLG",
    "ITU-R BT.2100 PQ",
    "ITU-R BT.601",
    "ITU-R BT.709",
    "ITU-T H.273 IEC 61966-2",
    "ITU-T H.273 Log",
    "ITU-T H.273 Log Sqrt",
]
LiteralEOTF = Literal[
    "DCDM",
    "DICOM GSDF",
    "ITU-R BT.1886",
    "ITU-R BT.2100 HLG",
    "ITU-R BT.2100 PQ",
    "ITU-T H.273 ST.428-1",
    "SMPTE 240M",
    "ST 2084",
    "sRGB",
]
LiteralEOTFInverse = Literal[
    "DCDM",
    "DICOM GSDF",
    "ITU-R BT.1886",
    "ITU-R BT.2100 HLG",
    "ITU-R BT.2100 PQ",
    "ITU-T H.273 ST.428-1",
    "ST 2084",
    "sRGB",
]
LiteralCCTFEncoding = Literal[
    "ACEScc",
    "ACEScct",
    "ACESproxy",
    "ARIB STD-B67",
    "ARRI LogC3",
    "ARRI LogC4",
    "Blackmagic Film Generation 5",
    "Canon Log",
    "Canon Log 2",
    "Canon Log 3",
    "Cineon",
    "D-Log",
    "DCDM",
    "DICOM GSDF",
    "DaVinci Intermediate",
    "ERIMM RGB",
    "F-Log",
    "F-Log2",
    "Filmic Pro 6",
    "Gamma 2.2",
    "Gamma 2.4",
    "Gamma 2.6",
    "ITU-R BT.1886",
    "ITU-R BT.2020",
    "ITU-R BT.2100 HLG",
    "ITU-R BT.2100 PQ",
    "ITU-R BT.601",
    "ITU-R BT.709",
    "ITU-T H.273 IEC 61966-2",
    "ITU-T H.273 Log",
    "ITU-T H.273 Log Sqrt",
    "ITU-T H.273 ST.428-1",
    "L-Log",
    "Log2",
    "Log3G10",
    "Log3G12",
    "N-Log",
    "PLog",
    "Panalog",
    "ProPhoto RGB",
    "Protune",
    "REDLog",
    "REDLogFilm",
    "RIMM RGB",
    "ROMM RGB",
    "S-Log",
    "S-Log2",
    "S-Log3",
    "SMPTE 240M",
    "ST 2084",
    "T-Log",
    "V-Log",
    "ViperLog",
    "sRGB",
]
LiteralCCTFDecoding = Literal[
    "ACEScc",
    "ACEScct",
    "ACESproxy",
    "ARIB STD-B67",
    "ARRI LogC3",
    "ARRI LogC4",
    "Blackmagic Film Generation 5",
    "Canon Log",
    "Canon Log 2",
    "Canon Log 3",
    "Cineon",
    "D-Log",
    "DCDM",
    "DICOM GSDF",
    "DaVinci Intermediate",
    "ERIMM RGB",
    "F-Log",
    "F-Log2",
    "Filmic Pro 6",
    "Gamma 2.2",
    "Gamma 2.4",
    "Gamma 2.6",
    "ITU-R BT.1886",
    "ITU-R BT.2020",
    "ITU-R BT.2100 HLG",
    "ITU-R BT.2100 PQ",
    "ITU-R BT.601",
    "ITU-R BT.709",
    "ITU-T H.273 IEC 61966-2",
    "ITU-T H.273 Log",
    "ITU-T H.273 Log Sqrt",
    "ITU-T H.273 ST.428-1",
    "L-Log",
    "Log2",
    "Log3G10",
    "Log3G12",
    "N-Log",
    "PLog",
    "Panalog",
    "ProPhoto RGB",
    "Protune",
    "REDLog",
    "REDLogFilm",
    "RIMM RGB",
    "ROMM RGB",
    "S-Log",
    "S-Log2",
    "S-Log3",
    "SMPTE 240M",
    "ST 2084",
    "T-Log",
    "V-Log",
    "ViperLog",
    "sRGB",
]
LiteralOOTF = Literal["ITU-R BT.2100 HLG", "ITU-R BT.2100 PQ"]
LiteralOOTFInverse = Literal["ITU-R BT.2100 HLG", "ITU-R BT.2100 PQ"]
# LITERALISE::END

Preflight

Code Style and Quality

  • [N/A] Unit tests have been implemented and passed.
  • Pyright static checking has been run and passed.
  • Pre-commit hooks have been run and passed.
  • [N/A] New transformations have been added to the Automatic Colour Conversion Graph.
  • [N/A] New transformations have been exported to the relevant namespaces, e.g. colour, colour.models.

Documentation

  • New features are documented along with examples if relevant.
  • The documentation is Sphinx and numpydoc compliant.

@coveralls
Copy link

coveralls commented Sep 14, 2023

Coverage Status

coverage: 99.793%. remained the same when pulling 1d0caf6 on feature/literals into 878ae03 on develop.

@jamesmyatt
Copy link

Would it be better to implement this as a local pre-commit hook so that the committed code is always up-to-date?

@KelSolaar
Copy link
Member Author

This is a very good suggestion @jamesmyatt!

@KelSolaar
Copy link
Member Author

@jamesmyatt : So it is in theory not possible with PreCommit as per: pre-commit/pre-commit#532 but running black directly in the new literalise utility script fixes the issue. Gross should be fine.

@KelSolaar
Copy link
Member Author

Actually, I don't think it can be done properly: the issue is that we need to be able to import colour to introspect the various attributes. This requires having all the dependencies installed which is why I used poetry to run the script so that it runs with the correct environment from the repo. However 1) it seems that pre-commit does not find poetry on Windows on Github Actions, even though poetry is being used and added to $PATH, 2) the pre-commit.ci check will never work this way.

I will revert to what I did in the invoke tasks.

@KelSolaar KelSolaar merged commit a8b8a29 into develop Sep 15, 2023
23 checks passed
@KelSolaar KelSolaar deleted the feature/literals branch September 15, 2023 09:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants