MCPcopy
hub / github.com/rspeer/python-ftfy / _config_from_kwargs

Function _config_from_kwargs

ftfy/__init__.py:230–247  ·  view source on GitHub ↗

Handle parameters provided as keyword arguments to ftfy's top-level functions, converting them into a TextFixerConfig.

(
    config: TextFixerConfig, kwargs: dict[str, Any]
)

Source from the content-addressed store, hash-verified

228
229
230def _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
250BYTES_ERROR_TEXT = """Hey wait, this isn't Unicode.

Callers 6

fix_textFunction · 0.85
fix_and_explainFunction · 0.85
fix_encoding_and_explainFunction · 0.85
fix_encodingFunction · 0.85
fix_text_segmentFunction · 0.85
fix_fileFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected