Handle parameters provided as keyword arguments to ftfy's top-level functions, converting them into a TextFixerConfig.
(
config: TextFixerConfig, kwargs: dict[str, Any]
)
| 228 | |
| 229 | |
| 230 | def _config_from_kwargs( |
| 231 | config: TextFixerConfig, kwargs: dict[str, Any] |
| 232 | ) -> TextFixerConfig: |
| 233 | """ |
| 234 | Handle parameters provided as keyword arguments to ftfy's top-level |
| 235 | functions, converting them into a TextFixerConfig. |
| 236 | """ |
| 237 | if "fix_entities" in kwargs: |
| 238 | warnings.warn( |
| 239 | "`fix_entities` has been renamed to `unescape_html`", |
| 240 | DeprecationWarning, |
| 241 | stacklevel=2, |
| 242 | ) |
| 243 | kwargs = kwargs.copy() |
| 244 | kwargs["unescape_html"] = kwargs["fix_entities"] |
| 245 | del kwargs["fix_entities"] |
| 246 | config = config._replace(**kwargs) |
| 247 | return config |
| 248 | |
| 249 | |
| 250 | BYTES_ERROR_TEXT = """Hey wait, this isn't Unicode. |
no outgoing calls
no test coverage detected