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: True
if the document number is valid,False
otherwise.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 ci
is 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'