Functions and examples¶
-
ciuy.validate_ci(ci)¶ Validates the document number passed as a paremeter.
Parameters: ci (str) – The document number to validate. Any non-digit characters are ignored. A number can be passed as a parameter as well. Returns: Trueif the document number is valid,Falseotherwise.Return type: bool Raises: ValueError – if ci, without including the validation digit, is lower than 100.000 or higher than 9.999.999.
>>> ciuy.validate_ci(1.234.567-2)
True
-
ciuy.validation_digit(ci)¶ Returns the validation digit for a given document number.
Parameters: ci (str) – The document number for which one wants to find the validation digit. Any non-digit characters are ignored. A number can be passed as a parameter as well. Returns: The validation digit. Return type: bool Raises: ValueError – if ciis lower than 100.000 or higher than 9.999.999.
>>> ciuy.validation_digit(1.234.567)
'2'
-
ciuy.random()¶ Returns a random document number, including validation digit. The document number is in the (100.000, 9.999.999) range.
Returns: A random valid document number. Return type: str
>>> ciuy.random()
'82405816'