Hello community, here is the log from the commit of package python-crayons for openSUSE:Factory checked in at 2020-02-24 15:54:31 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-crayons (Old) and /work/SRC/openSUSE:Factory/.python-crayons.new.26092 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-crayons" Mon Feb 24 15:54:31 2020 rev:4 rq:778646 version:0.3.0 Changes: -------- --- /work/SRC/openSUSE:Factory/python-crayons/python-crayons.changes 2019-03-05 12:23:59.968865627 +0100 +++ /work/SRC/openSUSE:Factory/.python-crayons.new.26092/python-crayons.changes 2020-02-24 15:56:54.560059885 +0100 @@ -1,0 +2,11 @@ +Mon Feb 24 05:03:28 UTC 2020 - Steve Kowalik <[email protected]> + +- Update to 0.3.0 + * Rewrites clean to just remove ANSI codes, not whatever it was doing before (which seemed to be stripping all characters from the string) + * Adds random function to get a random color (thanks @azillion) + * Adds replace_color function to allow setting replacement for a given color (e.g. replace blue with magneta) (thanks @frostming) + * Adds reset_replace_color to reset any replacement colors set +- Update URL in the spec to be correct +- Write a description + +------------------------------------------------------------------- Old: ---- crayons-0.2.0.tar.gz New: ---- crayons-0.3.0.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-crayons.spec ++++++ --- /var/tmp/diff_new_pack.3xiuLt/_old 2020-02-24 15:56:55.284061382 +0100 +++ /var/tmp/diff_new_pack.3xiuLt/_new 2020-02-24 15:56:55.284061382 +0100 @@ -1,7 +1,7 @@ # # spec file for package python-crayons # -# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2020 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -18,12 +18,12 @@ %{?!python_module:%define python_module() python-%{**} python3-%{**}} Name: python-crayons -Version: 0.2.0 +Version: 0.3.0 Release: 0 Summary: Colored strings for terminal usage License: MIT Group: Development/Languages/Python -Url: https://github.com/kennethreitz/httpbin +URL: https://github.com/MasterOdin/crayons Source: https://files.pythonhosted.org/packages/source/c/crayons/crayons-%{version}.tar.gz Source1: LICENSE BuildRequires: %{python_module setuptools} @@ -33,6 +33,9 @@ %python_subpackages %description +Crayons is a simple module to give you colored strings for terminal usage. +Included colors are red, green, yellow, blue, black, magenta, cyan, white, +and normal. %prep %setup -q -n crayons-%{version} ++++++ crayons-0.2.0.tar.gz -> crayons-0.3.0.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/crayons-0.2.0/PKG-INFO new/crayons-0.3.0/PKG-INFO --- old/crayons-0.2.0/PKG-INFO 2019-02-21 14:36:19.000000000 +0100 +++ new/crayons-0.3.0/PKG-INFO 2019-10-09 20:49:35.000000000 +0200 @@ -1,10 +1,12 @@ -Metadata-Version: 1.1 +Metadata-Version: 1.2 Name: crayons -Version: 0.2.0 +Version: 0.3.0 Summary: TextUI colors for Python. -Home-page: https://github.com/kennethreitz/crayons +Home-page: https://github.com/MasterOdin/crayons Author: Kenneth Reitz Author-email: [email protected] +Maintainer: Matthew Peveler +Maintainer-email: [email protected] License: MIT Description: Crayons: Text UI colors for Python. @@ -13,6 +15,9 @@ .. image:: https://img.shields.io/pypi/v/crayons.svg :target: https://pypi.python.org/pypi/crayons + .. image:: https://travis-ci.com/MasterOdin/crayons.svg?branch=master + :target: https://travis-ci.com/MasterOdin/crayons + .. image:: https://img.shields.io/pypi/l/crayons.svg :target: https://pypi.python.org/pypi/crayons @@ -22,21 +27,17 @@ .. image:: https://img.shields.io/pypi/pyversions/crayons.svg :target: https://pypi.python.org/pypi/crayons - .. image:: https://img.shields.io/badge/SayThanks.io-☼-1EAEDB.svg - :target: https://saythanks.io/to/kennethreitz - - This module is really simple, it gives you colored strings for terminal usage. Included colors are ``red``, ``green``, ``yellow``, ``blue``, ``black``, ``magenta``, ``cyan``, ``white``, and ``normal`` ( as well as ``clean`` and ``disable``). - **Crayons** is nice because it automatically wraps a given string in both the foreground color, as well as returning to the original state after the string is complete. Most terminal color libraries make you manage this yourself. + **Crayons** is nice because it automatically wraps a given string in both the foreground color, as well as returning to the original state after the string is complete. Most terminal color libraries make you manage this yourself. .. image:: https://d3vv6lp55qjaqc.cloudfront.net/items/3q0I293q1z293R3a3a3n/Screen%20Shot%202017-01-23%20at%206.00.02%20PM.png?X-CloudApp-Visitor-Id=2577 - Arguments include ``always=True`` and ``bold=True``. + Arguments include ``always=True`` and ``bold=True``. Features -------- @@ -53,7 +54,7 @@ :: # red is red, white is white. - >>> print '{} white'.format(crayons.red('red')) + >>> print('{} white'.format(crayons.red('red'))) red white That's it! @@ -66,13 +67,13 @@ $ pip install crayons Platform: UNKNOWN +Classifier: License :: OSI Approved :: MIT License Classifier: Programming Language :: Python -Classifier: Programming Language :: Python :: 2.6 Classifier: Programming Language :: Python :: 2.7 Classifier: Programming Language :: Python :: 3 -Classifier: Programming Language :: Python :: 3.3 Classifier: Programming Language :: Python :: 3.4 Classifier: Programming Language :: Python :: 3.5 Classifier: Programming Language :: Python :: 3.6 +Classifier: Programming Language :: Python :: 3.7 Classifier: Programming Language :: Python :: Implementation :: CPython Classifier: Programming Language :: Python :: Implementation :: PyPy diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/crayons-0.2.0/README.rst new/crayons-0.3.0/README.rst --- old/crayons-0.2.0/README.rst 2019-02-21 14:35:22.000000000 +0100 +++ new/crayons-0.3.0/README.rst 2019-10-09 15:55:04.000000000 +0200 @@ -4,6 +4,9 @@ .. image:: https://img.shields.io/pypi/v/crayons.svg :target: https://pypi.python.org/pypi/crayons +.. image:: https://travis-ci.com/MasterOdin/crayons.svg?branch=master + :target: https://travis-ci.com/MasterOdin/crayons + .. image:: https://img.shields.io/pypi/l/crayons.svg :target: https://pypi.python.org/pypi/crayons @@ -13,21 +16,17 @@ .. image:: https://img.shields.io/pypi/pyversions/crayons.svg :target: https://pypi.python.org/pypi/crayons -.. image:: https://img.shields.io/badge/SayThanks.io-☼-1EAEDB.svg - :target: https://saythanks.io/to/kennethreitz - - This module is really simple, it gives you colored strings for terminal usage. Included colors are ``red``, ``green``, ``yellow``, ``blue``, ``black``, ``magenta``, ``cyan``, ``white``, and ``normal`` ( as well as ``clean`` and ``disable``). -**Crayons** is nice because it automatically wraps a given string in both the foreground color, as well as returning to the original state after the string is complete. Most terminal color libraries make you manage this yourself. +**Crayons** is nice because it automatically wraps a given string in both the foreground color, as well as returning to the original state after the string is complete. Most terminal color libraries make you manage this yourself. .. image:: https://d3vv6lp55qjaqc.cloudfront.net/items/3q0I293q1z293R3a3a3n/Screen%20Shot%202017-01-23%20at%206.00.02%20PM.png?X-CloudApp-Visitor-Id=2577 -Arguments include ``always=True`` and ``bold=True``. +Arguments include ``always=True`` and ``bold=True``. Features -------- @@ -44,7 +43,7 @@ :: # red is red, white is white. - >>> print '{} white'.format(crayons.red('red')) + >>> print('{} white'.format(crayons.red('red'))) red white That's it! diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/crayons-0.2.0/crayons.egg-info/PKG-INFO new/crayons-0.3.0/crayons.egg-info/PKG-INFO --- old/crayons-0.2.0/crayons.egg-info/PKG-INFO 2019-02-21 14:36:19.000000000 +0100 +++ new/crayons-0.3.0/crayons.egg-info/PKG-INFO 2019-10-09 20:49:35.000000000 +0200 @@ -1,10 +1,12 @@ -Metadata-Version: 1.1 +Metadata-Version: 1.2 Name: crayons -Version: 0.2.0 +Version: 0.3.0 Summary: TextUI colors for Python. -Home-page: https://github.com/kennethreitz/crayons +Home-page: https://github.com/MasterOdin/crayons Author: Kenneth Reitz Author-email: [email protected] +Maintainer: Matthew Peveler +Maintainer-email: [email protected] License: MIT Description: Crayons: Text UI colors for Python. @@ -13,6 +15,9 @@ .. image:: https://img.shields.io/pypi/v/crayons.svg :target: https://pypi.python.org/pypi/crayons + .. image:: https://travis-ci.com/MasterOdin/crayons.svg?branch=master + :target: https://travis-ci.com/MasterOdin/crayons + .. image:: https://img.shields.io/pypi/l/crayons.svg :target: https://pypi.python.org/pypi/crayons @@ -22,21 +27,17 @@ .. image:: https://img.shields.io/pypi/pyversions/crayons.svg :target: https://pypi.python.org/pypi/crayons - .. image:: https://img.shields.io/badge/SayThanks.io-☼-1EAEDB.svg - :target: https://saythanks.io/to/kennethreitz - - This module is really simple, it gives you colored strings for terminal usage. Included colors are ``red``, ``green``, ``yellow``, ``blue``, ``black``, ``magenta``, ``cyan``, ``white``, and ``normal`` ( as well as ``clean`` and ``disable``). - **Crayons** is nice because it automatically wraps a given string in both the foreground color, as well as returning to the original state after the string is complete. Most terminal color libraries make you manage this yourself. + **Crayons** is nice because it automatically wraps a given string in both the foreground color, as well as returning to the original state after the string is complete. Most terminal color libraries make you manage this yourself. .. image:: https://d3vv6lp55qjaqc.cloudfront.net/items/3q0I293q1z293R3a3a3n/Screen%20Shot%202017-01-23%20at%206.00.02%20PM.png?X-CloudApp-Visitor-Id=2577 - Arguments include ``always=True`` and ``bold=True``. + Arguments include ``always=True`` and ``bold=True``. Features -------- @@ -53,7 +54,7 @@ :: # red is red, white is white. - >>> print '{} white'.format(crayons.red('red')) + >>> print('{} white'.format(crayons.red('red'))) red white That's it! @@ -66,13 +67,13 @@ $ pip install crayons Platform: UNKNOWN +Classifier: License :: OSI Approved :: MIT License Classifier: Programming Language :: Python -Classifier: Programming Language :: Python :: 2.6 Classifier: Programming Language :: Python :: 2.7 Classifier: Programming Language :: Python :: 3 -Classifier: Programming Language :: Python :: 3.3 Classifier: Programming Language :: Python :: 3.4 Classifier: Programming Language :: Python :: 3.5 Classifier: Programming Language :: Python :: 3.6 +Classifier: Programming Language :: Python :: 3.7 Classifier: Programming Language :: Python :: Implementation :: CPython Classifier: Programming Language :: Python :: Implementation :: PyPy diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/crayons-0.2.0/crayons.egg-info/SOURCES.txt new/crayons-0.3.0/crayons.egg-info/SOURCES.txt --- old/crayons-0.2.0/crayons.egg-info/SOURCES.txt 2019-02-21 14:36:19.000000000 +0100 +++ new/crayons-0.3.0/crayons.egg-info/SOURCES.txt 2019-10-09 20:49:35.000000000 +0200 @@ -1,5 +1,6 @@ README.rst crayons.py +setup.cfg setup.py crayons.egg-info/PKG-INFO crayons.egg-info/SOURCES.txt diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/crayons-0.2.0/crayons.py new/crayons-0.3.0/crayons.py --- old/crayons-0.2.0/crayons.py 2019-02-21 14:35:22.000000000 +0100 +++ new/crayons-0.3.0/crayons.py 2019-10-09 20:38:10.000000000 +0200 @@ -1,14 +1,8 @@ # -*- coding: utf-8 -*- - -""" -clint.colored -~~~~~~~~~~~~~ - -This module provides a simple and elegant wrapper for colorama. - -""" +"""A simple and elegant wrapper for colorama.""" import os +from random import choice, seed import re import sys @@ -16,14 +10,20 @@ PY3 = sys.version_info[0] >= 3 -__all__ = ( + +COLORS = ( 'red', 'green', 'yellow', 'blue', - 'black', 'magenta', 'cyan', 'white', - 'clean', 'disable', 'enable' + 'black', 'magenta', 'cyan', 'white' +) + +__all__ = COLORS + ( + 'normal', 'clean', 'disable', 'enable', 'random', + 'replace_colors', 'reset_replace_colors' ) colorama.init() -COLORS = __all__[:-2] +REPLACE_COLORS = {} +seed() if 'get_ipython' in dir(): """ @@ -38,15 +38,17 @@ if os.getenv("TERM") == "dumb": DISABLE_COLOR = True + class ColoredString(object): """Enhanced string for __len__ operations on Colored output.""" + def __init__(self, color, s, always_color=False, bold=False): super(ColoredString, self).__init__() - if not PY3 and isinstance(s, unicode): + if not PY3 and isinstance(s, unicode): # noqa: F821 self.s = s.encode('utf-8') else: self.s = s - self.color = color + self.color = REPLACE_COLORS.get(color, color) self.always_color = always_color self.bold = bold if os.environ.get('CLINT_FORCE_COLOR'): @@ -74,7 +76,7 @@ getattr(colorama.Style, style), self.s, colorama.Fore.RESET, - getattr(colorama.Style, 'NORMAL')) + colorama.Style.NORMAL) if self.always_color: return c @@ -117,33 +119,59 @@ return ColoredString(self.color, s) -def clean(s): - strip = re.compile(r"([^-_a-zA-Z0-9!@#%&=,/'\";:~`\$\^\*\(\)\+\[\]\.\{\}\|\?\<\>\\]+|[^\s]+)") - txt = strip.sub('', str(s)) - - strip = re.compile(r'\[\d+m') - txt = strip.sub('', txt) - - return txt - -_colors = {x: x.upper() for x in __all__[:-3]} +_colors = {x: x.upper() for x in COLORS} _colors['normal'] = 'RESET' for key, val in _colors.items(): function = eval( - 'lambda s, always=False, bold=False: ColoredString("{}", s, always_color=always, bold=bold)'.format(val)) + 'lambda s, always=False, bold=False: ColoredString("{}", s, always_color=always, bold=bold)'.format(val)) # noqa: E501 locals()[key] = function del key, val, _colors, function + +def clean(s): + strip = re.compile(r'(\x9B|\x1B\[)[0-?]*[ -\/]*[@-~]') + txt = strip.sub('', s) + + return txt + + +def random(string, always=False, bold=False, colors=COLORS): + """Selects a color at random from a list.""" + colors = list(filter(lambda color: color in COLORS, colors)) or COLORS + return ColoredString( + choice(colors).upper(), + string, + always_color=always, + bold=bold + ) + + def disable(): """Disables colors.""" global DISABLE_COLOR DISABLE_COLOR = True + def enable(): """Enables colors.""" global DISABLE_COLOR DISABLE_COLOR = False + + +def replace_colors(replace_dict): + """Replace colors to customize the look under specific background.""" + global REPLACE_COLORS + + assert isinstance(replace_dict, dict) + REPLACE_COLORS = {k.upper(): v.upper() for k, v in replace_dict.items()} + + +def reset_replace_colors(): + """Reset any set replace colors.""" + global REPLACE_COLORS + + REPLACE_COLORS = {} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/crayons-0.2.0/setup.cfg new/crayons-0.3.0/setup.cfg --- old/crayons-0.2.0/setup.cfg 2019-02-21 14:36:19.000000000 +0100 +++ new/crayons-0.3.0/setup.cfg 2019-10-09 20:49:35.000000000 +0200 @@ -1,3 +1,9 @@ +[metadata] +license_files = LICENSE + +[bdist_wheel] +universal = 1 + [egg_info] tag_build = tag_date = 0 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/crayons-0.2.0/setup.py new/crayons-0.3.0/setup.py --- old/crayons-0.2.0/setup.py 2019-02-21 14:35:36.000000000 +0100 +++ new/crayons-0.3.0/setup.py 2019-10-09 20:17:12.000000000 +0200 @@ -1,5 +1,6 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- +"""setup script for module installation.""" import os import sys @@ -30,24 +31,26 @@ setup( name='crayons', - version='0.2.0', + version='0.3.0', description='TextUI colors for Python.', long_description=long_description, author='Kenneth Reitz', author_email='[email protected]', - url='https://github.com/kennethreitz/crayons', + maintainer='Matthew Peveler', + maintainer_email='[email protected]', + url='https://github.com/MasterOdin/crayons', py_modules=['crayons'], install_requires=required, license='MIT', classifiers=[ + 'License :: OSI Approved :: MIT License', 'Programming Language :: Python', - 'Programming Language :: Python :: 2.6', 'Programming Language :: Python :: 2.7', 'Programming Language :: Python :: 3', - 'Programming Language :: Python :: 3.3', 'Programming Language :: Python :: 3.4', 'Programming Language :: Python :: 3.5', 'Programming Language :: Python :: 3.6', + 'Programming Language :: Python :: 3.7', 'Programming Language :: Python :: Implementation :: CPython', 'Programming Language :: Python :: Implementation :: PyPy'
