gootsaud / bike-riding

Re-defined variable from outer scope PYL-W0621
Anti-pattern
Major
a year agoa year old
Redefining name 'escape' from outer scope (line 280)
240
241
242def _escape_argspec(
243    obj: _ListOrDict, iterable: t.Iterable[t.Any], escape: t.Callable[[t.Any], Markup]244) -> _ListOrDict:
245    """Helper for various string-wrapped functions."""
246    for key, value in iterable:
Redefining name 'escape' from outer scope (line 280)
255
256    __slots__ = ("obj", "escape")
257
258    def __init__(self, obj: t.Any, escape: t.Callable[[t.Any], Markup]) -> None:259        self.obj = obj
260        self.escape = escape
261
Redefining name 'escape' from outer scope (line 280)
214class EscapeFormatter(string.Formatter):
215    __slots__ = ("escape",)
216
217    def __init__(self, escape: t.Callable[[t.Any], Markup]) -> None:218        self.escape = escape
219        super().__init__()
220
Redefining name 'warnings' from outer scope (line 6)
484
485
486def unicode_urlencode(obj: t.Any, charset: str = "utf-8", for_qs: bool = False) -> str:
487    import warnings488
489    warnings.warn(
490        "'unicode_urlencode' has been renamed to 'url_quote'. The old"
Redefining name 'pformat' from outer scope (line 249)
248
249def pformat(obj: t.Any) -> str:
250    """Format an object using :func:`pprint.pformat`."""
251    from pprint import pformat  # type: ignore252
253    return pformat(obj)
254