Util¶
-
check_not_none(val, message)¶ Tests if an argument is not
None.Parameters: - val – (object), the argument tested to see if it is not
None. - message – (str), the error message.
- val – (object), the argument tested to see if it is not
-
check_true(val, message)¶ Tests whether the provided expression is
true.Parameters: - val – (bool), the expression tested to see if it is
true. - message – (str), the error message.
- val – (bool), the expression tested to see if it is
-
check_not_negative(val, message)¶ Tests if a value is not negative.
Parameters: - val – (Number), the value tested to see if it is not negative.
- message – (str), the error message.
-
check_not_empty(collection, message)¶ Tests if a collection is not empty.
Parameters: - collection – (Collection), the collection tested to see if it is not empty.
- message – (str), the error message.
-
current_time()¶ Returns the current time of the system.
Returns: (float), current time of the system.
-
thread_id()¶ Returns the current thread’s id.
Returns: (int), current thread’s id.
-
to_millis(seconds)¶ Converts the time parameter in seconds to milliseconds. If the given time is negative, returns the original value.
Parameters: seconds – (Number), the given time in seconds. Returns: (int), result of the conversation in milliseconds.
-
validate_type(_type)¶ Validates the type.
Parameters: _type – (Type), the type to be validated.
-
validate_serializer(serializer, _type)¶ Validates the serializer for given type.
Parameters: - serializer – (Serializer), the serializer to be validated.
- _type – (Type), type to be used for serializer validation.
-
class
AtomicInteger(initial=0)¶ Bases:
objectAtomicInteger is an Integer which can work atomically.
-
get_and_increment()¶ Returns the current value and increment it.
Returns: (int), current value of AtomicInteger.
-
set(value)¶ Sets the value of this AtomicInteger. :param value: (int), the new value of AtomicInteger.
-
-
enum(**enums)¶ Utility method for defining enums. :param enums: Parameters of enumeration. :return: (Enum), the created enumerations.
-
get_possible_addresses(addresses=[], member_list=[])¶
-
class
ImmutableLazyDataList(list_data, to_object)¶ Bases:
_abcoll.Sequence
-
get_portable_version(portable, default_version)¶