stdnum.uy.rut

RUT (Registro Único Tributario, Uruguay tax number).

The Registro Único Tributario (RUT) is an identifier of legal entities for tax purposes.

This number consists of 12 digits, the first two indicate the registration number, followed by a 6 digit sequence number, followed by 001 and a check digit.

More information:

>>> validate('21-100342-001-7')
'211003420017'
>>> validate('UY 21 140634 001 1')
'211406340011'
>>> validate('210303670014')
Traceback (most recent call last):
    ...
InvalidChecksum: ...
>>> validate('12345678')
Traceback (most recent call last):
    ...
InvalidLength: ...
>>> format('211003420017')
'21-100342-001-7'
stdnum.uy.rut.calc_check_digit(number: str) str

Calculate the check digit.

stdnum.uy.rut.compact(number: str) str

Convert the number to the minimal representation.

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

stdnum.uy.rut.format(number: str) str

Reformat the number to the standard presentation format.

stdnum.uy.rut.is_valid(number: str) bool

Check if the number is a valid Uruguay RUT number.

stdnum.uy.rut.validate(number: str) str

Check if the number is a valid Uruguay RUT number.

This checks the length, formatting and check digit.