Coverage for fingerprint_server_sdk / models / identification_confidence.py: 75%
32 statements
« prev ^ index » next coverage.py v7.13.4, created at 2026-03-11 18:41 +0000
« prev ^ index » next coverage.py v7.13.4, created at 2026-03-11 18:41 +0000
1"""
2Server API
3Fingerprint Server API allows you to get, search, and update Events in a server environment. It can be used for data exports, decision-making, and data analysis scenarios.
4Server API is intended for server-side usage, it's not intended to be used from the client side, whether it's a browser or a mobile device.
6The version of the OpenAPI document: 4
7Contact: support@fingerprint.com
8Generated by OpenAPI Generator (https://openapi-generator.tech)
10Do not edit the class manually.
11""" # noqa: E501
13from __future__ import annotations
15import json
16import pprint
17import re # noqa: F401
18from typing import Annotated, Any, ClassVar, Optional, Union
20from pydantic import BaseModel, ConfigDict, Field, StrictStr
21from typing_extensions import Self
24class IdentificationConfidence(BaseModel):
25 """
26 IdentificationConfidence
27 """
29 score: Union[
30 Annotated[float, Field(le=1, strict=True, ge=0)],
31 Annotated[int, Field(le=1, strict=True, ge=0)],
32 ] = Field(
33 description='The confidence score is a floating-point number between 0 and 1 that represents the probability of accurate identification.'
34 )
35 version: Optional[StrictStr] = Field(
36 default=None,
37 description='The version name of the method used to calculate the Confidence score. This field is only present for customers who opted in to an alternative calculation method.',
38 )
39 comment: Optional[StrictStr] = None
40 __properties: ClassVar[list[str]] = ['score', 'version', 'comment']
42 model_config = ConfigDict(
43 populate_by_name=True,
44 validate_assignment=True,
45 protected_namespaces=(),
46 )
48 def to_str(self) -> str:
49 """Returns the string representation of the model using alias"""
50 return pprint.pformat(self.model_dump(by_alias=True))
52 def to_json(self) -> str:
53 """Returns the JSON representation of the model using alias"""
54 # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
55 return json.dumps(self.to_dict())
57 @classmethod
58 def from_json(cls, json_str: str) -> Optional[Self]:
59 """Create an instance of IdentificationConfidence from a JSON string"""
60 return cls.from_dict(json.loads(json_str))
62 def to_dict(self) -> dict[str, Any]:
63 """Return the dictionary representation of the model using alias.
65 This has the following differences from calling pydantic's
66 `self.model_dump(by_alias=True)`:
68 * `None` is only added to the output dict for nullable fields that
69 were set at model initialization. Other fields with value `None`
70 are ignored.
71 """
72 excluded_fields: set[str] = set([])
74 _dict = self.model_dump(
75 by_alias=True,
76 exclude=excluded_fields,
77 exclude_none=True,
78 )
79 return _dict
81 @classmethod
82 def from_dict(cls, obj: Optional[dict[str, Any]]) -> Optional[Self]:
83 """Create an instance of IdentificationConfidence from a dict"""
84 if obj is None:
85 return None
87 if not isinstance(obj, dict):
88 return cls.model_validate(obj)
90 _obj = cls.model_validate(
91 {
92 'score': obj.get('score'),
93 'version': obj.get('version'),
94 'comment': obj.get('comment'),
95 }
96 )
97 return _obj