Title: R23-T052: Add conversions/cmyk_to_rgb.py with round-trip doctests by code-paul-creator · Pull Request #62 · S-AI-Projects/TheAlgorithms-Python · GitHub
Open Graph Title: R23-T052: Add conversions/cmyk_to_rgb.py with round-trip doctests by code-paul-creator · Pull Request #62 · S-AI-Projects/TheAlgorithms-Python
X Title: R23-T052: Add conversions/cmyk_to_rgb.py with round-trip doctests by code-paul-creator · Pull Request #62 · S-AI-Projects/TheAlgorithms-Python
Description: Description Adds conversions/cmyk_to_rgb.py, the inverse of rgb_cmyk_conversion.rgb_to_cmyk. It takes CMYK percentages (0..100), returns RGB in 0..255, has type hints, raises ValueError for invalid input, and has doctests including a round trip rgb -> cmyk -> rgb. Related Issue Fixes: #52 Type of Change Bug Fix New Feature UI/UX Improvement Performance Improvement Tests Documentation Refactoring / Maintenance CI/CD Changes Made Added conversions/cmyk_to_rgb.py (type hints, ValueError validation, doctests). Doctests round-trip rgb -> cmyk (via rgb_to_cmyk) -> rgb within ±1 per channel for red, green, blue, white, black and gray. Added work/R23-T052/VARIANT.md: time/space comparison, timing table and an explanation of the rounding. Screenshots / Recordings Not applicable (no UI changes). Testing python3 scripts/validate_filenames.py -> passed ruff check conversions/cmyk_to_rgb.py -> all checks passed python -m pytest --doctest-modules conversions/cmyk_to_rgb.py conversions/rgb_cmyk_conversion.py -> passed Checklist I have tested my changes locally. I have added or updated tests, if needed. I have updated documentation, if needed. I have followed the project's coding guidelines. I have run the relevant tests and checks. I have addressed previous review feedback, if applicable. Additional Notes rgb_to_cmyk rounds to whole percentages, so the round trip is exact only for some colours. Over a sample of 140,608 colours the max error was 2 per channel (6,786 colours at 2, 106,608 at 1, 27,214 at 0). See work/R23-T052/VARIANT.md.
Open Graph Description: Description Adds conversions/cmyk_to_rgb.py, the inverse of rgb_cmyk_conversion.rgb_to_cmyk. It takes CMYK percentages (0..100), returns RGB in 0..255, has type hints, raises ValueError for invalid...
X Description: Description Adds conversions/cmyk_to_rgb.py, the inverse of rgb_cmyk_conversion.rgb_to_cmyk. It takes CMYK percentages (0..100), returns RGB in 0..255, has type hints, raises ValueError for invalid...
Opengraph URL: https://github.com/S-AI-Projects/TheAlgorithms-Python/pull/62
X: @github
Domain: github.com
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:1dfb2f67-7ed2-8a9b-236f-7280b0d9d14c |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | B376:1A7FB5:DD19B:134FD7:6AFDF814 |
| html-safe-nonce | e1b6d38846146f872d0ce29b5f3e737624e9703bfdd84fadd97dfb923e921476 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCMzc2OjFBN0ZCNTpERDE5QjoxMzRGRDc6NkFGREY4MTQiLCJ2aXNpdG9yX2lkIjoiMzU1NjU5Mjg0OTczMjM2ODQwNCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 3e37a4cc42cfb98e324fd1fdb0caaca1d63ac4d577b2bc3a6456d5d5f88e4188 |
| hovercard-subject-tag | pull_request:5253890579 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/S-AI-Projects/TheAlgorithms-Python/pull/62/files |
| twitter:image | https://avatars.githubusercontent.com/u/260575160?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/260575160?s=400&v=4 |
| og:image:alt | Description Adds conversions/cmyk_to_rgb.py, the inverse of rgb_cmyk_conversion.rgb_to_cmyk. It takes CMYK percentages (0..100), returns RGB in 0..255, has type hints, raises ValueError for invalid... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | ee3343385a977757dd145b28fabf4a119780f2615a5a36c5a89f66c9b3b5616d |
| turbo-cache-control | no-preview |
| diff-view | unified |
| go-import | github.com/S-AI-Projects/TheAlgorithms-Python git https://github.com/S-AI-Projects/TheAlgorithms-Python.git |
| octolytics-dimension-user_id | 351892385 |
| octolytics-dimension-user_login | S-AI-Projects |
| octolytics-dimension-repository_id | 1444141022 |
| octolytics-dimension-repository_nwo | S-AI-Projects/TheAlgorithms-Python |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | true |
| octolytics-dimension-repository_parent_id | 63476337 |
| octolytics-dimension-repository_parent_nwo | TheAlgorithms/Python |
| octolytics-dimension-repository_network_root_id | 63476337 |
| octolytics-dimension-repository_network_root_nwo | TheAlgorithms/Python |
| turbo-body-classes | logged-out env-production page-responsive full-width |
| disable-turbo | true |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 43ae91995f6e2d5ff7a491f3de438f1f723adeaa |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width