# HG changeset patch # User Olly Cope # Date 1634748057 0 # Wed Oct 20 16:40:57 2021 +0000 # Node ID 3a460b53756bd3419a943ceec378575a7000dcf8 # Parent 2cb542db7d11963609afa28e5af512c2c364ed59 Fix linter errors diff --git a/morf/bindadapters.py b/morf/bindadapters.py --- a/morf/bindadapters.py +++ b/morf/bindadapters.py @@ -68,13 +68,13 @@ unnumbered_list_separator = "[]" def __init__(self): - unnumbered_list_pattern = "{0}(?P)".format( + unnumbered_list_pattern = r"{0}(?P)".format( re.escape(self.unnumbered_list_separator) ) - numbered_list_pattern = "{0}(?P\d+)".format( + numbered_list_pattern = r"{0}(?P\d+)".format( re.escape(self.list_separator) ) - dict_pattern = "{0}(?P([^\.#\[]+))".format( + dict_pattern = r"{0}(?P([^\.#\[]+))".format( re.escape(self.dict_separator) ) self._finder = re.compile( @@ -109,31 +109,31 @@ # Numbered list elif match["N"] is not None: - l = setval({}) - if l and identity not in list_surrogates: + items = setval({}) + if items and identity not in list_surrogates: self.warn_mixed_key(path) continue list_surrogates[(id(curdata), curkey)] = ( curdata, curkey, - l, + items, ) - curdata = l + curdata = items curkey = match["N"] setval = partial(curdata.setdefault, curkey) # Unnumbered list elif match["U"] is not None: - l = setval({}) - if l and identity not in list_surrogates: + items = setval({}) + if items and identity not in list_surrogates: self.warn_mixed_key(path) continue list_surrogates[(id(curdata), curkey)] = ( curdata, curkey, - l, + items, ) - curdata = l + curdata = items curkey = len(curdata) setval = partial(curdata.setdefault, curkey)