
    @6i                     *    d Z ddlmZ edefd       Zy)zRussia.    )	validatorvaluec                 x   | sy	 t        t        t        |             }t        |      dk(  rJg d}t	        t        ||      D cg c]
  \  }}||z   c}}      dz  }|dkD  r|dz  |d   k(  S ||d   k(  S t        |      dk(  rg d}t	        t        ||      D cg c]
  \  }}||z   c}}      dz  }g d	}t	        t        ||      D cg c]
  \  }}||z   c}}      dz  }	|dkD  r|dz  |d
   k(  S |	dkD  r||d
   k(  xr |	dz  |d   k(  S |	|d   k(  S yc c}}w c c}}w c c}}w # t        $ r Y yw xY w)a  Validate a Russian INN (Taxpayer Identification Number).

    The INN can be either 10 digits (for companies) or 12 digits (for individuals).
    The function checks both the length and the control digits according to Russian tax rules.

    Examples:
        >>> ru_inn('500100732259')  # Valid 12-digit INN
        True
        >>> ru_inn('7830002293')    # Valid 10-digit INN
        True
        >>> ru_inn('1234567890')    # Invalid INN
        ValidationError(func=ru_inn, args={'value': '1234567890'})

    Args:
        value: Russian INN string to validate. Can contain only digits.

    Returns:
        (Literal[True]): If `value` is a valid Russian INN.
        (ValidationError): If `value` is an invalid Russian INN.

    Note:
        The validation follows the official algorithm:
        - For 10-digit INN: checks 10th control digit
        - For 12-digit INN: checks both 11th and 12th control digits
    F
   )
      r         	   r         r      r      )   r   r   r   r	   r
   r   r   r   r   r   r   )r	   r   r   r   r   r	   r
   r   r   r   r   r   )listmapintlensumzip
ValueError)
r   digitsweight_coefsdwcontrol_numberweight_coefs1control_number1weight_coefs2control_number2s
             U/home/azureuser/techstart-app/venv/lib/python3.12/site-packages/validators/i18n/ru.pyru_innr$      s   6 c#uo&v;":L C4M!NDAq!a%!NORTTN "A%  "$3 $vbz1 [BAM!S5O"PTQ1q5"PQTVVOAM!S5O"PTQ1q5"PQTVVO #Q& !2%&*4 #Q& %r
2["8LQWXZQ[7[
 %r
2 ) "O #Q"P  sS   ?D- D
D- .D- 6&D- D!
+#D- D'
D- 8D- D- D- -	D98D9N)__doc__validators.utilsr   strr$        r#   <module>r*      s&     & 8# 8 8r)   