Skip to content

Commit 036a7ae

Browse files
kelsoncmCopilot
andcommitted
feat: Update README and documentation to include masks utilities; bump version to 1.1.9
Co-authored-by: Copilot <copilot@github.com>
1 parent 4cf4053 commit 036a7ae

3 files changed

Lines changed: 26 additions & 4 deletions

File tree

README.md

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,32 @@
88
[![Docs](https://github.com/kelsoncm/python-sc4py/actions/workflows/docs.yml/badge.svg)](https://kelsoncm.github.io/python-sc4py/)
99
[![pre-commit](https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit)](https://github.com/pre-commit/pre-commit)
1010

11-
Utilities for date/time, environment parsing, dynamic class loading, percentages, string-to-bool conversion, choice tuples, and in-memory ZIP reading.
11+
Utilities for date/time, environment parsing, dynamic class loading, percentages, string-to-bool conversion, choice tuples,
12+
in-memory ZIP reading, and advanced string masking/validation (CPF/CNPJ, DVs, etc).
1213

1314
> See each package's [documentation](https://kelsoncm.github.io/python-sc4py/) for details and usage examples.
1415
16+
## Masks utilities (CPF/CNPJ, DVs, etc)
17+
18+
```python
19+
from sc4py.masks import apply_mask, validate_masked_value, validate_mask, validate_mod11, validate_dv_by_mask
20+
21+
# Apply a mask
22+
print(apply_mask('12345678901', '###.###.###-##')) # '123.456.789-01'
23+
24+
# Validate masked value
25+
print(validate_masked_value('12345678901', '###.###.###-##')) # '123.456.789-01'
26+
27+
# Validate mask
28+
validate_mask('###.###-##')
29+
30+
# Validate mod11 DV
31+
validate_mod11('12345678909', 11, 2)
32+
33+
# Validate value and DV by mask
34+
print(validate_dv_by_mask('12345678909', '#########00')) # '12345678909'
35+
```
36+
1537
## Installation
1638

1739
```bash

docs/index.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,13 +46,13 @@ Installation
4646
Modules
4747
-------
4848

49-
* :doc:`sc4py.choice <sc4py.choice>` - Convert plain values and `Enum` types to Django-style choice tuples
5049
* :doc:`sc4py.datetime <sc4py.datetime>` - Date/time helpers and `daterange` generator
5150
* :doc:`sc4py.env <sc4py.env>` - Type-safe environment variable reading
5251
* :doc:`sc4py.klass <sc4py.klass>` - Dynamic class instantiation from dotted path strings
5352
* :doc:`sc4py.number <sc4py.number>` - Percentage calculation
5453
* :doc:`sc4py.str <sc4py.str>` - Multilingual boolean string parsing
5554
* :doc:`sc4py.zip <sc4py.zip>` - In-memory ZIP extraction (text and CSV)
55+
* :doc:`sc4py.masks <sc4py.masks>` - String masking, validation and DV utilities (mod11)
5656

5757
Quick start
5858
-----------

pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
44

55
[project]
66
name = "sc4py"
7-
version = "1.1.7"
7+
version = "1.1.9"
88
description = "Python library specific brazilian validations"
99
readme = "README.md"
1010
license = { file = "LICENSE.md" }
@@ -48,7 +48,7 @@ where = ["."]
4848
include = ["sc4py*"]
4949

5050
[tool.coverage.run]
51-
source = ["pyfwf"]
51+
source = ["sc4py"]
5252
omit = ["tests/*", "sandbox/*"]
5353

5454
[tool.coverage.report]

0 commit comments

Comments
 (0)