summaryrefslogtreecommitdiff
path: root/venv/lib/python3.11/site-packages/faker/providers/profile
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/profile
parent4f884c9abc32990b4061a1bb6997b4b37e58ea0b (diff)
venv
Diffstat (limited to 'venv/lib/python3.11/site-packages/faker/providers/profile')
-rw-r--r--venv/lib/python3.11/site-packages/faker/providers/profile/__init__.py60
-rw-r--r--venv/lib/python3.11/site-packages/faker/providers/profile/__pycache__/__init__.cpython-311.pycbin0 -> 4301 bytes
-rw-r--r--venv/lib/python3.11/site-packages/faker/providers/profile/en_US/__init__.py5
-rw-r--r--venv/lib/python3.11/site-packages/faker/providers/profile/en_US/__pycache__/__init__.cpython-311.pycbin0 -> 496 bytes
4 files changed, 65 insertions, 0 deletions
diff --git a/venv/lib/python3.11/site-packages/faker/providers/profile/__init__.py b/venv/lib/python3.11/site-packages/faker/providers/profile/__init__.py
new file mode 100644
index 0000000..6f909e0
--- /dev/null
+++ b/venv/lib/python3.11/site-packages/faker/providers/profile/__init__.py
@@ -0,0 +1,60 @@
+import itertools
+
+from datetime import date
+from decimal import Decimal
+from typing import Dict, List, Optional, Tuple, Union
+
+from ...typing import SexLiteral
+from .. import BaseProvider
+
+
+class Provider(BaseProvider):
+ """
+ This provider is a collection of functions to generate personal profiles and identities.
+
+ """
+
+ def simple_profile(self, sex: Optional[SexLiteral] = None) -> Dict[str, Union[str, date, SexLiteral]]:
+ """
+ Generates a basic profile with personal informations
+ """
+ sex_ = self.random_element(["F", "M"]) if sex is None else sex
+ if sex_ == "F":
+ name = self.generator.name_female()
+ elif sex_ == "M":
+ name = self.generator.name_male()
+ return {
+ "username": self.generator.user_name(),
+ "name": name,
+ "sex": sex_,
+ "address": self.generator.address(),
+ "mail": self.generator.free_email(),
+ "birthdate": self.generator.date_of_birth(),
+ }
+
+ def profile(
+ self, fields: Optional[List[str]] = None, sex: Optional[SexLiteral] = None
+ ) -> Dict[str, Union[str, Tuple[Decimal, Decimal], List[str], date]]:
+ """
+ Generates a complete profile.
+ If "fields" is not empty, only the fields in the list will be returned
+ """
+ if fields is None:
+ fields = []
+
+ d = {
+ "job": self.generator.job(),
+ "company": self.generator.company(),
+ "ssn": self.generator.ssn(),
+ "residence": self.generator.address(),
+ "current_location": (self.generator.latitude(), self.generator.longitude()),
+ "blood_group": "".join(self.random_element(list(itertools.product(["A", "B", "AB", "O"], ["+", "-"])))),
+ "website": [self.generator.url() for _ in range(1, self.random_int(2, 5))],
+ }
+
+ d = dict(d, **self.generator.simple_profile(sex))
+ # field selection
+ if len(fields) > 0:
+ d = {k: v for k, v in d.items() if k in fields}
+
+ return d
diff --git a/venv/lib/python3.11/site-packages/faker/providers/profile/__pycache__/__init__.cpython-311.pyc b/venv/lib/python3.11/site-packages/faker/providers/profile/__pycache__/__init__.cpython-311.pyc
new file mode 100644
index 0000000..057dbfc
--- /dev/null
+++ b/venv/lib/python3.11/site-packages/faker/providers/profile/__pycache__/__init__.cpython-311.pyc
Binary files differ
diff --git a/venv/lib/python3.11/site-packages/faker/providers/profile/en_US/__init__.py b/venv/lib/python3.11/site-packages/faker/providers/profile/en_US/__init__.py
new file mode 100644
index 0000000..e7f101f
--- /dev/null
+++ b/venv/lib/python3.11/site-packages/faker/providers/profile/en_US/__init__.py
@@ -0,0 +1,5 @@
+from .. import Provider as ProfileProvider # pragma: no cover
+
+
+class Provider(ProfileProvider): # pragma: no cover
+ pass
diff --git a/venv/lib/python3.11/site-packages/faker/providers/profile/en_US/__pycache__/__init__.cpython-311.pyc b/venv/lib/python3.11/site-packages/faker/providers/profile/en_US/__pycache__/__init__.cpython-311.pyc
new file mode 100644
index 0000000..8130e40
--- /dev/null
+++ b/venv/lib/python3.11/site-packages/faker/providers/profile/en_US/__pycache__/__init__.cpython-311.pyc
Binary files differ