blob: 9d48518eab0733d6cc773ac9cde1e0805858bc9b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
"""Int class definition lives here"""
from .param import Param
class Int(Param):
def __init__(self, value, classname=""):
"""Defines the float param type
Args:
value: the value of the Int
classname: the name of the class to which the param belongs
"""
super(Int, self).__init__(classname=classname)
try:
if value:
self.value = int(value)
else:
self.value = 0
except Exception as e:
self.err_warn("Not an int: %s" % str(value))
self.err_warn(str(e))
def __int__(self):
return int(self.value)
def __float__(self):
return float(self.value)
|