Burgerlib Python
Loading...
Searching...
No Matches
Public Member Functions | List of all members
burger.validators.IntegerProperty Class Reference

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

Inheritance diagram for burger.validators.IntegerProperty:
Inheritance graph
[legend]
Collaboration diagram for burger.validators.IntegerProperty:
Collaboration graph
[legend]

Public Member Functions

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

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__()

def 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

Reimplemented from burger.validators.Property.