(self, old: Any, new: Any)
| 109 | obj[key_path[-1]] = new |
| 110 | |
| 111 | def _cast(self, old: Any, new: Any) -> Any: |
| 112 | if isinstance(old, bool): |
| 113 | return new not in ("0", "") |
| 114 | elif isinstance(old, str): |
| 115 | return new |
| 116 | elif old is None: |
| 117 | return new |
| 118 | elif isinstance(old, (list, tuple)): |
| 119 | err = "Can't adapt an environment string into a {}!" |
| 120 | err = err.format(type(old)) |
| 121 | raise UncastableEnvVar(err) |
| 122 | else: |
| 123 | return old.__class__(new) |
no test coverage detected