From 6d7ba58f880be618ade07f8ea080fe8c4bf8a896 Mon Sep 17 00:00:00 2001 From: cyfraeviolae Date: Wed, 3 Apr 2024 03:10:44 -0400 Subject: venv --- .../faker/providers/profile/__init__.py | 60 +++++++++++++++++++++ .../profile/__pycache__/__init__.cpython-311.pyc | Bin 0 -> 4301 bytes .../faker/providers/profile/en_US/__init__.py | 5 ++ .../en_US/__pycache__/__init__.cpython-311.pyc | Bin 0 -> 496 bytes 4 files changed, 65 insertions(+) create mode 100644 venv/lib/python3.11/site-packages/faker/providers/profile/__init__.py create mode 100644 venv/lib/python3.11/site-packages/faker/providers/profile/__pycache__/__init__.cpython-311.pyc create mode 100644 venv/lib/python3.11/site-packages/faker/providers/profile/en_US/__init__.py create mode 100644 venv/lib/python3.11/site-packages/faker/providers/profile/en_US/__pycache__/__init__.cpython-311.pyc (limited to 'venv/lib/python3.11/site-packages/faker/providers/profile') 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 Binary files /dev/null and b/venv/lib/python3.11/site-packages/faker/providers/profile/__pycache__/__init__.cpython-311.pyc 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 Binary files /dev/null and b/venv/lib/python3.11/site-packages/faker/providers/profile/en_US/__pycache__/__init__.cpython-311.pyc differ -- cgit v1.2.3