summaryrefslogtreecommitdiff
path: root/venv/lib/python3.11/site-packages/faker/providers/automotive/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/automotive/nl_NL
parent4f884c9abc32990b4061a1bb6997b4b37e58ea0b (diff)
venv
Diffstat (limited to 'venv/lib/python3.11/site-packages/faker/providers/automotive/nl_NL')
-rw-r--r--venv/lib/python3.11/site-packages/faker/providers/automotive/nl_NL/__init__.py77
-rw-r--r--venv/lib/python3.11/site-packages/faker/providers/automotive/nl_NL/__pycache__/__init__.cpython-311.pycbin0 -> 3062 bytes
2 files changed, 77 insertions, 0 deletions
diff --git a/venv/lib/python3.11/site-packages/faker/providers/automotive/nl_NL/__init__.py b/venv/lib/python3.11/site-packages/faker/providers/automotive/nl_NL/__init__.py
new file mode 100644
index 0000000..0dbab37
--- /dev/null
+++ b/venv/lib/python3.11/site-packages/faker/providers/automotive/nl_NL/__init__.py
@@ -0,0 +1,77 @@
+import re
+import string
+
+from .. import Provider as AutomotiveProvider
+
+
+class Provider(AutomotiveProvider):
+ """Implement automotive provider for `nl_NL` locale.
+
+ Sources:
+ - https://en.wikipedia.org/wiki/Vehicle_registration_plates_of_the_Netherlands
+ - https://www.cbs.nl/en-gb/figures/detail/82044eng
+
+ .. |license_plate_car| replace::
+ :meth:`license_plate_car() <faker.providers.automotive.nl_NL.Provider.license_plate_car>`
+
+ .. |license_plate_motorbike| replace::
+ :meth:`license_plate_motorbike() <faker.providers.automotive.nl_NL.Provider.license_plate_motorbike>`
+ """
+
+ # License formats for cars / other vehicles than motorbikes
+ license_formats = (
+ # Format 6
+ "##-%?-??",
+ # Format 7
+ "##-%??-#",
+ # Format 8
+ "#-@??-##",
+ # Format 9
+ "%?-###-?",
+ # Format 10
+ "%-###-??",
+ )
+
+ # License formats for motorbikes.
+ # According to CBS, approximately 10% of road vehicles in the Netherlands are motorbikes
+ license_formats_motorbike = (
+ "M?-??-##",
+ "##-M?-??",
+ )
+
+ # Base first letters of format
+ license_plate_prefix_letters = "BDFGHJKLNPRSTVXZ"
+
+ # For Format 8 (9-XXX-99) "BDFGHJLNPR" are not used,
+ # as to not clash with former export license plates
+ license_plate_prefix_letters_format_8 = "KSTVXZ"
+
+ def license_plate_motorbike(self) -> str:
+ """Generate a license plate for motorbikes."""
+ return self.bothify(
+ self.random_element(self.license_formats_motorbike),
+ letters=string.ascii_uppercase,
+ )
+
+ def license_plate_car(self) -> str:
+ """Generate a license plate for cars."""
+ # Replace % with license_plate_prefix_letters
+ temp = re.sub(
+ r"\%",
+ self.random_element(self.license_plate_prefix_letters),
+ self.random_element(self.license_formats),
+ )
+
+ # Replace @ with license_plate_prefix_letters_format_8
+ temp = re.sub(r"\@", self.random_element(self.license_plate_prefix_letters_format_8), temp)
+
+ return self.bothify(temp, letters=string.ascii_uppercase)
+
+ def license_plate(self) -> str:
+ """Generate a license plate.
+ This method randomly chooses 10% between |license_plate_motorbike|
+ or 90% |license_plate_car| to generate the result.
+ """
+ if self.generator.random.random() < 0.1:
+ return self.license_plate_motorbike()
+ return self.license_plate_car()
diff --git a/venv/lib/python3.11/site-packages/faker/providers/automotive/nl_NL/__pycache__/__init__.cpython-311.pyc b/venv/lib/python3.11/site-packages/faker/providers/automotive/nl_NL/__pycache__/__init__.cpython-311.pyc
new file mode 100644
index 0000000..12b3fa8
--- /dev/null
+++ b/venv/lib/python3.11/site-packages/faker/providers/automotive/nl_NL/__pycache__/__init__.cpython-311.pyc
Binary files differ