Coverage for fingerprint_server_sdk / models / font_preferences.py: 78%
36 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, StrictFloat, StrictInt
21from typing_extensions import Self
24class FontPreferences(BaseModel):
25 """
26 Baseline measurement of canonical fonts rendered on the device. Numeric width metrics, in CSS pixels, for the canonical fonts collected by the agent.
27 """
29 default: Optional[Union[StrictFloat, StrictInt]] = None
30 serif: Optional[Union[StrictFloat, StrictInt]] = None
31 sans: Optional[Union[StrictFloat, StrictInt]] = None
32 mono: Optional[Union[StrictFloat, StrictInt]] = None
33 apple: Optional[Union[StrictFloat, StrictInt]] = None
34 min: Optional[Union[StrictFloat, StrictInt]] = None
35 system: Optional[Union[StrictFloat, StrictInt]] = None
36 __properties: ClassVar[list[str]] = [
37 'default',
38 'serif',
39 'sans',
40 'mono',
41 'apple',
42 'min',
43 'system',
44 ]
46 model_config = ConfigDict(
47 populate_by_name=True,
48 validate_assignment=True,
49 protected_namespaces=(),
50 )
52 def to_str(self) -> str:
53 """Returns the string representation of the model using alias"""
54 return pprint.pformat(self.model_dump(by_alias=True))
56 def to_json(self) -> str:
57 """Returns the JSON representation of the model using alias"""
58 # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
59 return json.dumps(self.to_dict())
61 @classmethod
62 def from_json(cls, json_str: str) -> Optional[Self]:
63 """Create an instance of FontPreferences from a JSON string"""
64 return cls.from_dict(json.loads(json_str))
66 def to_dict(self) -> dict[str, Any]:
67 """Return the dictionary representation of the model using alias.
69 This has the following differences from calling pydantic's
70 `self.model_dump(by_alias=True)`:
72 * `None` is only added to the output dict for nullable fields that
73 were set at model initialization. Other fields with value `None`
74 are ignored.
75 """
76 excluded_fields: set[str] = set([])
78 _dict = self.model_dump(
79 by_alias=True,
80 exclude=excluded_fields,
81 exclude_none=True,
82 )
83 return _dict
85 @classmethod
86 def from_dict(cls, obj: Optional[dict[str, Any]]) -> Optional[Self]:
87 """Create an instance of FontPreferences from a dict"""
88 if obj is None:
89 return None
91 if not isinstance(obj, dict):
92 return cls.model_validate(obj)
94 _obj = cls.model_validate(
95 {
96 'default': obj.get('default'),
97 'serif': obj.get('serif'),
98 'sans': obj.get('sans'),
99 'mono': obj.get('mono'),
100 'apple': obj.get('apple'),
101 'min': obj.get('min'),
102 'system': obj.get('system'),
103 }
104 )
105 return _obj