summaryrefslogtreecommitdiff
path: root/venv/lib/python3.11/site-packages/faker/providers/ssn/nl_NL
diff options
context:
space:
mode:
authorcyfraeviolae <cyfraeviolae>2024-04-03 03:10:44 -0400
committercyfraeviolae <cyfraeviolae>2024-04-03 03:10:44 -0400
commit6d7ba58f880be618ade07f8ea080fe8c4bf8a896 (patch)
treeb1c931051ffcebd2bd9d61d98d6233ffa289bbce /venv/lib/python3.11/site-packages/faker/providers/ssn/nl_NL
parent4f884c9abc32990b4061a1bb6997b4b37e58ea0b (diff)
venv
Diffstat (limited to 'venv/lib/python3.11/site-packages/faker/providers/ssn/nl_NL')
-rw-r--r--venv/lib/python3.11/site-packages/faker/providers/ssn/nl_NL/__init__.py45
-rw-r--r--venv/lib/python3.11/site-packages/faker/providers/ssn/nl_NL/__pycache__/__init__.cpython-311.pycbin0 -> 2539 bytes
2 files changed, 45 insertions, 0 deletions
diff --git a/venv/lib/python3.11/site-packages/faker/providers/ssn/nl_NL/__init__.py b/venv/lib/python3.11/site-packages/faker/providers/ssn/nl_NL/__init__.py
new file mode 100644
index 0000000..0c64ca2
--- /dev/null
+++ b/venv/lib/python3.11/site-packages/faker/providers/ssn/nl_NL/__init__.py
@@ -0,0 +1,45 @@
+from .. import Provider as SsnProvider
+
+
+class Provider(SsnProvider):
+ def ssn(self) -> str:
+ """
+ Returns a 9 digits Dutch SSN called "burgerservicenummer (BSN)".
+
+ the Dutch "burgerservicenummer (BSN)" needs to pass the "11-proef",
+ which is a check digit approach; this function essentially reverses
+ the checksum steps to create a random valid BSN (which is 9 digits).
+ """
+
+ # see http://nl.wikipedia.org/wiki/Burgerservicenummer (in Dutch)
+ def _checksum(digits):
+ factors = (9, 8, 7, 6, 5, 4, 3, 2, -1)
+ s = 0
+ for i in range(len(digits)):
+ s += digits[i] * factors[i]
+ return s
+
+ while True:
+ # create an array of first 8 elements initialized randomly
+ digits = self.generator.random.sample(range(10), 8)
+ # sum those 8 digits according to (part of) the "11-proef"
+ s = _checksum(digits)
+ # determine the last digit to make it qualify the test
+ digits.append((s % 11) % 10)
+ # repeat steps until it does qualify the test
+ if 0 == (_checksum(digits) % 11):
+ break
+
+ # build the resulting BSN
+ bsn = "".join([str(e) for e in digits])
+ # finally return our random but valid BSN
+ return bsn
+
+ vat_id_formats = ("NL#########B##",)
+
+ def vat_id(self) -> str:
+ """
+ http://ec.europa.eu/taxation_customs/vies/faq.html#item_11
+ :return: A random Dutch VAT ID
+ """
+ return self.bothify(self.random_element(self.vat_id_formats))
diff --git a/venv/lib/python3.11/site-packages/faker/providers/ssn/nl_NL/__pycache__/__init__.cpython-311.pyc b/venv/lib/python3.11/site-packages/faker/providers/ssn/nl_NL/__pycache__/__init__.cpython-311.pyc
new file mode 100644
index 0000000..9557af5
--- /dev/null
+++ b/venv/lib/python3.11/site-packages/faker/providers/ssn/nl_NL/__pycache__/__init__.cpython-311.pyc
Binary files differ