File: constants.py

package info (click to toggle)
python-polyfactory 3.0.0-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 1,976 kB
  • sloc: python: 11,113; makefile: 102; sh: 34
file content (39 lines) | stat: -rw-r--r-- 809 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
from __future__ import annotations

from collections import abc, defaultdict, deque
from collections.abc import Iterable, Mapping, Sequence
from random import Random
from typing import (
    Union,
)

try:
    from types import UnionType
except ImportError:
    UnionType = Union  # type: ignore[misc,assignment]


# Mapping of type annotations into concrete types.
TYPE_MAPPING = {
    defaultdict: defaultdict,
    deque: deque,
    dict: dict,
    frozenset: frozenset,
    Iterable: list,
    list: list,
    Mapping: dict,
    Sequence: list,
    set: set,
    tuple: tuple,
    abc.Iterable: list,
    abc.Mapping: dict,
    abc.Sequence: list,
    abc.Set: set,
    UnionType: Union,
}


DEFAULT_RANDOM = Random()
RANDOMIZE_COLLECTION_LENGTH = False
MIN_COLLECTION_LENGTH = 0
MAX_COLLECTION_LENGTH = 5