Coverage for packages/core/src/integrify/utils.py: 90%
28 statements
« prev ^ index » next coverage.py v7.16.0, created at 2026-10-19 02:39 +0000
« prev ^ index » next coverage.py v7.16.0, created at 2026-10-19 02:39 +0000
1from enum import Enum
2from typing import Annotated, Literal, TypeVar
4from pydantic import BaseModel, Field
6_ResponseT = TypeVar('_ResponseT', bound=BaseModel | dict | list)
7"""Dynamic response type.
9Bəzi API-lər (məs., E-Customs) kök səviyyəsində JSON array qaytarır, ona görə
10`list` də bound-a daxildir (`APIResponse[list[SomeSchema]]`).
11"""
13T = TypeVar('T')
16class UnsetType:
17 """Sentinel type to indicate an unset field value."""
19 _instance = None
21 def __new__(cls):
22 if cls._instance is None: 22 ↛ 24line 22 didn't jump to line 24 because the condition on line 22 was always true
23 cls._instance = super().__new__(cls)
24 return cls._instance
26 def __repr__(self):
27 return '<UNSET>'
29 def __str__(self):
30 return 'UNSET'
32 def __bool__(self):
33 return False
36UNSET = UnsetType()
38Unset = T | Literal[UNSET]
39""" Optional argument tipi """
41UnsetOrNone = T | Literal[UNSET] | None
42"""None dəyəri ala bilən optional argument tipi"""
44UnsetField = Annotated[Unset[T], Field(default=UNSET, exclude_if=lambda x: x is UNSET)]
45"""Pydantic üçün set olunmamış argument dəyəri"""
47UnsetOrNoneField = Annotated[UnsetOrNone[T], Field(default=UNSET, exclude_if=lambda x: x is UNSET)]
48"""Pydantic üçün set olunmamış və None dəyəri ala bilən argument dəyəri"""
51class Environment(str, Enum):
52 TEST = 'test'
53 PROD = 'prod'