class_docstr: Class to make it possible to use pythran as a magic IPython command.
class_docstr_tok: ["Class","to","make","it","possible","to","use","pythran","as","a","magic","IPython","command","."]
docstr: Compile and import everything from a Pythran code cell.
  
  %%pythran
  #pythran export foo(int)
  def foo(x):
      return x + x
docstr_tok: ["Compile","and","import","everything","from","a","Pythran","code","cell",".","%","%","pythran","#","pythran","export","foo","(","int",")","def","foo","(","x",")",":","return","x","+","x"]
code: def pythran(self, line, cell):
      """
      Compile and import everything from a Pythran code cell.
  
      %%pythran
      #pythran export foo(int)
      def foo(x):
          return x + x
      """
      args = magic_arguments.parse_argstring(self.pythran, line)
      kwargs = {}
      if args.D:
          kwargs["define_macros"] = args.D
      for v in "OmWf":
          args_v = getattr(args, v)
          for target in ("extra_compile_args", "extra_link_args"):
              kwargs.setdefault(target, []).extend(
                  "-{}{}".format(v, x) for x in args_v
              )
  
      m = hashlib.md5()
      m.update(line.encode("utf-8"))
      m.update(cell.encode("utf-8"))
      module_name = "pythranized_" + m.hexdigest()
      module_path = pythran.compile_pythrancode(
          module_name, cell, **kwargs
      )
      loader = importlib.machinery.ExtensionFileLoader(
          module_name, module_path
      )
      spec = importlib.machinery.ModuleSpec(
          name=module_name, loader=loader, origin=module_path
      )
      module = importlib._bootstrap._load(spec)
      self._import_all(module)
  
file_path: catboost/contrib/python/pythran/pythran/magic.py
imports: import hashlib
  import importlib
  from IPython.core.magic import Magics, magics_class, cell_magic
  from IPython.core import magic_arguments
  import pythran
label_desc: Use image node_id 3 for calling the PythranMagics obj's underlying member method code with example usage: obj.pythran(line, cell) without return types