Coverage for fingerprint_server_sdk/models/web_gl_basics.py: 77%

35 statements  

« 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. 

6 

7The version of the OpenAPI document: 4 

8Contact: support@fingerprint.com 

9Generated by OpenAPI Generator (https://openapi-generator.tech) 

10 

11Do not edit the class manually. 

12""" # noqa: E501 

13 

14from __future__ import annotations 

15 

16import json 

17import pprint 

18import re # noqa: F401 

19from typing import Any, ClassVar, Optional 

20 

21from pydantic import BaseModel, ConfigDict, StrictStr 

22from typing_extensions import Self 

23 

24 

25class WebGlBasics(BaseModel): 

26 """ 

27 Render and vendor strings reported by the WebGL context. 

28 """ 

29 

30 version: Optional[StrictStr] = None 

31 vendor: Optional[StrictStr] = None 

32 vendor_unmasked: Optional[StrictStr] = None 

33 renderer: Optional[StrictStr] = None 

34 renderer_unmasked: Optional[StrictStr] = None 

35 shading_language_version: Optional[StrictStr] = None 

36 __properties: ClassVar[list[str]] = [ 

37 'version', 

38 'vendor', 

39 'vendor_unmasked', 

40 'renderer', 

41 'renderer_unmasked', 

42 'shading_language_version', 

43 ] 

44 

45 model_config = ConfigDict( 

46 populate_by_name=True, 

47 validate_assignment=True, 

48 protected_namespaces=(), 

49 ) 

50 

51 def to_str(self) -> str: 

52 """Returns the string representation of the model using alias""" 

53 return pprint.pformat(self.model_dump(by_alias=True)) 

54 

55 def to_json(self) -> str: 

56 """Returns the JSON representation of the model using alias""" 

57 # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead 

58 return json.dumps(self.to_dict()) 

59 

60 @classmethod 

61 def from_json(cls, json_str: str) -> Optional[Self]: 

62 """Create an instance of WebGlBasics from a JSON string""" 

63 return cls.from_dict(json.loads(json_str)) 

64 

65 def to_dict(self) -> dict[str, Any]: 

66 """Return the dictionary representation of the model using alias. 

67 

68 This has the following differences from calling pydantic's 

69 `self.model_dump(by_alias=True)`: 

70 

71 * `None` is only added to the output dict for nullable fields that 

72 were set at model initialization. Other fields with value `None` 

73 are ignored. 

74 """ 

75 excluded_fields: set[str] = set([]) 

76 

77 _dict = self.model_dump( 

78 by_alias=True, 

79 exclude=excluded_fields, 

80 exclude_none=True, 

81 ) 

82 return _dict 

83 

84 @classmethod 

85 def from_dict(cls, obj: Optional[dict[str, Any]]) -> Optional[Self]: 

86 """Create an instance of WebGlBasics from a dict""" 

87 if obj is None: 

88 return None 

89 

90 if not isinstance(obj, dict): 

91 return cls.model_validate(obj) 

92 

93 _obj = cls.model_validate( 

94 { 

95 'version': obj.get('version'), 

96 'vendor': obj.get('vendor'), 

97 'vendor_unmasked': obj.get('vendor_unmasked'), 

98 'renderer': obj.get('renderer'), 

99 'renderer_unmasked': obj.get('renderer_unmasked'), 

100 'shading_language_version': obj.get('shading_language_version'), 

101 } 

102 ) 

103 return _obj