MCPcopy Create free account
hub / github.com/ipython/ipython / script_args

Function script_args

IPython/core/magics/script.py:27–66  ·  view source on GitHub ↗

single decorator for adding script args

(f)

Source from the content-addressed store, hash-verified

25#-----------------------------------------------------------------------------
26
27def script_args(f):
28 """single decorator for adding script args"""
29 args = [
30 magic_arguments.argument(
31 '--out', type=str,
32 help="""The variable in which to store stdout from the script.
33 If the script is backgrounded, this will be the stdout *pipe*,
34 instead of the stderr text itself and will not be auto closed.
35 """
36 ),
37 magic_arguments.argument(
38 '--err', type=str,
39 help="""The variable in which to store stderr from the script.
40 If the script is backgrounded, this will be the stderr *pipe*,
41 instead of the stderr text itself and will not be autoclosed.
42 """
43 ),
44 magic_arguments.argument(
45 '--bg', action="store_true",
46 help="""Whether to run the script in the background.
47 If given, the only way to see the output of the command is
48 with --out/err.
49 """
50 ),
51 magic_arguments.argument(
52 '--proc', type=str,
53 help="""The variable in which to store Popen instance.
54 This is used only when --bg option is given.
55 """
56 ),
57 magic_arguments.argument(
58 '--no-raise-error', action="store_false", dest='raise_error',
59 help="""Whether you should raise an error message in addition to
60 a stream on stderr if you get a nonzero exit code.
61 """
62 )
63 ]
64 for arg in args:
65 f = arg(f)
66 return f
67
68@magics_class
69class ScriptMagics(Magics):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected