parameters: (self, data, modname='', path=None)
return_statement: return self._post_build(module, encoding)
docstring: build astroid from source code string and return rebuilded astroid
  
      Monkey patched to check encoding properly, as `file_build()` does:
        # `data` can only be an str (not unicode)
        module = self._data_build(data, modname, path)
        # But here it tries to `encode()` which will fails if there is any
        # non-ASCII character...
        module.file_bytes = data.encode('utf-8')
        return self._post_build(module, 'utf-8')
docstring_summary: build astroid from source code string and return rebuilded astroid
docstring_tokens: build astroid from source code string and return rebuilded astroid
function: def string_build(self, data, modname='', path=None):
      """
      build astroid from source code string and return rebuilded astroid
  
      Monkey patched to check encoding properly, as `file_build()` does:
        # `data` can only be an str (not unicode)
        module = self._data_build(data, modname, path)
        # But here it tries to `encode()` which will fails if there is any
        # non-ASCII character...
        module.file_bytes = data.encode('utf-8')
        return self._post_build(module, 'utf-8')
      """
      if isinstance(data, unicode):
  	# When called internally by pylint/astroid and if the source code imports
  	# `unicode_literals`, the source code may end up being an unicode object
  	# (example: `infer_named_tuple()`)
          data = data.encode('utf-8')
      encoding = _guess_encoding(data)
      if encoding is None:
          # Encoding not defined in the source file, assuming utf-8...
          encoding = 'utf-8'
      try:
          # BytesIO() does not handle unicode:
          #   TypeError: 'unicode' does not have the buffer interface
          if isinstance(data, unicode):
              data = data.encode(encoding)
          else:
              # Just to avoid error later on...
              data.decode(encoding)
      except Exception as exc:
          from zLOG import LOG, WARNING
          LOG("Products.ERP5Type.patches.pylint", WARNING,
              "%s: Considered as not importable: Wrong encoding? (%r)" %
              (modname, exc))
          raise AstroidBuildingException(exc)
      module = self._data_build(data, modname, path)
      module.file_bytes = data
      return self._post_build(module, encoding)
function_tokens: def string_build ( self , data , modname = '' , path = None ) : if isinstance ( data , unicode ) : # When called internally by pylint/astroid and if the source code imports # `unicode_literals`, the source code may end up being an unicode object # (example: `infer_named_tuple()`) data = data . encode ( 'utf-8' ) encoding = _guess_encoding ( data ) if encoding is None : # Encoding not defined in the source file, assuming utf-8... encoding = 'utf-8' try : # BytesIO() does not handle unicode: #   TypeError: 'unicode' does not have the buffer interface if isinstance ( data , unicode ) : data = data . encode ( encoding ) else : # Just to avoid error later on... data . decode ( encoding ) except Exception as exc : from zLOG import LOG , WARNING LOG ( "Products.ERP5Type.patches.pylint" , WARNING , "%s: Considered as not importable: Wrong encoding? (%r)" % ( modname , exc ) ) raise AstroidBuildingException ( exc ) module = self . _data_build ( data , modname , path ) module . file_bytes = data return self . _post_build ( module , encoding )