summaryrefslogtreecommitdiff
path: root/venv/lib/python3.11/site-packages/faker/providers/ssn/th_TH
diff options
context:
space:
mode:
authorcyfraeviolae <cyfraeviolae>2024-04-03 03:17:55 -0400
committercyfraeviolae <cyfraeviolae>2024-04-03 03:17:55 -0400
commit12cf076118570eebbff08c6b3090e0d4798447a1 (patch)
tree3ba25e17e3c3a5e82316558ba3864b955919ff72 /venv/lib/python3.11/site-packages/faker/providers/ssn/th_TH
parentc45662ff3923b34614ddcc8feb9195541166dcc5 (diff)
no venv
Diffstat (limited to 'venv/lib/python3.11/site-packages/faker/providers/ssn/th_TH')
-rw-r--r--venv/lib/python3.11/site-packages/faker/providers/ssn/th_TH/__init__.py59
-rw-r--r--venv/lib/python3.11/site-packages/faker/providers/ssn/th_TH/__pycache__/__init__.cpython-311.pycbin2725 -> 0 bytes
2 files changed, 0 insertions, 59 deletions
diff --git a/venv/lib/python3.11/site-packages/faker/providers/ssn/th_TH/__init__.py b/venv/lib/python3.11/site-packages/faker/providers/ssn/th_TH/__init__.py
deleted file mode 100644
index 47255f0..0000000
--- a/venv/lib/python3.11/site-packages/faker/providers/ssn/th_TH/__init__.py
+++ /dev/null
@@ -1,59 +0,0 @@
-from random import randint
-
-from .. import Provider as BaseProvider
-
-
-class Provider(BaseProvider):
- # Source:
- # https://en.wikipedia.org/wiki/Thai_identity_card#Identification_number
- # Thai national identity number has 13 digits, in this format:
- # 1-2345-67890-12-3
- # Digit 1: Person category
- # Digits 2-5: Province and amphoe code of registrar's office (ISO 3166-2)
- # Digits 6-12: Birth certificate number
- # Digit 13: Checksum
-
- def ssn(self) -> str:
- """
- Thai national ID
- """
- category = randint(1, 8)
- province = randint(10, 96)
- amphoe = 0
- if province == 10: # Bangkok
- amphoe = randint(1, 50) # Bangkok has district number up to 50
- else:
- amphoe = randint(1, 20) # Provinces outside Bangkok has 20 or less
- birth_book = randint(1, 99999)
- birth_sheet = randint(1, 99)
-
- digits = f"{category:01d}{province:02d}{amphoe:02d}{birth_book:05d}{birth_sheet:02d}"
- checksum = (
- (int(digits[0]) * 13)
- + (int(digits[1]) * 12)
- + (int(digits[2]) * 11)
- + (int(digits[3]) * 10)
- + (int(digits[4]) * 9)
- + (int(digits[5]) * 8)
- + (int(digits[6]) * 7)
- + (int(digits[7]) * 6)
- + (int(digits[8]) * 5)
- + (int(digits[9]) * 4)
- + (int(digits[10]) * 3)
- + (int(digits[11]) * 2)
- )
- checksum = checksum % 11
- checksum = 11 - checksum
- if checksum > 9:
- checksum = checksum - 10
-
- nat_id = f"{category:01d}-{province:02d}{amphoe:02d}-{birth_book:05d}-{birth_sheet:02d}-{checksum:01d}"
-
- return nat_id
-
- def vat_id(self) -> str:
- """
- Personal VAT ID is the same as national ID
- (Corporate VAT ID is different)
- """
- return self.ssn()
diff --git a/venv/lib/python3.11/site-packages/faker/providers/ssn/th_TH/__pycache__/__init__.cpython-311.pyc b/venv/lib/python3.11/site-packages/faker/providers/ssn/th_TH/__pycache__/__init__.cpython-311.pyc
deleted file mode 100644
index ab2b0dc..0000000
--- a/venv/lib/python3.11/site-packages/faker/providers/ssn/th_TH/__pycache__/__init__.cpython-311.pyc
+++ /dev/null
Binary files differ