| 2962 | self.error(obj, value) |
| 2963 | |
| 2964 | def from_string(self, s: str) -> G: |
| 2965 | if self.allow_none and s == "None": |
| 2966 | return None # type:ignore[return-value] |
| 2967 | s = os.path.expanduser(s) |
| 2968 | if len(s) >= 2: |
| 2969 | # handle deprecated "1" |
| 2970 | for c in ('"', "'"): |
| 2971 | if s[0] == s[-1] == c: |
| 2972 | old_s = s |
| 2973 | s = s[1:-1] |
| 2974 | warn( |
| 2975 | "Supporting extra quotes around strings is deprecated in traitlets 5.0. " |
| 2976 | f"You can use {s!r} instead of {old_s!r} if you require traitlets >=5.", |
| 2977 | DeprecationWarning, |
| 2978 | stacklevel=2, |
| 2979 | ) |
| 2980 | return s # type:ignore[return-value] |
| 2981 | |
| 2982 | def subclass_init(self, cls: type[t.Any]) -> None: |
| 2983 | pass # fully opt out of instance_init |