Hello community,
here is the log from the commit of package python-validators for
openSUSE:Factory checked in at 2020-05-09 19:49:15
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-validators (Old)
and /work/SRC/openSUSE:Factory/.python-validators.new.2738 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-validators"
Sat May 9 19:49:15 2020 rev:10 rq:801767 version:0.15.0
Changes:
--------
--- /work/SRC/openSUSE:Factory/python-validators/python-validators.changes
2020-01-30 09:33:27.653235160 +0100
+++
/work/SRC/openSUSE:Factory/.python-validators.new.2738/python-validators.changes
2020-05-09 19:49:16.112440419 +0200
@@ -1,0 +2,12 @@
+Fri May 8 08:28:01 UTC 2020 - Mia Herkt <[email protected]>
+
+- Update to 0.15.0:
+ * Added bank card validators
+- Changes for 0.14.3:
+ * Handle None values gracefully in domain validator
+ * Local part of the email address should be less or equal than
+ 64 bytes
+ * Removed py27 support
+ * Removed pypy2 support
+
+-------------------------------------------------------------------
Old:
----
validators-0.14.2.tar.gz
New:
----
validators-0.15.0.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ python-validators.spec ++++++
--- /var/tmp/diff_new_pack.kW4u2d/_old 2020-05-09 19:49:18.952446515 +0200
+++ /var/tmp/diff_new_pack.kW4u2d/_new 2020-05-09 19:49:18.956446524 +0200
@@ -18,7 +18,7 @@
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
Name: python-validators
-Version: 0.14.2
+Version: 0.15.0
Release: 0
Summary: Python Data Validation
License: MIT
++++++ validators-0.14.2.tar.gz -> validators-0.15.0.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/validators-0.14.2/CHANGES.rst
new/validators-0.15.0/CHANGES.rst
--- old/validators-0.14.2/CHANGES.rst 2020-01-24 10:58:05.000000000 +0100
+++ new/validators-0.15.0/CHANGES.rst 2020-05-07 14:31:12.000000000 +0200
@@ -1,6 +1,20 @@
Changelog
---------
+0.15.0 (2020-05-07)
+^^^^^^^^^^^^^^^^^^
+
+- Added bank card validators (#157, pull request courtesy of TimonPeng)
+
+
+0.14.3 (2020-02-04)
+^^^^^^^^^^^^^^^^^^^
+
+- Handle None values gracefully in domain validator (#144, pull request
courtesy reahaas)
+- Local part of the email address should be less or equal than 64 bytes (#147,
pull request courtesy mondeja)
+- Removed py27 support
+- Removed pypy2 support
+
0.14.2 (2020-01-24)
^^^^^^^^^^^^^^^^^^^
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/validators-0.14.2/PKG-INFO
new/validators-0.15.0/PKG-INFO
--- old/validators-0.14.2/PKG-INFO 2020-01-24 11:01:48.000000000 +0100
+++ new/validators-0.15.0/PKG-INFO 2020-05-07 14:32:56.000000000 +0200
@@ -1,6 +1,6 @@
Metadata-Version: 2.1
Name: validators
-Version: 0.14.2
+Version: 0.15.0
Summary: Python Data Validation for Humans™.
Home-page: https://github.com/kvesteri/validators
Author: Konsta Vesterinen
@@ -18,8 +18,6 @@
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python
-Classifier: Programming Language :: Python :: 2
-Classifier: Programming Language :: Python :: 2.7
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.4
Classifier: Programming Language :: Python :: 3.5
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/validators-0.14.2/setup.py
new/validators-0.15.0/setup.py
--- old/validators-0.14.2/setup.py 2019-09-19 11:43:15.000000000 +0200
+++ new/validators-0.15.0/setup.py 2020-04-02 15:03:56.000000000 +0200
@@ -59,8 +59,6 @@
'License :: OSI Approved :: MIT License',
'Operating System :: OS Independent',
'Programming Language :: Python',
- 'Programming Language :: Python :: 2',
- 'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/validators-0.14.2/tests/i18n/test_fi.py
new/validators-0.15.0/tests/i18n/test_fi.py
--- old/validators-0.14.2/tests/i18n/test_fi.py 2019-05-20 09:49:33.000000000
+0200
+++ new/validators-0.15.0/tests/i18n/test_fi.py 2020-04-02 14:46:08.000000000
+0200
@@ -21,7 +21,7 @@
('1333333-8',),
('1231233-9',),
])
-def test_returns_failed_validation_on_invalid_email(value):
+def test_returns_failed_validation_on_invalid_business_id(value):
assert isinstance(fi_business_id(value), ValidationFailure)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/validators-0.14.2/tests/test_card.py
new/validators-0.15.0/tests/test_card.py
--- old/validators-0.14.2/tests/test_card.py 1970-01-01 01:00:00.000000000
+0100
+++ new/validators-0.15.0/tests/test_card.py 2020-05-07 14:25:21.000000000
+0200
@@ -0,0 +1,190 @@
+# -*- coding: utf-8 -*-
+import pytest
+
+from validators import (
+ amex,
+ card_number,
+ diners,
+ discover,
+ jcb,
+ mastercard,
+ unionpay,
+ ValidationFailure,
+ visa
+)
+
+visa_cards = [
+ '4242424242424242',
+ '4000002760003184'
+]
+mastercard_cards = [
+ '5555555555554444',
+ '2223003122003222'
+]
+amex_cards = [
+ '378282246310005',
+ '371449635398431'
+]
+unionpay_cards = [
+ '6200000000000005'
+]
+diners_cards = [
+ '3056930009020004',
+ '36227206271667'
+]
+jcb_cards = [
+ '3566002020360505'
+]
+discover_cards = [
+ '6011111111111117',
+ '6011000990139424'
+]
+
+
[email protected](
+ "value",
+ visa_cards
+ + mastercard_cards
+ + amex_cards
+ + unionpay_cards
+ + diners_cards
+ + jcb_cards
+ + discover_cards,
+)
+def test_returns_true_on_valid_card_number(value):
+ assert card_number(value)
+
+
[email protected]('value', [
+ '4242424242424240',
+ '4000002760003180',
+ '400000276000318X'
+])
+def test_returns_failed_on_valid_card_number(value):
+ assert isinstance(card_number(value), ValidationFailure)
+
+
[email protected]('value', visa_cards)
+def test_returns_true_on_valid_visa(value):
+ assert visa(value)
+
+
[email protected](
+ "value",
+ mastercard_cards
+ + amex_cards
+ + unionpay_cards
+ + diners_cards
+ + jcb_cards
+ + discover_cards,
+)
+def test_returns_failed_on_valid_visa(value):
+ assert isinstance(visa(value), ValidationFailure)
+
+
[email protected]('value', mastercard_cards)
+def test_returns_true_on_valid_mastercard(value):
+ assert mastercard(value)
+
+
[email protected](
+ "value",
+ visa_cards
+ + amex_cards
+ + unionpay_cards
+ + diners_cards
+ + jcb_cards
+ + discover_cards,
+)
+def test_returns_failed_on_valid_mastercard(value):
+ assert isinstance(mastercard(value), ValidationFailure)
+
+
[email protected]('value', amex_cards)
+def test_returns_true_on_valid_amex(value):
+ assert amex(value)
+
+
[email protected](
+ "value",
+ visa_cards
+ + mastercard_cards
+ + unionpay_cards
+ + diners_cards
+ + jcb_cards
+ + discover_cards,
+)
+def test_returns_failed_on_valid_amex(value):
+ assert isinstance(amex(value), ValidationFailure)
+
+
[email protected]('value', unionpay_cards)
+def test_returns_true_on_valid_unionpay(value):
+ assert unionpay(value)
+
+
[email protected](
+ "value",
+ visa_cards
+ + mastercard_cards
+ + amex_cards
+ + diners_cards
+ + jcb_cards
+ + discover_cards,
+)
+def test_returns_failed_on_valid_unionpay(value):
+ assert isinstance(unionpay(value), ValidationFailure)
+
+
[email protected]('value', diners_cards)
+def test_returns_true_on_valid_diners(value):
+ assert diners(value)
+
+
[email protected](
+ "value",
+ visa_cards
+ + mastercard_cards
+ + amex_cards
+ + unionpay_cards
+ + jcb_cards
+ + discover_cards,
+)
+def test_returns_failed_on_valid_diners(value):
+ assert isinstance(diners(value), ValidationFailure)
+
+
[email protected]('value', jcb_cards)
+def test_returns_true_on_valid_jcb(value):
+ assert jcb(value)
+
+
[email protected](
+ "value",
+ visa_cards
+ + mastercard_cards
+ + amex_cards
+ + unionpay_cards
+ + diners_cards
+ + discover_cards,
+)
+def test_returns_failed_on_valid_jcb(value):
+ assert isinstance(jcb(value), ValidationFailure)
+
+
[email protected]('value', discover_cards)
+def test_returns_true_on_valid_discover(value):
+ assert discover(value)
+
+
[email protected](
+ "value",
+ visa_cards
+ + mastercard_cards
+ + amex_cards
+ + unionpay_cards
+ + diners_cards
+ + jcb_cards,
+)
+def test_returns_failed_on_valid_discover(value):
+ assert isinstance(discover(value), ValidationFailure)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/validators-0.14.2/tests/test_email.py
new/validators-0.15.0/tests/test_email.py
--- old/validators-0.14.2/tests/test_email.py 2015-10-10 08:47:39.000000000
+0200
+++ new/validators-0.15.0/tests/test_email.py 2020-04-02 14:46:33.000000000
+0200
@@ -34,6 +34,10 @@
('[email protected]',),
('[email protected]',),
('[email protected]',),
+ (
+ 'john56789.john56789.john56789.john56789.john56789.john56789.john5'
+ '@example.com',
+ ),
# Quoted-string format (CR not allowed)
('"\\\012"@here.com',),
])
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/validators-0.14.2/validators/__init__.py
new/validators-0.15.0/validators/__init__.py
--- old/validators-0.14.2/validators/__init__.py 2020-01-24
10:58:09.000000000 +0100
+++ new/validators-0.15.0/validators/__init__.py 2020-05-07
14:31:16.000000000 +0200
@@ -1,4 +1,14 @@
from .between import between
+from .card import (
+ amex,
+ card_number,
+ diners,
+ discover,
+ jcb,
+ mastercard,
+ unionpay,
+ visa
+)
from .domain import domain
from .email import email
from .extremes import Max, Min
@@ -17,6 +27,8 @@
__all__ = ('between', 'domain', 'email', 'Max', 'Min', 'md5', 'sha1', 'sha224',
'sha256', 'sha512', 'fi_business_id', 'fi_ssn', 'iban', 'ipv4',
'ipv4_cidr', 'ipv6', 'ipv6_cidr', 'length', 'mac_address', 'slug',
- 'truthy', 'url', 'ValidationFailure', 'validator', 'uuid')
+ 'truthy', 'url', 'ValidationFailure', 'validator', 'uuid',
+ 'card_number', 'visa', 'mastercard', 'amex', 'unionpay', 'diners',
+ 'jcb', 'discover')
-__version__ = '0.14.2'
+__version__ = '0.15.0'
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/validators-0.14.2/validators/card.py
new/validators-0.15.0/validators/card.py
--- old/validators-0.14.2/validators/card.py 1970-01-01 01:00:00.000000000
+0100
+++ new/validators-0.15.0/validators/card.py 2020-05-07 14:32:08.000000000
+0200
@@ -0,0 +1,183 @@
+import re
+
+from .utils import validator
+
+
+@validator
+def card_number(value):
+ """
+ Return whether or not given value is a valid card number.
+
+ This validator is based on Luhn algorithm.
+
+ .. luhn:
+ https://github.com/mmcloughlin/luhn
+
+ Examples::
+
+ >>> card_number('4242424242424242')
+ True
+
+ >>> card_number('4242424242424241')
+ ValidationFailure(func=card_number, args={'value': '4242424242424241'})
+
+ .. versionadded:: 0.15.0
+
+ :param value: card number string to validate
+ """
+ try:
+ digits = list(map(int, value))
+ odd_sum = sum(digits[-1::-2])
+ even_sum = sum([sum(divmod(2 * d, 10)) for d in digits[-2::-2]])
+ return (odd_sum + even_sum) % 10 == 0
+ except ValueError:
+ return False
+
+
+@validator
+def visa(value):
+ """
+ Return whether or not given value is a valid Visa card number.
+
+ Examples::
+
+ >>> visa('4242424242424242')
+ True
+
+ >>> visa('2223003122003222')
+ ValidationFailure(func=visa, args={'value': '2223003122003222'})
+
+ .. versionadded:: 0.15.0
+
+ :param value: Visa card number string to validate
+ """
+ pattern = re.compile(r'^4')
+ return card_number(value) and len(value) == 16 and pattern.match(value)
+
+
+@validator
+def mastercard(value):
+ """
+ Return whether or not given value is a valid Mastercard card number.
+
+ Examples::
+
+ >>> mastercard('5555555555554444')
+ True
+
+ >>> mastercard('4242424242424242')
+ ValidationFailure(func=mastercard, args={'value': '4242424242424242'})
+
+ .. versionadded:: 0.15.0
+
+ :param value: Mastercard card number string to validate
+ """
+ pattern = re.compile(r'^(51|52|53|54|55|22|23|24|25|26|27)')
+ return card_number(value) and len(value) == 16 and pattern.match(value)
+
+
+@validator
+def amex(value):
+ """
+ Return whether or not given value is a valid American Express card number.
+
+ Examples::
+
+ >>> amex('378282246310005')
+ True
+
+ >>> amex('4242424242424242')
+ ValidationFailure(func=amex, args={'value': '4242424242424242'})
+
+ .. versionadded:: 0.15.0
+
+ :param value: American Express card number string to validate
+ """
+ pattern = re.compile(r'^(34|37)')
+ return card_number(value) and len(value) == 15 and pattern.match(value)
+
+
+@validator
+def unionpay(value):
+ """
+ Return whether or not given value is a valid UnionPay card number.
+
+ Examples::
+
+ >>> unionpay('6200000000000005')
+ True
+
+ >>> unionpay('4242424242424242')
+ ValidationFailure(func=unionpay, args={'value': '4242424242424242'})
+
+ .. versionadded:: 0.15.0
+
+ :param value: UnionPay card number string to validate
+ """
+ pattern = re.compile(r'^62')
+ return card_number(value) and len(value) == 16 and pattern.match(value)
+
+
+@validator
+def diners(value):
+ """
+ Return whether or not given value is a valid Diners Club card number.
+
+ Examples::
+
+ >>> diners('3056930009020004')
+ True
+
+ >>> diners('4242424242424242')
+ ValidationFailure(func=diners, args={'value': '4242424242424242'})
+
+ .. versionadded:: 0.15.0
+
+ :param value: Diners Club card number string to validate
+ """
+ pattern = re.compile(r'^(30|36|38|39)')
+ return (
+ card_number(value) and len(value) in [14, 16] and pattern.match(value)
+ )
+
+
+@validator
+def jcb(value):
+ """
+ Return whether or not given value is a valid JCB card number.
+
+ Examples::
+
+ >>> jcb('3566002020360505')
+ True
+
+ >>> jcb('4242424242424242')
+ ValidationFailure(func=jcb, args={'value': '4242424242424242'})
+
+ .. versionadded:: 0.15.0
+
+ :param value: JCB card number string to validate
+ """
+ pattern = re.compile(r'^35')
+ return card_number(value) and len(value) == 16 and pattern.match(value)
+
+
+@validator
+def discover(value):
+ """
+ Return whether or not given value is a valid Discover card number.
+
+ Examples::
+
+ >>> discover('6011111111111117')
+ True
+
+ >>> discover('4242424242424242')
+ ValidationFailure(func=discover, args={'value': '4242424242424242'})
+
+ .. versionadded:: 0.15.0
+
+ :param value: Discover card number string to validate
+ """
+ pattern = re.compile(r'^(60|64|65)')
+ return card_number(value) and len(value) == 16 and pattern.match(value)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/validators-0.14.2/validators/domain.py
new/validators-0.15.0/validators/domain.py
--- old/validators-0.14.2/validators/domain.py 2020-01-24 10:56:27.000000000
+0100
+++ new/validators-0.15.0/validators/domain.py 2020-04-02 14:34:58.000000000
+0200
@@ -58,5 +58,5 @@
"""
try:
return pattern.match(to_unicode(value).encode('idna').decode('ascii'))
- except UnicodeError:
+ except (UnicodeError, AttributeError):
return False
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/validators-0.14.2/validators/email.py
new/validators-0.15.0/validators/email.py
--- old/validators-0.14.2/validators/email.py 2015-10-10 08:47:54.000000000
+0200
+++ new/validators-0.15.0/validators/email.py 2020-04-02 15:03:56.000000000
+0200
@@ -62,6 +62,9 @@
if not user_regex.match(user_part):
return False
+ if len(user_part.encode("utf-8")) > 64:
+ return False
+
if domain_part not in whitelist and not domain_regex.match(domain_part):
# Try for possible IDN domain-part
try:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/validators-0.14.2/validators/url.py
new/validators-0.15.0/validators/url.py
--- old/validators-0.14.2/validators/url.py 2018-11-13 13:11:17.000000000
+0100
+++ new/validators-0.15.0/validators/url.py 2020-04-02 15:03:56.000000000
+0200
@@ -69,11 +69,11 @@
r"(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])"
r")\]|"
# host name
- u"(?:(?:[a-z\u00a1-\uffff0-9]-?)*[a-z\u00a1-\uffff0-9]+)"
+ r"(?:(?:[a-z\u00a1-\uffff0-9]-?)*[a-z\u00a1-\uffff0-9]+)"
# domain name
- u"(?:\.(?:[a-z\u00a1-\uffff0-9]-?)*[a-z\u00a1-\uffff0-9]+)*"
+ r"(?:\.(?:[a-z\u00a1-\uffff0-9]-?)*[a-z\u00a1-\uffff0-9]+)*"
# TLD identifier
- u"(?:\.(?:[a-z\u00a1-\uffff]{2,}))"
+ r"(?:\.(?:[a-z\u00a1-\uffff]{2,}))"
r")"
# port number
r"(?::\d{2,5})?"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/validators-0.14.2/validators.egg-info/PKG-INFO
new/validators-0.15.0/validators.egg-info/PKG-INFO
--- old/validators-0.14.2/validators.egg-info/PKG-INFO 2020-01-24
11:01:48.000000000 +0100
+++ new/validators-0.15.0/validators.egg-info/PKG-INFO 2020-05-07
14:32:56.000000000 +0200
@@ -1,6 +1,6 @@
Metadata-Version: 2.1
Name: validators
-Version: 0.14.2
+Version: 0.15.0
Summary: Python Data Validation for Humans™.
Home-page: https://github.com/kvesteri/validators
Author: Konsta Vesterinen
@@ -18,8 +18,6 @@
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python
-Classifier: Programming Language :: Python :: 2
-Classifier: Programming Language :: Python :: 2.7
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.4
Classifier: Programming Language :: Python :: 3.5
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/validators-0.14.2/validators.egg-info/SOURCES.txt
new/validators-0.15.0/validators.egg-info/SOURCES.txt
--- old/validators-0.14.2/validators.egg-info/SOURCES.txt 2020-01-24
11:01:48.000000000 +0100
+++ new/validators-0.15.0/validators.egg-info/SOURCES.txt 2020-05-07
14:32:56.000000000 +0200
@@ -9,6 +9,7 @@
docs/make.bat
tests/__init__.py
tests/test_between.py
+tests/test_card.py
tests/test_domain.py
tests/test_email.py
tests/test_extremes.py
@@ -33,6 +34,7 @@
tests/i18n/test_fi.py
validators/__init__.py
validators/between.py
+validators/card.py
validators/domain.py
validators/email.py
validators/extremes.py