Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package python-validators for 
openSUSE:Factory checked in at 2024-07-10 16:47:55
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-validators (Old)
 and      /work/SRC/openSUSE:Factory/.python-validators.new.2080 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "python-validators"

Wed Jul 10 16:47:55 2024 rev:26 rq:1186395 version:0.31.0

Changes:
--------
--- /work/SRC/openSUSE:Factory/python-validators/python-validators.changes      
2024-07-05 19:49:34.930849359 +0200
+++ 
/work/SRC/openSUSE:Factory/.python-validators.new.2080/python-validators.changes
    2024-07-10 16:48:01.232324473 +0200
@@ -1,0 +2,8 @@
+Tue Jul  9 12:49:35 UTC 2024 - Mia Herkt <m...@0x0.st>
+
+- Update to 0.31.0
+Features:
+  * add validators for base16 and base32 encodings
+    gh#kvesteri/validators#386
+
+-------------------------------------------------------------------

Old:
----
  validators-0.30.0.tar.gz

New:
----
  validators-0.31.0.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ python-validators.spec ++++++
--- /var/tmp/diff_new_pack.yhPgCo/_old  2024-07-10 16:48:01.912349443 +0200
+++ /var/tmp/diff_new_pack.yhPgCo/_new  2024-07-10 16:48:01.916349590 +0200
@@ -18,7 +18,7 @@
 
 %{?sle15_python_module_pythons}
 Name:           python-validators
-Version:        0.30.0
+Version:        0.31.0
 Release:        0
 Summary:        Python Data Validation
 License:        MIT

++++++ validators-0.30.0.tar.gz -> validators-0.31.0.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/validators-0.30.0/CHANGES.md 
new/validators-0.31.0/CHANGES.md
--- old/validators-0.30.0/CHANGES.md    2024-07-04 04:34:28.000000000 +0200
+++ new/validators-0.31.0/CHANGES.md    2024-07-08 14:01:34.000000000 +0200
@@ -9,6 +9,24 @@
 
 -->
 
+## 0.31.0 (2024-07-08)
+
+_**Breaking**_
+
+> No breaking changes were introduced in this version.
+
+_**Features**_
+
+- feat: add validators for `base16` and `base32` encodings by @msamsami in 
[#386](https://github.com/python-validators/validators/pull/386)
+
+_**Maintenance**_
+
+- maint: bump version by @msamsami in 
[#386](https://github.com/python-validators/validators/pull/386)
+
+**Full Changelog**: 
[`0.30.0...0.31.0`](https://github.com/python-validators/validators/compare/0.30.0...0.31.0)
+
+---
+
 ## 0.30.0 (2024-07-04)
 
 _**Breaking**_
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/validators-0.30.0/PKG-INFO 
new/validators-0.31.0/PKG-INFO
--- old/validators-0.30.0/PKG-INFO      2024-07-04 04:35:55.351689600 +0200
+++ new/validators-0.31.0/PKG-INFO      2024-07-08 14:06:19.879531400 +0200
@@ -1,6 +1,6 @@
 Metadata-Version: 2.1
 Name: validators
-Version: 0.30.0
+Version: 0.31.0
 Summary: Python Data Validation for Humans™
 Author-email: Konsta Vesterinen <kon...@fastmonkeys.com>
 License: MIT
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/validators-0.30.0/docs/api/encoding.md 
new/validators-0.31.0/docs/api/encoding.md
--- old/validators-0.30.0/docs/api/encoding.md  2024-07-01 06:00:02.000000000 
+0200
+++ new/validators-0.31.0/docs/api/encoding.md  2024-07-08 14:01:34.000000000 
+0200
@@ -1,4 +1,6 @@
 # encoding
 
+::: validators.encoding.base16
+::: validators.encoding.base32
 ::: validators.encoding.base58
 ::: validators.encoding.base64
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/validators-0.30.0/docs/api/encoding.rst 
new/validators-0.31.0/docs/api/encoding.rst
--- old/validators-0.30.0/docs/api/encoding.rst 2024-07-04 04:35:51.000000000 
+0200
+++ new/validators-0.31.0/docs/api/encoding.rst 2024-07-08 14:06:16.000000000 
+0200
@@ -2,5 +2,7 @@
 --------
 
 .. module:: validators.encoding
+.. autofunction:: base16
+.. autofunction:: base32
 .. autofunction:: base58
 .. autofunction:: base64
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/validators-0.30.0/docs/validators.1 
new/validators-0.31.0/docs/validators.1
--- old/validators-0.30.0/docs/validators.1     2024-07-04 04:35:52.000000000 
+0200
+++ new/validators-0.31.0/docs/validators.1     2024-07-08 14:06:17.000000000 
+0200
@@ -27,7 +27,7 @@
 .\" new: \\n[rst2man-indent\\n[rst2man-indent-level]]
 .in \\n[rst2man-indent\\n[rst2man-indent-level]]u
 ..
-.TH "VALIDATORS" "1" "Jul 04, 2024" "0.30.0" "validators"
+.TH "VALIDATORS" "1" "Jul 08, 2024" "0.31.0" "validators"
 .SH NAME
 validators \- Python Data Validation for Humans™
 .sp
@@ -784,6 +784,62 @@
 .SS encoding
 .INDENT 0.0
 .TP
+.B validators.encoding.base16(value:  str, /)
+Return whether or not given value is a valid base16 encoding.
+.sp
+Examples
+.sp
+.nf
+.ft C
+>>> base16(\(aqa3f4b2\(aq)
+# Output: True
+>>> base16(\(aqa3f4Z1\(aq)
+# Output: ValidationError(func=base16, args={\(aqvalue\(aq: \(aqa3f4Z1\(aq})
+.ft P
+.fi
+.INDENT 7.0
+.TP
+.B Parameters
+\fBvalue\fP \-\- base16 string to validate.
+.TP
+.B Returns
+If \fIvalue\fP is a valid base16 encoding.
+(ValidationError): If \fIvalue\fP is an invalid base16 encoding.
+.TP
+.B Return type
+(Literal[True])
+.UNINDENT
+.UNINDENT
+.INDENT 0.0
+.TP
+.B validators.encoding.base32(value:  str, /)
+Return whether or not given value is a valid base32 encoding.
+.sp
+Examples
+.sp
+.nf
+.ft C
+>>> base32(\(aqMFZWIZLTOQ======\(aq)
+# Output: True
+>>> base32(\(aqMfZW3zLT9Q======\(aq)
+# Output: ValidationError(func=base32, args={\(aqvalue\(aq: 
\(aqMfZW3zLT9Q======\(aq})
+.ft P
+.fi
+.INDENT 7.0
+.TP
+.B Parameters
+\fBvalue\fP \-\- base32 string to validate.
+.TP
+.B Returns
+If \fIvalue\fP is a valid base32 encoding.
+(ValidationError): If \fIvalue\fP is an invalid base32 encoding.
+.TP
+.B Return type
+(Literal[True])
+.UNINDENT
+.UNINDENT
+.INDENT 0.0
+.TP
 .B validators.encoding.base58(value:  str, /)
 Return whether or not given value is a valid base58 encoding.
 .sp
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/validators-0.30.0/src/validators/__init__.py 
new/validators-0.31.0/src/validators/__init__.py
--- old/validators-0.30.0/src/validators/__init__.py    2024-07-04 
04:34:28.000000000 +0200
+++ new/validators-0.31.0/src/validators/__init__.py    2024-07-08 
14:01:34.000000000 +0200
@@ -8,7 +8,7 @@
 from .crypto_addresses import btc_address, eth_address, trx_address
 from .domain import domain
 from .email import email
-from .encoding import base58, base64
+from .encoding import base16, base32, base58, base64
 from .finance import cusip, isin, sedol
 from .hashes import md5, sha1, sha224, sha256, sha512
 from .hostname import hostname
@@ -60,6 +60,8 @@
     # ...
     "email",
     # encodings
+    "base16",
+    "base32",
     "base58",
     "base64",
     # finance
@@ -105,4 +107,4 @@
     "validator",
 )
 
-__version__ = "0.30.0"
+__version__ = "0.31.0"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/validators-0.30.0/src/validators/encoding.py 
new/validators-0.31.0/src/validators/encoding.py
--- old/validators-0.30.0/src/validators/encoding.py    2024-07-01 
05:30:21.000000000 +0200
+++ new/validators-0.31.0/src/validators/encoding.py    2024-07-08 
14:01:34.000000000 +0200
@@ -8,6 +8,48 @@
 
 
 @validator
+def base16(value: str, /):
+    """Return whether or not given value is a valid base16 encoding.
+
+    Examples:
+        >>> base16('a3f4b2')
+        # Output: True
+        >>> base16('a3f4Z1')
+        # Output: ValidationError(func=base16, args={'value': 'a3f4Z1'})
+
+    Args:
+        value:
+            base16 string to validate.
+
+    Returns:
+        (Literal[True]): If `value` is a valid base16 encoding.
+        (ValidationError): If `value` is an invalid base16 encoding.
+    """
+    return re.match(r"^[0-9A-Fa-f]+$", value) if value else False
+
+
+@validator
+def base32(value: str, /):
+    """Return whether or not given value is a valid base32 encoding.
+
+    Examples:
+        >>> base32('MFZWIZLTOQ======')
+        # Output: True
+        >>> base32('MfZW3zLT9Q======')
+        # Output: ValidationError(func=base32, args={'value': 
'MfZW3zLT9Q======'})
+
+    Args:
+        value:
+            base32 string to validate.
+
+    Returns:
+        (Literal[True]): If `value` is a valid base32 encoding.
+        (ValidationError): If `value` is an invalid base32 encoding.
+    """
+    return re.match(r"^[A-Z2-7]+=*$", value) if value else False
+
+
+@validator
 def base58(value: str, /):
     """Return whether or not given value is a valid base58 encoding.
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/validators-0.30.0/src/validators.egg-info/PKG-INFO 
new/validators-0.31.0/src/validators.egg-info/PKG-INFO
--- old/validators-0.30.0/src/validators.egg-info/PKG-INFO      2024-07-04 
04:35:55.000000000 +0200
+++ new/validators-0.31.0/src/validators.egg-info/PKG-INFO      2024-07-08 
14:06:19.000000000 +0200
@@ -1,6 +1,6 @@
 Metadata-Version: 2.1
 Name: validators
-Version: 0.30.0
+Version: 0.31.0
 Summary: Python Data Validation for Humans™
 Author-email: Konsta Vesterinen <kon...@fastmonkeys.com>
 License: MIT
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/validators-0.30.0/tests/test_encoding.py 
new/validators-0.31.0/tests/test_encoding.py
--- old/validators-0.30.0/tests/test_encoding.py        2024-07-01 
05:30:21.000000000 +0200
+++ new/validators-0.31.0/tests/test_encoding.py        2024-07-08 
14:01:34.000000000 +0200
@@ -4,7 +4,71 @@
 import pytest
 
 # local
-from validators import ValidationError, base58, base64
+from validators import ValidationError, base16, base32, base58, base64
+
+# ==> base16 <== #
+
+
+@pytest.mark.parametrize(
+    "value",
+    [
+        "a3f4b2",
+        "01ef",
+        "abcdef0123456789",
+        "1234567890abcdef",
+        "1a2b3c",
+        "abcdef",
+        "000102030405060708090A0B0C0D0E0F",
+    ],
+)
+def test_returns_true_on_valid_base16(value: str):
+    """Test returns true on valid base16."""
+    assert base16(value)
+
+
+@pytest.mark.parametrize(
+    "value",
+    ["12345g", "hello world", "1234567890abcdeg", "GHIJKL", "12345G", 
"!@#$%^", "1a2h3c", "a3f4Z1"],
+)
+def test_returns_failed_validation_on_invalid_base16(value: str):
+    """Test returns failed validation on invalid base16."""
+    assert isinstance(base16(value), ValidationError)
+
+
+# ==> base32 <== #
+
+
+@pytest.mark.parametrize(
+    "value",
+    [
+        "JBSWY3DPEHPK3PXP",
+        "MFRGGZDFMZTWQ2LK",
+        "MZXW6YTBOI======",
+        "MFZWIZLTOQ======",
+        "GEZDGNBVGY3TQOJQGEZDGNBVGY3TQOJQ",
+        "MFRGGZDFMZTWQ2LKNNWG23Q=",
+    ],
+)
+def test_returns_true_on_valid_base32(value: str):
+    """Test returns true on valid base32."""
+    assert base32(value)
+
+
+@pytest.mark.parametrize(
+    "value",
+    [
+        "ThisIsNotBase32!",
+        "12345!",
+        "Any==invalid=base32=",
+        "MzXW6yTBOI======",
+        "JBSWY8DPEHPK9PXP",
+        "MfZW3zLT9Q======",
+    ],
+)
+def test_returns_failed_validation_on_invalid_base32(value: str):
+    """Test returns failed validation on invalid base32."""
+    assert isinstance(base32(value), ValidationError)
+
 
 # ==> base58 <== #
 

Reply via email to