code: def hacking_no_locals(logical_line, tokens, noqa):
      
      if noqa:
          return
      for_formatting = False
      for token_type, text, start, _, _ in tokens:
          if text == "%" and token_type == tokenize.OP:
              for_formatting = True
          if for_formatting and token_type == tokenize.NAME:
              for k, v in LOCALS_TEXT_MAP.items():
                  if text == k and v in logical_line:
                      yield (start[1],
                             "H501: Do not use %s for string formatting" % v)
docs: Do not use locals() or self.__dict__ for string formatting.
  
      Okay: 'locals()'
      Okay: 'locals'
      Okay: locals()
      Okay: print(locals())
      H501: print("%(something)" % locals())
      H501: LOG.info(_("%(something)") % self.__dict__)
      Okay: print("%(something)" % locals())  # noqa