Burgerlib Python
Loading...
Searching...
No Matches
burger.validators.IntegerProperty Class Reference

Class to enforce 64 bit integer in variable. More...

Inheritance diagram for burger.validators.IntegerProperty:
Collaboration diagram for burger.validators.IntegerProperty:

Public Member Functions

 __set__ (self, instance, value)
 Set the integer value.
Public Member Functions inherited from burger.validators.Property
 __init__ (self, name)
 Initialize to default.
 __get__ (self, instance, owner=None)
 Return value.
 __set__ (self, instance, value)
 Set the string value.

Additional Inherited Members

Protected Attributes inherited from burger.validators.Property
 _name = name
 The real name of the class instance.

Detailed Description

Class to enforce 64 bit integer in variable.

Examples

"Inherit from (object) for Python 2.7"
>>> class foo(object):
"Init to 1"
x = IntegerProperty(1.0)
"Init to 55"
y = IntegerProperty("55")
"Init to None"
z = IntegerProperty()
"Create the class"
f = foo()
"Print 1"
print(f.x)
"Print 0"
f.x = False
print(f.x)
"f.x is set to 99 with string"
f.x = "99.00"
print(f.x)
"Exception on bad write"
f.x = "not boolean"
Traceback (most recent call last):
...
ValueError: Not integer value

Member Function Documentation

◆ __set__()

burger.validators.IntegerProperty.__set__ ( self,
instance,
value )

Set the integer value.

Parameters
instanceReference to object containing data
valueNone or value the can be converted to bool
Exception
ValueError on invalid input.
See also
strutils.string_to_bool