MCPcopy Create free account
hub / github.com/AMAP-ML/EMF / apply_defaults

Method apply_defaults

trl/trl/scripts/utils.py:243–254  ·  view source on GitHub ↗
(parser, kw)

Source from the content-addressed store, hash-verified

241 """
242
243 def apply_defaults(parser, kw):
244 used_keys = set()
245 for action in parser._actions:
246 # Handle subparsers recursively
247 if isinstance(action, argparse._SubParsersAction):
248 for subparser in action.choices.values():
249 used_keys.update(apply_defaults(subparser, kw))
250 elif action.dest in kw:
251 action.default = kw[action.dest]
252 action.required = False
253 used_keys.add(action.dest)
254 return used_keys
255
256 used_keys = apply_defaults(self, kwargs)
257 # Remaining args not consumed by the parser

Callers

nothing calls this directly

Calls 2

addMethod · 0.80
updateMethod · 0.45

Tested by

no test coverage detected