class_docstr: Magics to interact with the underlying OS (shell-type functionality).
      
class_docstr_tok: ["Magics","to","interact","with","the","underlying","OS","(","shell-type","functionality",")","."]
docstr: Set environment variables.  Assumptions are that either "val" is a
  name in the user namespace, or val is something that evaluates to a
  string.
  
  Usage:\
    :``%set_env var val``: set value for var
    :``%set_env var=val``: set value for var
    :``%set_env var=$val``: set value for var, using python expansion if possible
docstr_tok: ["Set","environment","variables",".","Assumptions","are","that","either","``","val","''","is","a","name","in","the","user","namespace",",","or","val","is","something","that","evaluates","to","a","string",".","Usage",":","\\",":","``","%","set_env","var","val","``",":","set","value","for","var",":","``","%","set_env","var=val","``",":","set","value","for","var",":","``","%","set_env","var=","$","val","``",":","set","value","for","var",",","using","python","expansion","if","possible"]
code: def set_env(self, parameter_s):
      """Set environment variables.  Assumptions are that either "val" is a
          name in the user namespace, or val is something that evaluates to a
          string.
  
          Usage:\\
            :``%set_env var val``: set value for var
            :``%set_env var=val``: set value for var
            :``%set_env var=$val``: set value for var, using python expansion if possible
          """
      split = "=" if "=" in parameter_s else " "
      bits = parameter_s.split(split, 1)
      if not parameter_s.strip() or len(bits) < 2:
          raise UsageError("usage is 'set_env var=val'")
      var = bits[0].strip()
      val = bits[1].strip()
      if re.match(r".*\s.*", var):
          # an environment variable with whitespace is almost certainly
          # not what the user intended.  what's more likely is the wrong
          # split was chosen, ie for "set_env cmd_args A=B", we chose
          # '=' for the split and should have chosen ' '.  to get around
          # this, users should just assign directly to os.environ or use
          # standard magic {var} expansion.
          err = "refusing to set env var with whitespace: '{0}'"
          err = err.format(val)
          raise UsageError(err)
      os.environ[var] = val
      print("env: {0}={1}".format(var, val))
  
imports: import io
  import os
  import pathlib
  import re
  import sys
  from pprint import pformat
  from IPython.core import magic_arguments
  from IPython.core import oinspect
  from IPython.core import page
  from IPython.core.alias import AliasError, Alias
  from IPython.core.error import UsageError
  from IPython.core.magic import Magics, compress_dhist, magics_class, line_magic, cell_magic, line_cell_magic
  from IPython.testing.skipdoctest import skip_doctest
  from IPython.utils.openpy import source_to_unicode
  from IPython.utils.process import abbrev_cwd
  from IPython.utils.terminal import set_term_title
  from traitlets import Bool
  from warnings import warn
label_desc: Use image node_id 11 for calling the OSMagics obj's underlying member method code with example usage: obj.set_env(parameter_s) without return types