MCPcopy Create free account
hub / github.com/DragonisCV/RAM / _postprocess_yml_value

Function _postprocess_yml_value

ram/utils/options.py:75–96  ·  view source on GitHub ↗
(value)

Source from the content-addressed store, hash-verified

73
74
75def _postprocess_yml_value(value):
76 # None
77 if value == '~' or value.lower() == 'none':
78 return None
79 # bool
80 if value.lower() == 'true':
81 return True
82 elif value.lower() == 'false':
83 return False
84 # !!float number
85 if value.startswith('!!float'):
86 return float(value.replace('!!float', ''))
87 # number
88 if value.isdigit():
89 return int(value)
90 elif value.replace('.', '', 1).isdigit() and value.count('.') < 2:
91 return float(value)
92 # list
93 if value.startswith('['):
94 return eval(value)
95 # str
96 return value
97
98def _merge_from_base(opt, opt_path):
99 def _merge_a_into_b(opt_a, opt_b):

Callers 1

parse_optionsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected