# stdnum.py.ruc

RUC number (Registro Único de Contribuyentes, Paraguay tax number).

The Registro Único del Contribuyente (RUC) is the unique taxpayer registry that maintains identification numbers for all persons (national or foreign) and legal entities in Paraguay.

The RUC number for legal entities consists of 8 digits starting after 80000000. Number for residents and foreigners are up to 9 digits. The last digit is a check digit.

More information:

- https://www.ruc.com.py/

    >>> validate('80028061-0')
    '800280610'
    >>> validate('9991603')
    '9991603'
    >>> validate('2660-3')
    '26603'
    >>> validate('800532492')
    Traceback (most recent call last):
        ...
    InvalidChecksum: ...
    >>> validate('80123456789')
    Traceback (most recent call last):
        ...
    InvalidLength: ...
    >>> format('800000358')
    '80000035-8'

`stdnum.py.ruc.``calc_check_digit`(number)

  Calculate the check digit.

  The number passed should not have the check digit included.

`stdnum.py.ruc.``compact`(number)

  Convert the number to the minimal representation.

  This strips the number of any valid separators and removes surrounding whitespace.

`stdnum.py.ruc.``format`(number)

  Reformat the number to the standard presentation format.

`stdnum.py.ruc.``is_valid`(number)

  Check if the number is a valid Paraguay RUC number.

`stdnum.py.ruc.``validate`(number)

  Check if the number is a valid Paraguay RUC number.

  This checks the length, formatting and check digit.