MCPcopy Create free account
hub / github.com/apache/cassandra-python-driver / get_timeout

Function get_timeout

tests/unit/io/utils.py:78–99  ·  view source on GitHub ↗

A way to generate varying timeouts based on ranges :param gross_time: Some integer between start and end :param start: the start value of the range :param end: the end value of the range :param precision: the precision to use to generate the timeout. :param split_range: gene

(gross_time, start, end, precision, split_range)

Source from the content-addressed store, hash-verified

76
77
78def get_timeout(gross_time, start, end, precision, split_range):
79 """
80 A way to generate varying timeouts based on ranges
81 :param gross_time: Some integer between start and end
82 :param start: the start value of the range
83 :param end: the end value of the range
84 :param precision: the precision to use to generate the timeout.
85 :param split_range: generate values from both ends
86 :return: a timeout value to use
87 """
88 if split_range:
89 top_num = float(end) / precision
90 bottom_num = float(start) / precision
91 if gross_time % 2 == 0:
92 timeout = top_num - float(gross_time) / precision
93 else:
94 timeout = bottom_num + float(gross_time) / precision
95
96 else:
97 timeout = float(gross_time) / precision
98
99 return timeout
100
101
102def submit_and_wait_for_completion(unit_test, create_timer, start, end, increment, precision, split_range=False):

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected