Coverage for fingerprint_server_sdk / models / emoji.py: 79%
38 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 Any, ClassVar, Optional, Union
20from pydantic import BaseModel, ConfigDict, Field, StrictFloat, StrictInt, StrictStr
21from typing_extensions import Self
24class Emoji(BaseModel):
25 """
26 Bounding box metrics describing how the emoji glyph renders.
27 """
29 font: Optional[StrictStr] = Field(
30 default=None, description='Font family reported by the browser when drawing the emoji.'
31 )
32 width: Optional[Union[StrictFloat, StrictInt]] = None
33 height: Optional[Union[StrictFloat, StrictInt]] = None
34 top: Optional[Union[StrictFloat, StrictInt]] = None
35 bottom: Optional[Union[StrictFloat, StrictInt]] = None
36 left: Optional[Union[StrictFloat, StrictInt]] = None
37 right: Optional[Union[StrictFloat, StrictInt]] = None
38 x: Optional[Union[StrictFloat, StrictInt]] = None
39 y: Optional[Union[StrictFloat, StrictInt]] = None
40 __properties: ClassVar[list[str]] = [
41 'font',
42 'width',
43 'height',
44 'top',
45 'bottom',
46 'left',
47 'right',
48 'x',
49 'y',
50 ]
52 model_config = ConfigDict(
53 populate_by_name=True,
54 validate_assignment=True,
55 protected_namespaces=(),
56 )
58 def to_str(self) -> str:
59 """Returns the string representation of the model using alias"""
60 return pprint.pformat(self.model_dump(by_alias=True))
62 def to_json(self) -> str:
63 """Returns the JSON representation of the model using alias"""
64 # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
65 return json.dumps(self.to_dict())
67 @classmethod
68 def from_json(cls, json_str: str) -> Optional[Self]:
69 """Create an instance of Emoji from a JSON string"""
70 return cls.from_dict(json.loads(json_str))
72 def to_dict(self) -> dict[str, Any]:
73 """Return the dictionary representation of the model using alias.
75 This has the following differences from calling pydantic's
76 `self.model_dump(by_alias=True)`:
78 * `None` is only added to the output dict for nullable fields that
79 were set at model initialization. Other fields with value `None`
80 are ignored.
81 """
82 excluded_fields: set[str] = set([])
84 _dict = self.model_dump(
85 by_alias=True,
86 exclude=excluded_fields,
87 exclude_none=True,
88 )
89 return _dict
91 @classmethod
92 def from_dict(cls, obj: Optional[dict[str, Any]]) -> Optional[Self]:
93 """Create an instance of Emoji from a dict"""
94 if obj is None:
95 return None
97 if not isinstance(obj, dict):
98 return cls.model_validate(obj)
100 _obj = cls.model_validate(
101 {
102 'font': obj.get('font'),
103 'width': obj.get('width'),
104 'height': obj.get('height'),
105 'top': obj.get('top'),
106 'bottom': obj.get('bottom'),
107 'left': obj.get('left'),
108 'right': obj.get('right'),
109 'x': obj.get('x'),
110 'y': obj.get('y'),
111 }
112 )
113 return _obj