Up to [cvs.NetBSD.org] / pkgsrc / textproc / py-colored
Request diff between arbitrary revisions
Keyword substitution: kv
Default branch: MAIN
py-colored: updated to 2.3.2 2.3.2 Added Added tests_pytest/ suite with pytest-based tests for foreground, background, styles, exceptions, hex color matching, and convert functionality. Fixed Fixed mypy type error in hexadecimal.py: changed color parameter type from str | int to str in Hex.find(), as the method requires string input for len() and indexing operations. Fixed mypy type errors in attributes.py: added missing return type annotation (-> None) to MetaStyle.__getattr__() and replaced bare dict with dict[str, str] for _STYLES and _COLORS class attributes. Fixed ValueError in Colored.enabled() when FORCE_COLOR environment variable contains a non-integer value (e.g. FORCE_COLOR=yes): invalid values are now treated as enabled. Fixed Controls.nav() ignoring column=0 due to falsy check: changed if column: to if column is not None: so cursor position at column 0 (start of line) works correctly. Fixed ValueError crash in Hex.find() when passing an invalid hex string (e.g. #FF, #AABBCCDD): added format validation that raises InvalidHexColor for strings that are not 4 or 7 characters long starting with #. Fixed RGB values out of range in Utilities.is_percentage(): values are now clamped to [0, 255] to always produce valid ANSI escape sequences without breaking existing code. Fixed incorrect return type annotation -> None on __getattr__ in MetaStyle, MetaFore, and MetaBack metaclasses: changed to -> NoReturn since these methods always raise an exception and never return. Fixed Utilities.set_colorterm() losing the default truecolor value when $COLORTERM is not set in the environment: changed fallback from '' to self.colorterm to preserve the initialized default. Renamed misleading Hex.cube() method to Hex.square() to correctly reflect its calculation (x*x), which is the intended least squares fit operation.
py-colored: updated to 2.3.1 2.3.1 Changed Refactor: Optimized Windows Terminal Mode initialization: Moved Colored.enable_windows_terminal_mode() call from Colored.__init__ to module-level execution. This ensures the Windows virtual terminal processing is enabled only once when the colored module is imported, instead of on every Colored object instantiation. This change improves performance by avoiding redundant API calls and checks. Refactor: Reduce Colored instance attributes: Removed redundant instance attributes (_ESC, _END, _STYLES, etc.) from the Colored class's __init__ method. These constants are now accessed directly from the Library module, reducing memory footprint per instance and improving adherence to Pylint's R0902 warning. Fixed Resolved static analysis warnings in enable_windows_terminal_mode(): Modified enable_windows_terminal_mode() to ensure consistent return statements and handle all possible execution paths explicitly. This addresses mypy's "Missing return statement" error and pylint's "inconsistent-return-statements" warning by making all return paths explicit and robustly handling potential ctypes related exceptions. The return type hint was also updated to Optional[bool]. Resolved type hinting and tuple unpacking warnings in Utilities.is_percentage(): Modified the Utilities.is_percentage() method to explicitly return a fixed-length tuple[int, int, int]. This addresses mypy's "Incompatible return value type" error and pylint's "unbalanced-tuple-unpacking" warning by ensuring consistent and statically verifiable return types. Refined type validation and error handling in Controls.nav(): Eliminated the redundant _is_str_object static method. Integrated string type validation directly into the nav() method. Replaced AttributeError with TypeError for improved semantic clarity when handling invalid argument types. Ensured test_hex_1.py correctly uses nearest ANSI codes for hex color representation, preventing InvalidHexColor exceptions during gradient and random color tests.
py-colored: updated to 2.3.0 2.3.0 Added: Convert function that convert ANSI to HEX and opposite. Test for convert module. Updated: convert_percentages(percent: str) to return int. Improved code quality, type annotation, docstrings. Fixed: Duplicated HEX codes. Utilities for raise InvalidHexColor Exception instead InvalidColor.
py-colored: updated to 2.2.5 2.2.5 Added Support static typing
*: clean-up after python38 removal
py-colored: updated to 2.2.4 2.2.4 Fix cprint: don't change fore_color or back_color if they were omitted
python/wheel.mk: simplify a lot, and switch to 'installer' for installation This follows the recommended bootstrap method (flit_core, build, installer). However, installer installs different files than pip, so update PLISTs for all packages using wheel.mk and bump their PKGREVISIONs.
py-colored: updated to 2.2.3 Version 2.2.3 - (07-07-2023) Fixed Typing error Version 2.2.2 - (26-06-2023) Added Set for environment variable $COLORTERM Updated Maximum number range for RGB colors Version 2.2.1 - (25-06-2023) Updated Exception InvalidNavigation -> InvalidControl Version 2.2.0 - (24-06-2023) Added CSI (Control Sequence Introducer) sequences SGR (Select Graphic Rendition) parameter style underline color Support RGB color schema Updated cprint() to support RGB colors Fixed Typo for style 'underlined', changed to 'underline' Version 2.1.1 - (20-06-2023) Updated Legacy support versions 1.x.x: Functions fg(), bg(), attr() are back until deprecated to the future. Class attributes fore, back and style will be available also but instead imported them directly, you can use like the examples below: from colored.foreground import fore from colored.background import back from colored.attributes import style Version 2.1.0 - (20-06-2023) Updated Updated library for default values Replace function show_colour() with cprint() Added cprint(text, foreground='', background='', formatting='', reset=True, **kwargs) function Version 2.0.0 - (19-06-2023) Updated Coding style For typing hints Class names: fore -> Fore back -> Back style -> Style Function names: fg() -> fore() bg() -> back() attr() -> style() Class attributes styles and colors in lower case, example: Fore.red is the same Fore.RED Style.bold is the same Style.BOLD Added Documentation site: https://dslackw.gitlab.io/colored Styles italic and strikeout Function show_colour()
py-colored: updated to 1.4.4 Version 1.4.4 Updated - Code style - Switch to f string - Removed python2 support - Use windows types instead of raw ctypes.
*: bump PKGREVISION for egg.mk users They now have a tool dependency on py-setuptools instead of a DEPENDS
py-colored: updated to 1.4.3 Version 1.4.3 Updated - Improve color enabling
py-colored: updated to 1.4.2 version 1.4.2: - Python 3 compatibility - setup.py file Version 1.4.1: - UnsupportedOperation: fileno when detecting TTY
py-colored: updated to 1.4.0 Version 1.4.0: Added - Ensure package data is included - Converted old package spec files to new format - Hex improvements - Enable colors in Windows' terminal - Added an option to make colored tty aware
textproc/py-colored: use egg.mk.
textproc/py-colored: Update to colored-1.3.93 * License changed to MIT. * Changes to pypi package spec format * Typo fixes.
textproc/py-colored: Import colored-1.3.5 colored is a very simple Python library for color and formatting in terminals.