ciuy
🇺🇾 🇪🇸 Documentación en español disponible aquí / Spanish documentation is available here.
Package for validating Uruguayan identity document numbers. Full documentation is available here.
The functions in this package work with strings and ignore any non-digit characters. Numbers are valid too. So for example, the following expressions represent the same document number:
'1.234.567-2'
'12345672'
12345672
This package includes the following functions:
validate_ci(ci: str) -> bool: Returns true if ci is a valid document number, returns false otherwise. ci is a string which represents a document number, including the validation digit. ci can be a number as well.
validation_digit(ci: str) -> str: Returns the validation digit for ci.
random() -> str: Returns a random document number (including validation digit) in the (100.000, 9.999.999) range.
Installation
$ pip install ciuy
Usage
>>> import ciuy
>>> ciuy.validate_ci("1.234.567-2")
True
>>> ciuy.validation_digit("1.234.567")
'2'
>>> ciuy.random()
'82405816'
Testing
This package includes some doctests, as well as unit tests that can be run with pytest.
After cloning the repository, you can run the doctests with:
$ python3 -m doctest ./ciuy/__init__.py -v
(several lines ommited)
11 passed and 0 failed.
Test passed.
Use py.test to run the unit tests:
$ py.test
============================= test session starts ==============================
platform linux -- Python 3.8.1, pytest-5.3.5, py-1.8.1, pluggy-0.13.1
rootdir: /home/ciuy
collected 98 items
tests\test_clean.py .......... [ 10%]
tests\test_command_line.py ........................ [ 34%]
tests\test_random_ci.py .. [ 36%]
tests\test_validate_ci.py ....................................... [ 76%]
tests\test_validation_digit.py ....................... [100%]
============================== 98 passed in 1.09s =============================
You can also use pytest to run all tests, including doctests, with:
$ py.test --doctest-modules
Command line
After installation, the following commands become available:
$ validate_ci 1.234.567-2
True
$ validation_digit 1.234.567
2
$ random_ci
82405816
Based on the ci_uy Ruby gem by Fernando Briano (link).
Metadata
Release files for ciuy 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| ciuy-1.0.0.tar.gz | 3.7 kB | Without provenance | Details for ciuy-1.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| ciuy-1.0.0-py3-none-any.whl | Python 3 | none | any | Details for ciuy-1.0.0-py3-none-any.whl |
Total release size: 8.8 kB
Release files / ciuy-1.0.0.tar.gz
| Download URL | ciuy-1.0.0.tar.gz |
|---|---|
| Size | 3.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
3b9c1b314b44d6e559cd3ac40492595f1e5c0157128acf2c67e0ec7a7dc44c9c
|
|
BLAKE2b-256 checksum How to use checksums |
856819eaca0886a7fddb465efde3fd7a37835cde75cb3cc7fd4b93a9af22eb40
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/45.2.0 requests-toolbelt/0.9.1 tqdm/4.42.1 CPython/3.6.4
|
Release files / ciuy-1.0.0-py3-none-any.whl
| Download URL | ciuy-1.0.0-py3-none-any.whl |
|---|---|
| Size | 5.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e073cfb5758d0f8c943bcf4c5cb8f362901f91e242c1577245ba60b4c433e375
|
|
BLAKE2b-256 checksum How to use checksums |
729209afe2888190a68d0bc767d7d1ec89f731767952df527ebb6e6396909c42
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/45.2.0 requests-toolbelt/0.9.1 tqdm/4.42.1 CPython/3.6.4
|
Security for ciuy 1.0.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.