Metadata-Version: 2.1
Name: pyshn
Version: 0.2.0
Summary: My python swiss army knife
Home-page: https://github.com/shneiderfku/pyshn/
Author: Rafael Ribeiro
Author-email: shneiderfku@outlook.com
License: MIT
Project-URL: Issue Tracker, https://github.com/shneiderfku/pyshn/issues/
Project-URL: Source Code, https://github.com/shneiderfku/pyshn/
Project-URL: Twitter, https://twitter.com/shneiderfku/
Platform: UNKNOWN
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3.9
Classifier: Topic :: Software Development :: Libraries
Requires-Python: >=3.9
Description-Content-Type: text/x-rst

pyshn
=====

My python swiss army knife.

Installing
----------

Install and update using `pip`_:

.. code-block:: text

    $ pip install -U pyshn

.. _pip: https://pip.pypa.io/en/stable/quickstart/

Usage
-----

.. code-block:: python

    from pyshn.cpf import cpf

    print(cpf(1))
    # raises pyshn.cpf.CpfError: invalid number '1'

    print(cpf(191))
    # 000.000.001-91

    print(cpf("191"))
    # raises pyshn.cpf.CpfError: invalid format '191'.

    print(cpf("00000000191"))
    # 000.000.001-91

    print(cpf("000000001/91"))
    # 000.000.001-91

    print(cpf("000.000.001-91"))
    # 000.000.001-91

    print(format(cpf(191)))
    # 000.000.001-91

    print(format(cpf(191), 'n'))
    # 00000000191

    print(format(cpf(191), 'N'))
    # 000000001/91

    print(format(cpf(191), 'chewbacca'))
    # ValueError: Invalid format specifier

    print(int(cpf(191)))
    # 191

    print(cpf(1, generate=True))
    # 000.000.001-91

    print(cpf("1", generate=True))
    # pyshn.cpf.CpfError: invalid format '1'.

    print(cpf("000000001", generate=True))
    # 000.000.001-91

    print(cpf("000.000.001", generate=True))
    # 000.000.001-91

    print(cpf(1, validate=False))
    # 000.000.000-01

    print(bool(cpf(1, validate=False)))
    # False

    print(bool(cpf(191, validate=False)))
    # True

    from random import random
    print(cpf(int(random()*999_999_999), generate=True))
    # 238.671.110-22

Links
-----

-   PyPI Releases: https://pypi.org/project/pyshn/
-   Source Code: https://github.com/shneiderfku/pyshn/
-   Issue Tracker: https://github.com/shneiderfku/pyshn/issues/  

