MCPcopy Create free account
hub / github.com/catboost/catboost / get_valid_port_range

Function get_valid_port_range

library/python/port_manager/__init__.py:226–243  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

224
225
226def get_valid_port_range():
227 first_valid = 1025
228 last_valid = UI16MAXVAL
229
230 given_range = os.environ.get('VALID_PORT_RANGE')
231 if given_range and ':' in given_range:
232 return [list(int(x) for x in given_range.split(':', 2))]
233
234 first_eph, last_eph = get_ephemeral_range()
235 first_invalid = max(first_eph, first_valid)
236 last_invalid = min(last_eph, last_valid)
237
238 ranges = []
239 if first_invalid > first_valid:
240 ranges.append((first_valid, first_invalid - 1))
241 if last_invalid < last_valid:
242 ranges.append((last_invalid + 1, last_valid))
243 return ranges
244
245
246def get_ephemeral_range():

Callers 1

__init__Method · 0.85

Calls 8

get_ephemeral_rangeFunction · 0.85
listClass · 0.50
intFunction · 0.50
maxFunction · 0.50
minFunction · 0.50
getMethod · 0.45
splitMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected