Coverage for fingerprint_server_sdk/models/font_preferences.py: 78%
36 statements
« prev ^ index » next coverage.py v7.14.3, created at 2026-07-14 10:45 +0000
« prev ^ index » next coverage.py v7.14.3, created at 2026-07-14 10:45 +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.
5The API also supports collection of Automation Intelligence for requests to your server in edge, pre-origin, or middleware contexts.
7The version of the OpenAPI document: 4
8Contact: support@fingerprint.com
9Generated by OpenAPI Generator (https://openapi-generator.tech)
11Do not edit the class manually.
12""" # noqa: E501
14from __future__ import annotations
16import json
17import pprint
18import re # noqa: F401
19from typing import Any, ClassVar, Optional, Union
21from pydantic import BaseModel, ConfigDict, StrictFloat, StrictInt
22from typing_extensions import Self
25class FontPreferences(BaseModel):
26 """
27 Baseline measurement of canonical fonts rendered on the device. Numeric width metrics, in CSS pixels, for the canonical fonts collected by the agent.
28 """
30 default: Optional[Union[StrictFloat, StrictInt]] = None
31 serif: Optional[Union[StrictFloat, StrictInt]] = None
32 sans: Optional[Union[StrictFloat, StrictInt]] = None
33 mono: Optional[Union[StrictFloat, StrictInt]] = None
34 apple: Optional[Union[StrictFloat, StrictInt]] = None
35 min: Optional[Union[StrictFloat, StrictInt]] = None
36 system: Optional[Union[StrictFloat, StrictInt]] = None
37 __properties: ClassVar[list[str]] = [
38 'default',
39 'serif',
40 'sans',
41 'mono',
42 'apple',
43 'min',
44 'system',
45 ]
47 model_config = ConfigDict(
48 populate_by_name=True,
49 validate_assignment=True,
50 protected_namespaces=(),
51 )
53 def to_str(self) -> str:
54 """Returns the string representation of the model using alias"""
55 return pprint.pformat(self.model_dump(by_alias=True))
57 def to_json(self) -> str:
58 """Returns the JSON representation of the model using alias"""
59 # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
60 return json.dumps(self.to_dict())
62 @classmethod
63 def from_json(cls, json_str: str) -> Optional[Self]:
64 """Create an instance of FontPreferences from a JSON string"""
65 return cls.from_dict(json.loads(json_str))
67 def to_dict(self) -> dict[str, Any]:
68 """Return the dictionary representation of the model using alias.
70 This has the following differences from calling pydantic's
71 `self.model_dump(by_alias=True)`:
73 * `None` is only added to the output dict for nullable fields that
74 were set at model initialization. Other fields with value `None`
75 are ignored.
76 """
77 excluded_fields: set[str] = set([])
79 _dict = self.model_dump(
80 by_alias=True,
81 exclude=excluded_fields,
82 exclude_none=True,
83 )
84 return _dict
86 @classmethod
87 def from_dict(cls, obj: Optional[dict[str, Any]]) -> Optional[Self]:
88 """Create an instance of FontPreferences from a dict"""
89 if obj is None:
90 return None
92 if not isinstance(obj, dict):
93 return cls.model_validate(obj)
95 _obj = cls.model_validate(
96 {
97 'default': obj.get('default'),
98 'serif': obj.get('serif'),
99 'sans': obj.get('sans'),
100 'mono': obj.get('mono'),
101 'apple': obj.get('apple'),
102 'min': obj.get('min'),
103 'system': obj.get('system'),
104 }
105 )
106 return _obj