MCPcopy Create free account
hub / github.com/ablab/spades / construct_yaml_int

Method construct_yaml_int

ext/src/python_libs/pyyaml3/constructor.py:223–249  ·  view source on GitHub ↗
(self, node)

Source from the content-addressed store, hash-verified

221 return self.bool_values[value.lower()]
222
223 def construct_yaml_int(self, node):
224 value = self.construct_scalar(node)
225 value = value.replace('_', '')
226 sign = +1
227 if value[0] == '-':
228 sign = -1
229 if value[0] in '+-':
230 value = value[1:]
231 if value == '0':
232 return 0
233 elif value.startswith('0b'):
234 return sign*int(value[2:], 2)
235 elif value.startswith('0x'):
236 return sign*int(value[2:], 16)
237 elif value[0] == '0':
238 return sign*int(value, 8)
239 elif ':' in value:
240 digits = [int(part) for part in value.split(':')]
241 digits.reverse()
242 base = 1
243 value = 0
244 for digit in digits:
245 value += digit*base
246 base *= 60
247 return sign*value
248 else:
249 return sign*int(value)
250
251 inf_value = 1e300
252 while inf_value != inf_value*inf_value:

Callers 1

construct_python_longMethod · 0.80

Calls 5

construct_scalarMethod · 0.95
intFunction · 0.85
startswithMethod · 0.80
splitMethod · 0.45
reverseMethod · 0.45

Tested by

no test coverage detected