Nyx Node
Toggle main menu visibility
Loading...
Searching...
No Matches
json_null.py
1
# -*- coding: utf-8 -*-
2
########################################################################################################################
3
# NyxNode
4
# Author: Jérôme ODIER <jerome.odier@lpsc.in2p3.fr>
5
# SPDX-License-Identifier: GPL-3.0+
6
########################################################################################################################
7
8
import
typing
9
10
########################################################################################################################
11
12
from
..
import
bind
13
from
..
import
obj
14
15
########################################################################################################################
16
17
class
NyxNull
(
obj.NyxObject
):
18
"""!
19
@brief JSON null object.
20
"""
21
22
####################################################################################################################
23
24
def
__init__
(self, value: typing.Any, ptr: int |
None
=
None
):
25
"""!
26
@brief Allocates a new JSON null object or wraps one.
27
28
@param value Optional default value.
29
@param ptr Optional JSON null object pointer.
30
"""
31
32
################################################################################################################
33
34
if
ptr
is
None
:
35
36
ptr = bind.lib.nyx_null_new()
37
38
elif
bind.lib.nyx_object_get_type(ptr) != bind.NyxObjectType.NULL:
39
40
raise
TypeError(
'Not a pointer to a Nyx null object'
)
41
42
################################################################################################################
43
44
super().
__init__
(ptr)
45
46
################################################################################################################
47
48
if
isinstance(value, type(
None
)):
49
50
raise
TypeError(
'Cannot set a value on a JSON null object'
)
51
52
####################################################################################################################
53
54
@property
55
def
value
(self) -> None:
56
"""!
57
@brief Gets the value of this JSON null object.
58
59
@return The current value (`None`).
60
"""
61
62
return
None
63
64
####################################################################################################################
65
66
# noinspection PyUnusedLocal
67
@value.setter
68
def
value
(self, value: typing.Any) -> bool:
69
"""!
70
@brief Sets the value of this JSON null object.
71
72
@return @c True if the value was modified, @c False otherwise.
73
"""
74
75
return
False
76
77
########################################################################################################################
78
79
__all__ = [
'NyxNull'
]
80
81
########################################################################################################################
nyx.json.json_null.NyxNull
JSON null object.
Definition
json_null.py:17
nyx.json.json_null.NyxNull.value
None value(self)
Gets the value of this JSON null object.
Definition
json_null.py:55
nyx.json.json_null.NyxNull.__init__
__init__(self, typing.Any value, int|None ptr=None)
Allocates a new JSON null object or wraps one.
Definition
json_null.py:24
nyx.obj.NyxObject
Base class for JSON Nyx objects.
Definition
obj.py:44
Author:
Jérôme ODIER
License:
LGPL-3.0-or-later
Copyright:
LPSC / CNRS