from __future__ import unicode_literals
from .. import Provider as SsnProvider


# Note: as there no SSN in Ukraine
# we get value added tax identification number (VATIN) here.
# It is also called "Ідентифікаційний номер платника податків" (in ukrainian).
# It contains only digits and length if 12.


class Provider(SsnProvider):
    ssn_formats = ("############",)

from __future__ import unicode_literals

from datetime import date

from .. import Provider as SsnProvider
from faker.providers.date_time import Provider as DateTimeProvider


class Provider(SsnProvider):
    @classmethod
    def ssn(cls):
        """
        Ukrainian "Реєстраційний номер облікової картки платника податків"
        also known as "Ідентифікаційний номер фізичної особи".
        """
        digits = []

        # Number of days between 1899-12-31 and a birth date
        for digit in str((DateTimeProvider.date_object() -
                          date(1899, 12, 31)).days):
            digits.append(int(digit))

        # Person's sequence number
        for _ in range(4):
            digits.append(cls.random_int(0, 9))

        checksum = (digits[0]*-1 + digits[1]*5 + digits[2]*7 + digits[3]*9 +
                    digits[4]*4 + digits[5]*6 + digits[6]*10 + digits[7]*5 +
                    digits[8]*7)
        # Remainder of a checksum divided by 11 or 1 if it equals to 10
        digits.append(checksum % 11 % 10)

        return ''.join(str(digit) for digit in digits)

Make the Ukrainian SSN provider realer
Make the Ukrainian SSN  provider realer


  from __future__ import unicode_literals
+ 
+ from datetime import date
+ 
  from .. import Provider as SsnProvider
+ from faker.providers.date_time import Provider as DateTimeProvider
- 
- 
- # Note: as there no SSN in Ukraine
- # we get value added tax identification number (VATIN) here.
- # It is also called "Ідентифікаційний номер платника податків" (in ukrainian).
- # It contains only digits and length if 12.
  
  
  class Provider(SsnProvider):
-     ssn_formats = ("############",)
+     @classmethod
+     def ssn(cls):
+         """
+         Ukrainian "Реєстраційний номер облікової картки платника податків"
+         also known as "Ідентифікаційний номер фізичної особи".
+         """
+         digits = []
  
+         # Number of days between 1899-12-31 and a birth date
+         for digit in str((DateTimeProvider.date_object() -
+                           date(1899, 12, 31)).days):
+             digits.append(int(digit))
+ 
+         # Person's sequence number
+         for _ in range(4):
+             digits.append(cls.random_int(0, 9))
+ 
+         checksum = (digits[0]*-1 + digits[1]*5 + digits[2]*7 + digits[3]*9 +
+                     digits[4]*4 + digits[5]*6 + digits[6]*10 + digits[7]*5 +
+                     digits[8]*7)
+         # Remainder of a checksum divided by 11 or 1 if it equals to 10
+         digits.append(checksum % 11 % 10)
+ 
+         return ''.join(str(digit) for digit in digits)
+ 
Make the Ukrainian SSN provider realer
## Code Before:
from __future__ import unicode_literals
from .. import Provider as SsnProvider


# Note: as there no SSN in Ukraine
# we get value added tax identification number (VATIN) here.
# It is also called "Ідентифікаційний номер платника податків" (in ukrainian).
# It contains only digits and length if 12.


class Provider(SsnProvider):
    ssn_formats = ("############",)

## Instruction:
Make the Ukrainian SSN provider realer
## Code After:
from __future__ import unicode_literals

from datetime import date

from .. import Provider as SsnProvider
from faker.providers.date_time import Provider as DateTimeProvider


class Provider(SsnProvider):
    @classmethod
    def ssn(cls):
        """
        Ukrainian "Реєстраційний номер облікової картки платника податків"
        also known as "Ідентифікаційний номер фізичної особи".
        """
        digits = []

        # Number of days between 1899-12-31 and a birth date
        for digit in str((DateTimeProvider.date_object() -
                          date(1899, 12, 31)).days):
            digits.append(int(digit))

        # Person's sequence number
        for _ in range(4):
            digits.append(cls.random_int(0, 9))

        checksum = (digits[0]*-1 + digits[1]*5 + digits[2]*7 + digits[3]*9 +
                    digits[4]*4 + digits[5]*6 + digits[6]*10 + digits[7]*5 +
                    digits[8]*7)
        # Remainder of a checksum divided by 11 or 1 if it equals to 10
        digits.append(checksum % 11 % 10)

        return ''.join(str(digit) for digit in digits)
