(self, params: dict)
| 95 | OVERRIDABLE: frozenset = frozenset() |
| 96 | |
| 97 | def apply_param_overrides(self, params: dict) -> None: |
| 98 | for const in self.OVERRIDABLE: |
| 99 | self.__dict__.pop(const, None) |
| 100 | for key, value in params.items(): |
| 101 | if key == "query": |
| 102 | continue |
| 103 | const = key.upper() |
| 104 | if const not in self.OVERRIDABLE: |
| 105 | logger.warning(f"[{type(self).__name__}] 未知参数 {key},已忽略") |
| 106 | continue |
| 107 | try: |
| 108 | setattr( |
| 109 | self, const, coerce_like(value, getattr(type(self), const), key) |
| 110 | ) |
| 111 | except ValueError as e: |
| 112 | logger.error( |
| 113 | f"[{type(self).__name__}] 参数 {key} 非法({e}),回落默认值" |
| 114 | ) |
no test coverage detected