summaryrefslogtreecommitdiff
path: root/venv/lib/python3.11/site-packages/faker/utils
diff options
context:
space:
mode:
Diffstat (limited to 'venv/lib/python3.11/site-packages/faker/utils')
-rw-r--r--venv/lib/python3.11/site-packages/faker/utils/__init__.py0
-rw-r--r--venv/lib/python3.11/site-packages/faker/utils/__pycache__/__init__.cpython-311.pycbin195 -> 0 bytes
-rw-r--r--venv/lib/python3.11/site-packages/faker/utils/__pycache__/checksums.cpython-311.pycbin1744 -> 0 bytes
-rw-r--r--venv/lib/python3.11/site-packages/faker/utils/__pycache__/datasets.cpython-311.pycbin817 -> 0 bytes
-rw-r--r--venv/lib/python3.11/site-packages/faker/utils/__pycache__/decorators.cpython-311.pycbin3037 -> 0 bytes
-rw-r--r--venv/lib/python3.11/site-packages/faker/utils/__pycache__/distribution.cpython-311.pycbin4330 -> 0 bytes
-rw-r--r--venv/lib/python3.11/site-packages/faker/utils/__pycache__/loading.cpython-311.pycbin3890 -> 0 bytes
-rw-r--r--venv/lib/python3.11/site-packages/faker/utils/__pycache__/text.cpython-311.pycbin2100 -> 0 bytes
-rw-r--r--venv/lib/python3.11/site-packages/faker/utils/checksums.py23
-rw-r--r--venv/lib/python3.11/site-packages/faker/utils/datasets.py8
-rw-r--r--venv/lib/python3.11/site-packages/faker/utils/decorators.py38
-rw-r--r--venv/lib/python3.11/site-packages/faker/utils/distribution.py88
-rw-r--r--venv/lib/python3.11/site-packages/faker/utils/loading.py60
-rw-r--r--venv/lib/python3.11/site-packages/faker/utils/text.py28
14 files changed, 0 insertions, 245 deletions
diff --git a/venv/lib/python3.11/site-packages/faker/utils/__init__.py b/venv/lib/python3.11/site-packages/faker/utils/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/venv/lib/python3.11/site-packages/faker/utils/__init__.py
+++ /dev/null
diff --git a/venv/lib/python3.11/site-packages/faker/utils/__pycache__/__init__.cpython-311.pyc b/venv/lib/python3.11/site-packages/faker/utils/__pycache__/__init__.cpython-311.pyc
deleted file mode 100644
index 7a480dd..0000000
--- a/venv/lib/python3.11/site-packages/faker/utils/__pycache__/__init__.cpython-311.pyc
+++ /dev/null
Binary files differ
diff --git a/venv/lib/python3.11/site-packages/faker/utils/__pycache__/checksums.cpython-311.pyc b/venv/lib/python3.11/site-packages/faker/utils/__pycache__/checksums.cpython-311.pyc
deleted file mode 100644
index b9030a6..0000000
--- a/venv/lib/python3.11/site-packages/faker/utils/__pycache__/checksums.cpython-311.pyc
+++ /dev/null
Binary files differ
diff --git a/venv/lib/python3.11/site-packages/faker/utils/__pycache__/datasets.cpython-311.pyc b/venv/lib/python3.11/site-packages/faker/utils/__pycache__/datasets.cpython-311.pyc
deleted file mode 100644
index 31fa472..0000000
--- a/venv/lib/python3.11/site-packages/faker/utils/__pycache__/datasets.cpython-311.pyc
+++ /dev/null
Binary files differ
diff --git a/venv/lib/python3.11/site-packages/faker/utils/__pycache__/decorators.cpython-311.pyc b/venv/lib/python3.11/site-packages/faker/utils/__pycache__/decorators.cpython-311.pyc
deleted file mode 100644
index 027d48b..0000000
--- a/venv/lib/python3.11/site-packages/faker/utils/__pycache__/decorators.cpython-311.pyc
+++ /dev/null
Binary files differ
diff --git a/venv/lib/python3.11/site-packages/faker/utils/__pycache__/distribution.cpython-311.pyc b/venv/lib/python3.11/site-packages/faker/utils/__pycache__/distribution.cpython-311.pyc
deleted file mode 100644
index bdcff72..0000000
--- a/venv/lib/python3.11/site-packages/faker/utils/__pycache__/distribution.cpython-311.pyc
+++ /dev/null
Binary files differ
diff --git a/venv/lib/python3.11/site-packages/faker/utils/__pycache__/loading.cpython-311.pyc b/venv/lib/python3.11/site-packages/faker/utils/__pycache__/loading.cpython-311.pyc
deleted file mode 100644
index 8590c9d..0000000
--- a/venv/lib/python3.11/site-packages/faker/utils/__pycache__/loading.cpython-311.pyc
+++ /dev/null
Binary files differ
diff --git a/venv/lib/python3.11/site-packages/faker/utils/__pycache__/text.cpython-311.pyc b/venv/lib/python3.11/site-packages/faker/utils/__pycache__/text.cpython-311.pyc
deleted file mode 100644
index 423330b..0000000
--- a/venv/lib/python3.11/site-packages/faker/utils/__pycache__/text.cpython-311.pyc
+++ /dev/null
Binary files differ
diff --git a/venv/lib/python3.11/site-packages/faker/utils/checksums.py b/venv/lib/python3.11/site-packages/faker/utils/checksums.py
deleted file mode 100644
index 9c06daf..0000000
--- a/venv/lib/python3.11/site-packages/faker/utils/checksums.py
+++ /dev/null
@@ -1,23 +0,0 @@
-from typing import List
-
-
-def luhn_checksum(number: float) -> int:
- def digits_of(n: float) -> List[int]:
- return [int(d) for d in str(n)]
-
- digits = digits_of(number)
- odd_digits = digits[-1::-2]
- even_digits = digits[-2::-2]
- checksum = 0
- checksum += sum(odd_digits)
- for d in even_digits:
- checksum += sum(digits_of(d * 2))
- return checksum % 10
-
-
-def calculate_luhn(partial_number: float) -> int:
- """
- Generates the Checksum using Luhn's algorithm
- """
- check_digit = luhn_checksum(int(partial_number) * 10)
- return check_digit if check_digit == 0 else 10 - check_digit
diff --git a/venv/lib/python3.11/site-packages/faker/utils/datasets.py b/venv/lib/python3.11/site-packages/faker/utils/datasets.py
deleted file mode 100644
index eef1a77..0000000
--- a/venv/lib/python3.11/site-packages/faker/utils/datasets.py
+++ /dev/null
@@ -1,8 +0,0 @@
-from itertools import chain
-
-from faker.typing import OrderedDictType
-
-
-def add_ordereddicts(*odicts: OrderedDictType) -> OrderedDictType:
- items = [odict.items() for odict in odicts]
- return OrderedDictType(chain(*items))
diff --git a/venv/lib/python3.11/site-packages/faker/utils/decorators.py b/venv/lib/python3.11/site-packages/faker/utils/decorators.py
deleted file mode 100644
index 43c8b1b..0000000
--- a/venv/lib/python3.11/site-packages/faker/utils/decorators.py
+++ /dev/null
@@ -1,38 +0,0 @@
-from functools import wraps
-from typing import Callable, Dict, Tuple, TypeVar
-
-from ..utils import text
-
-T = TypeVar("T")
-
-
-def slugify(fn: Callable) -> Callable:
- @wraps(fn)
- def wrapper(*args: Tuple[T, ...], **kwargs: Dict[str, T]) -> str:
- return text.slugify(fn(*args, **kwargs))
-
- return wrapper
-
-
-def slugify_domain(fn: Callable) -> Callable:
- @wraps(fn)
- def wrapper(*args: Tuple[T, ...], **kwargs: Dict[str, T]) -> str:
- return text.slugify(fn(*args, **kwargs), allow_dots=True)
-
- return wrapper
-
-
-def slugify_unicode(fn: Callable) -> Callable:
- @wraps(fn)
- def wrapper(*args: Tuple[T, ...], **kwargs: Dict[str, T]) -> str:
- return text.slugify(fn(*args, **kwargs), allow_unicode=True)
-
- return wrapper
-
-
-def lowercase(fn: Callable) -> Callable:
- @wraps(fn)
- def wrapper(*args: Tuple[T, ...], **kwargs: Dict[str, T]) -> str:
- return fn(*args, **kwargs).lower()
-
- return wrapper
diff --git a/venv/lib/python3.11/site-packages/faker/utils/distribution.py b/venv/lib/python3.11/site-packages/faker/utils/distribution.py
deleted file mode 100644
index 45580a5..0000000
--- a/venv/lib/python3.11/site-packages/faker/utils/distribution.py
+++ /dev/null
@@ -1,88 +0,0 @@
-import bisect
-import itertools
-
-from random import Random
-from typing import Generator, Iterable, Optional, Sequence, TypeVar
-
-from faker.generator import random as mod_random
-
-
-def random_sample(random: Optional[Random] = None) -> float:
- if random is None:
- random = mod_random
- return random.uniform(0.0, 1.0)
-
-
-def cumsum(it: Iterable[float]) -> Generator[float, None, None]:
- total: float = 0
- for x in it:
- total += x
- yield total
-
-
-T = TypeVar("T")
-
-
-def choices_distribution_unique(
- a: Sequence[T],
- p: Optional[Sequence[float]],
- random: Optional[Random] = None,
- length: int = 1,
-) -> Sequence[T]:
- # As of Python 3.7, there isn't a way to sample unique elements that takes
- # weight into account.
- if random is None:
- random = mod_random
-
- assert p is not None
- assert len(a) == len(p)
- assert len(a) >= length, "You can't request more unique samples than elements in the dataset."
-
- choices = []
- items = list(a)
- probabilities = list(p)
- for i in range(length):
- cdf = tuple(cumsum(probabilities))
- normal = cdf[-1]
- cdf2 = [i / normal for i in cdf]
- uniform_sample = random_sample(random=random)
- idx = bisect.bisect_right(cdf2, uniform_sample)
- item = items[idx]
- choices.append(item)
- probabilities.pop(idx)
- items.pop(idx)
- return choices
-
-
-def choices_distribution(
- a: Sequence[T],
- p: Optional[Sequence[float]],
- random: Optional[Random] = None,
- length: int = 1,
-) -> Sequence[T]:
- if random is None:
- random = mod_random
-
- if p is not None:
- assert len(a) == len(p)
-
- if hasattr(random, "choices"):
- if length == 1 and p is None:
- return [random.choice(a)]
- else:
- return random.choices(a, weights=p, k=length)
- else:
- choices = []
-
- if p is None:
- p = itertools.repeat(1, len(a)) # type: ignore
-
- cdf = list(cumsum(p)) # type: ignore
- normal = cdf[-1]
- cdf2 = [i / normal for i in cdf]
- for i in range(length):
- uniform_sample = random_sample(random=random)
- idx = bisect.bisect_right(cdf2, uniform_sample)
- item = a[idx]
- choices.append(item)
- return choices
diff --git a/venv/lib/python3.11/site-packages/faker/utils/loading.py b/venv/lib/python3.11/site-packages/faker/utils/loading.py
deleted file mode 100644
index 0ea54ee..0000000
--- a/venv/lib/python3.11/site-packages/faker/utils/loading.py
+++ /dev/null
@@ -1,60 +0,0 @@
-import pkgutil
-import sys
-
-from importlib import import_module
-from pathlib import Path
-from types import ModuleType
-from typing import List
-
-
-def get_path(module: ModuleType) -> str:
- if getattr(sys, "frozen", False):
- # frozen
-
- if getattr(sys, "_MEIPASS", False):
- # PyInstaller
- lib_dir = Path(getattr(sys, "_MEIPASS"))
- else:
- # others
- lib_dir = Path(sys.executable).parent / "lib"
-
- path = lib_dir.joinpath(*module.__package__.split(".")) # type: ignore
- else:
- # unfrozen
- if module.__file__ is not None:
- path = Path(module.__file__).parent
- else:
- raise RuntimeError(f"Can't find path from module `{module}.")
- return str(path)
-
-
-def list_module(module: ModuleType) -> List[str]:
- path = get_path(module)
-
- if getattr(sys, "_MEIPASS", False):
- # PyInstaller
- return [file.parent.name for file in Path(path).glob("*/__init__.py")]
- else:
- return [name for _, name, is_pkg in pkgutil.iter_modules([str(path)]) if is_pkg]
-
-
-def find_available_locales(providers: List[str]) -> List[str]:
- available_locales = set()
-
- for provider_path in providers:
- provider_module = import_module(provider_path)
- if getattr(provider_module, "localized", False):
- langs = list_module(provider_module)
- available_locales.update(langs)
- return sorted(available_locales)
-
-
-def find_available_providers(modules: List[ModuleType]) -> List[str]:
- available_providers = set()
- for providers_mod in modules:
- if providers_mod.__package__:
- providers = [
- ".".join([providers_mod.__package__, mod]) for mod in list_module(providers_mod) if mod != "__pycache__"
- ]
- available_providers.update(providers)
- return sorted(available_providers)
diff --git a/venv/lib/python3.11/site-packages/faker/utils/text.py b/venv/lib/python3.11/site-packages/faker/utils/text.py
deleted file mode 100644
index 5083918..0000000
--- a/venv/lib/python3.11/site-packages/faker/utils/text.py
+++ /dev/null
@@ -1,28 +0,0 @@
-import re
-import unicodedata
-
-from typing import Pattern
-
-_re_pattern: Pattern = re.compile(r"[^\w\s-]", flags=re.U)
-_re_pattern_allow_dots: Pattern = re.compile(r"[^\.\w\s-]", flags=re.U)
-_re_spaces: Pattern = re.compile(r"[-\s]+", flags=re.U)
-
-
-def slugify(value: str, allow_dots: bool = False, allow_unicode: bool = False) -> str:
- """
- Converts to lowercase, removes non-word characters (alphanumerics and
- underscores) and converts spaces to hyphens. Also strips leading and
- trailing whitespace. Modified to optionally allow dots.
-
- Adapted from Django 1.9
- """
- pattern: Pattern = _re_pattern_allow_dots if allow_dots else _re_pattern
-
- value = str(value)
- if allow_unicode:
- value = unicodedata.normalize("NFKC", value)
- value = pattern.sub("", value).strip().lower()
- return _re_spaces.sub("-", value)
- value = unicodedata.normalize("NFKD", value).encode("ascii", "ignore").decode("ascii")
- value = pattern.sub("", value).strip().lower()
- return _re_spaces.sub("-", value)