| 51 | |
| 52 | def _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 | |