MCPcopy
hub / github.com/pantsbuild/pants / register

Function register

src/python/pants/testutil/option/fakes.py:53–70  ·  view source on GitHub ↗
(*args, **kwargs)

Source from the content-addressed store, hash-verified

51
52def _options_registration_function(defaults, fingerprintables):
53 def register(*args, **kwargs):
54 _, option_dest = Parser.parse_name_and_dest(*args, **kwargs)
55
56 default = kwargs.get("default")
57 if default is None:
58 if kwargs.get("type") == bool:
59 default = False
60 if kwargs.get("type") == list:
61 default = []
62 defaults[option_dest] = RankedValue(Rank.HARDCODED, default)
63
64 fingerprint = kwargs.get("fingerprint", False)
65 if fingerprint:
66 if is_list_option(kwargs):
67 val_type = kwargs.get("member_type", str)
68 else:
69 val_type = kwargs.get("type", str)
70 fingerprintables[option_dest] = val_type
71
72 return register
73

Callers 15

register_optionsMethod · 0.85
register_optionsMethod · 0.85
register_optionsMethod · 0.85
recording_registerMethod · 0.85
register_optionsMethod · 0.85
register_optionsMethod · 0.85
register_optionsMethod · 0.85
register_optionsMethod · 0.85
register_optionsMethod · 0.85

Calls 4

RankedValueClass · 0.90
is_list_optionFunction · 0.90
parse_name_and_destMethod · 0.80
getMethod · 0.45

Tested by 14

register_optionsMethod · 0.68
register_optionsMethod · 0.68
register_optionsMethod · 0.68
register_optionsMethod · 0.68
register_optionsMethod · 0.68
register_optionsMethod · 0.68
register_optionsMethod · 0.68
register_optionsMethod · 0.68
register_optionsMethod · 0.68
register_optionsMethod · 0.68
register_optionsMethod · 0.68