Try to make an ID for a parameter in a ParameterSet using the user-provided id callable, if given.
(self, val: object, argname: str, idx: int)
| 1009 | return self._idval_from_argname(argname, idx) |
| 1010 | |
| 1011 | def _idval_from_function(self, val: object, argname: str, idx: int) -> str | None: |
| 1012 | """Try to make an ID for a parameter in a ParameterSet using the |
| 1013 | user-provided id callable, if given.""" |
| 1014 | if self.idfn is None: |
| 1015 | return None |
| 1016 | try: |
| 1017 | id = self.idfn(val) |
| 1018 | except Exception as e: |
| 1019 | prefix = f"{self.nodeid}: " if self.nodeid is not None else "" |
| 1020 | msg = "error raised while trying to determine id of parameter '{}' at position {}" |
| 1021 | msg = prefix + msg.format(argname, idx) |
| 1022 | raise ValueError(msg) from e |
| 1023 | if id is None: |
| 1024 | return None |
| 1025 | return self._idval_from_value(id) |
| 1026 | |
| 1027 | def _idval_from_hook(self, val: object, argname: str) -> str | None: |
| 1028 | """Try to make an ID for a parameter in a ParameterSet by calling the |
no test coverage detected