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: Get, set, or list environment variables.
  
  Usage:\
  
    :``%env``: lists all environment variables/values
    :``%env var``: get value for var
    :``%env var val``: set value for var
    :``%env var=val``: set value for var
    :``%env var=$val``: set value for var, using python expansion if possible
docstr_tok: ["Get",",","set",",","or","list","environment","variables",".","Usage",":","\\",":","``","%","env","``",":","lists","all","environment","variables\/values",":","``","%","env","var","``",":","get","value","for","var",":","``","%","env","var","val","``",":","set","value","for","var",":","``","%","env","var=val","``",":","set","value","for","var",":","``","%","env","var=","$","val","``",":","set","value","for","var",",","using","python","expansion","if","possible"]
code: def env(self, parameter_s=""):
      """Get, set, or list environment variables.
  
          Usage:\\
  
            :``%env``: lists all environment variables/values
            :``%env var``: get value for var
            :``%env var val``: set value for var
            :``%env var=val``: set value for var
            :``%env var=$val``: set value for var, using python expansion if possible
          """
      if parameter_s.strip():
          split = "=" if "=" in parameter_s else " "
          bits = parameter_s.split(split)
          if len(bits) == 1:
              key = parameter_s.strip()
              if key in os.environ:
                  return os.environ[key]
              else:
                  err = "Environment does not have key: {0}".format(key)
                  raise UsageError(err)
          if len(bits) > 1:
              return self.set_env(parameter_s)
      env = dict(os.environ)
      # hide likely secrets when printing the whole environment
      for key in list(env):
          if any(s in key.lower() for s in ("key", "token", "secret")):
              env[key] = "<hidden>"
  
      return env
  
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 10 for calling the OSMagics obj's underlying member method code with example usage: obj.env(parameter_s) and returns: env, self, os