Coverage for fingerprint_server_sdk/models/web_gl_extensions.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 WebGlExtensions(BaseModel): 

26 """ 

27 Hashes of WebGL context attributes and extension support. 

28 """ 

29 

30 context_attributes: Optional[StrictStr] = None 

31 parameters: Optional[StrictStr] = None 

32 shader_precisions: Optional[StrictStr] = None 

33 extensions: Optional[StrictStr] = None 

34 extension_parameters: Optional[StrictStr] = None 

35 unsupported_extensions: Optional[list[StrictStr]] = None 

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

37 'context_attributes', 

38 'parameters', 

39 'shader_precisions', 

40 'extensions', 

41 'extension_parameters', 

42 'unsupported_extensions', 

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 WebGlExtensions 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 WebGlExtensions 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 'context_attributes': obj.get('context_attributes'), 

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

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

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

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

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

101 } 

102 ) 

103 return _obj