pyfunctools.utils module
- pyfunctools.utils.is_empty(value: any) bool[source]
Checks if the value passed by parameter is empty.
Examples
>>> is_empty('') True >>> is_empty(None) True >>> is_empty([]) True >>> is_empty(Array()) True >>> is_empty({}) True >>> is_empty(()) True
- pyfunctools.utils.is_equal(obj1, obj2) bool[source]
Recursive function that checks if two parameters are equal
Examples
>>> is_equal(1, 1) True >>> is_equal('{}', '{}') True >>> is_equal({}, {}) True >>> is_equal([], []) True >>> is_equal({'language': 'python'}, {'language': 'python'}) True >>> is_equal({'language': 'python'}, {'language': 'js'}) False >>> is_equal(Array(), Array()) True
- pyfunctools.utils.is_float(obj: any) bool[source]
Tests an object and returns true if it is an int value.
- Parameters:
obj (any) – Object to test
Examples
>>> is_float(1.0) True >>> is_float(10) False >>> is_float(lambda a: a) False >>> is_float('a') False
- pyfunctools.utils.is_func(obj: any) bool[source]
Tests an object and returns true if it is a function.
- Parameters:
obj (any) – Object to test
Examples
>>> is_func(lambda a: a) True >>> is_func('a') False >>> is_func(10) False >>> def func(): ... pass ... >>> is_func(func) True
- pyfunctools.utils.is_int(obj: any) bool[source]
Tests an object and returns true if it is an int value.
- Parameters:
obj (any) – Object to test
Examples
>>> is_int(10) True >>> is_int(1.0) False >>> is_int(lambda a: a) False >>> is_int('a') False
- pyfunctools.utils.is_negative(obj: str | int | float) bool[source]
Check if number is negative
Examples
>>> is_negative('-2') True >>> is_negative('1') False >>> is_negative('1000') False >>> is_negative('-1000') True
- pyfunctools.utils.is_num(obj: any) bool[source]
Check if obj is number
Examples
>>> is_num(10) True >>> is_num(-10) True >>> is_num(+10) True >>> is_num(.10) True >>> is_num('.10') True >>> is_num('a') False