当前位置: 首页>>代码示例>>Python>>正文


Python ipythonhelper.MagicCommandParser类代码示例

本文整理汇总了Python中pyquickhelper.ipythonhelper.MagicCommandParser的典型用法代码示例。如果您正苦于以下问题:Python MagicCommandParser类的具体用法?Python MagicCommandParser怎么用?Python MagicCommandParser使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了MagicCommandParser类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: lsrepo_parser

 def lsrepo_parser():
     """
     Defines the way to parse the magic command ``%lsrepo``.
     """
     parser = MagicCommandParser(prog="lsrepo",
                                 description='display the content of a repository (GIT or SVN)')
     parser.add_argument('path', type=str, nargs="?",
                         help='path', default=".")
     return parser
开发者ID:sdpython,项目名称:pyensae,代码行数:9,代码来源:magic_file.py

示例2: test_eval

 def test_eval(self):
     fLOG(
         __file__,
         self._testMethodName,
         OutputPrint=__name__ == "__main__")
     params = {"x": 3, "y": 4}
     cl = MagicCommandParser(prog="test_command")
     res = cl.eval("x+y", params, fLOG=fLOG)
     fLOG(res)
     assert res == 7
开发者ID:sdpython,项目名称:pyquickhelper,代码行数:10,代码来源:test_ipythonhelper.py

示例3: test_parse

 def test_parse(self):
     fLOG(
         __file__,
         self._testMethodName,
         OutputPrint=__name__ == "__main__")
     parser = MagicCommandParser(prog="test_command",
                                 description='display the first lines of a text file')
     typstr = str  # unicode#
     parser.add_argument('f', type=typstr, help='filename')
     parser.add_argument(
         '-n', '--n',
         type=typstr, default=10,
         help='number of lines to display')
     parser.add_argument(
         '-e',
         '--encoding',
         default="utf8",
         help='file encoding')
     params = {"x": 3, "y": 4}
     res = parser.parse_cmd('this.py -n x+y', context=params, fLOG=fLOG)
     fLOG(res.__dict__)
     r = parser.format_help()
     assert "usage: test_command [-h] [-n N] [-e ENCODING] f" in r
     fLOG("###\n", r, "###\n")
     fLOG(parser.usage)
     self.assertEqual(res.n, 7)
开发者ID:sdpython,项目名称:pyquickhelper,代码行数:26,代码来源:test_ipythonhelper.py

示例4: hd_pig_submit_parser

 def hd_pig_submit_parser():
     """
     defines the way to parse the magic command ``%hd_pig_submit``
     """
     parser = MagicCommandParser(prog="hd_pig_submit",
                                 description='Submits a job to the cluster, the job is local, the job is first uploaded to the cluster. The magic command populates the local variable last_job with the submitted job id.')
     parser.add_argument(
         'file',
         type=str,
         help='file name')
     parser.add_argument(
         '-d',
         '--dependency',
         nargs="*",
         type=list,
         help='dependency of the job, the python script')
     parser.add_argument(
         '-s',
         '--stop_on_failure',
         action='store_true',
         default=False,
         help='if true, the job stops on failure right away')
     parser.add_argument(
         '-o',
         '--options',
         nargs='*',
         type=list,
         help='list of options for the job')
     return parser
开发者ID:GuillaumeSalha,项目名称:pyensae,代码行数:29,代码来源:magic_azure.py

示例5: tail_parser

 def tail_parser():
     """
     defines the way to parse the magic command ``%tail``
     """
     parser = MagicCommandParser(prog="tail",
                                 description='display the last lines of a text file')
     parser.add_argument('f', type=str, help='filename')
     parser.add_argument(
         '-n',
         '--n',
         type=int,
         default=10,
         help='number of lines to display')
     parser.add_argument(
         '-r',
         '--raw',
         default=False,
         action='store_true',
         help='display raw text instead of HTML')
     parser.add_argument(
         '-e',
         '--encoding',
         default="utf8",
         help='file encoding')
     return parser
开发者ID:GuillaumeSalha,项目名称:pyensae,代码行数:25,代码来源:magic_file.py

示例6: remote_down_cluster_parser

 def remote_down_cluster_parser():
     """
     defines the way to parse the magic command ``%remote_down_cluster``
     """
     parser = MagicCommandParser(prog="remote_down_cluster",
                                 description='download a file from the cluster to the remote machine and then to your local machine')
     parser.add_argument(
         'remotepath',
         type=str,
         help='remote path (HDFS) of the uploaded file')
     parser.add_argument(
         'localfile',
         type=str,
         help='local file to upload')
     parser.add_argument(
         '-o',
         '--overwrite',
         action='store_true',
         default=False,
         help='overwrite the local file')
     parser.add_argument(
         '-m',
         '--merge',
         action='store_true',
         default=False,
         help='merges files in folder in a single file')
     return parser
开发者ID:GuillaumeSalha,项目名称:pyensae,代码行数:27,代码来源:magic_remote_ssh.py

示例7: SQL_parser

 def SQL_parser():
     """
     defines the way to parse the magic command ``%%SQL``
     """
     parser = MagicCommandParser(
         prog="SQL", description='query the database')
     parser.add_argument(
         '--df',
         type=str,
         help='output dataframe',
         default="temp_view",
         no_eval=True)
     parser.add_argument(
         '-n',
         '--n',
         type=int,
         help='number of first lines to display',
         default=10,
         eval_type=int)
     parser.add_argument(
         '-q',
         '--query',
         type=str,
         help=
         'when used in a single line (no cell), query is the SQL query, the command returns the full dataframe',
         default="",
         eval_type=str)
     parser.add_argument(
         '-v',
         '--variable',
         default="DB",
         help='variable name used to store the database object')
     return parser
开发者ID:GuillaumeSalha,项目名称:pyensae,代码行数:33,代码来源:magic_sql.py

示例8: hd_job_kill_parser

 def hd_job_kill_parser():
     """
     defines the way to parse the magic command ``%hd_job_kill``
     """
     parser = MagicCommandParser(prog="hd_job_kill",
                                 description='kill a job')
     parser.add_argument(
         'jobid',
         type=str,
         help='job id')
     return parser
开发者ID:GuillaumeSalha,项目名称:pyensae,代码行数:11,代码来源:magic_azure.py

示例9: hd_job_status_parser

 def hd_job_status_parser():
     """
     defines the way to parse the magic command ``%hd_job_status``
     """
     parser = MagicCommandParser(prog="hd_job_status",
                                 description='get the status of the job')
     parser.add_argument(
         'jobid',
         type=str,
         help='job id')
     return parser
开发者ID:GuillaumeSalha,项目名称:pyensae,代码行数:11,代码来源:magic_azure.py

示例10: blob_rmr_parser

 def blob_rmr_parser():
     """
     defines the way to parse the magic command ``%blob_rmr``
     """
     parser = MagicCommandParser(prog="blob_rmr",
                                 description='remove a remote folder')
     parser.add_argument(
         'remotepath',
         type=str,
         help='remote path to remove')
     return parser
开发者ID:GuillaumeSalha,项目名称:pyensae,代码行数:11,代码来源:magic_azure.py

示例11: blob_lsl_parser

 def blob_lsl_parser():
     """
     defines the way to parse the magic command ``%blob_lsl``
     """
     parser = MagicCommandParser(prog="blob_lsl",
                                 description='describes the content of folder in a blob storage + metadata')
     parser.add_argument(
         'path',
         type=str,
         help='path to look into, </path> or <container>/<path>')
     return parser
开发者ID:GuillaumeSalha,项目名称:pyensae,代码行数:11,代码来源:magic_azure.py

示例12: HIVE_parser

 def HIVE_parser():
     """
     defines the way to parse the magic command ``%%HIVE``
     """
     parser = MagicCommandParser(prog="HIVE",
                                 description='The command store the content of the cell as a local file.')
     parser.add_argument(
         'file',
         type=str,
         help='file name')
     return parser
开发者ID:GuillaumeSalha,项目名称:pyensae,代码行数:11,代码来源:magic_remote_ssh.py

示例13: dfs_ls_parser

 def dfs_ls_parser():
     """
     defines the way to parse the magic command ``%dfs_ls``
     """
     parser = MagicCommandParser(prog="dfs_ls",
                                 description='returns the content of a folder from the cluster as a dataframe')
     parser.add_argument(
         'path',
         type=str,
         help='path to look into')
     return parser
开发者ID:GuillaumeSalha,项目名称:pyensae,代码行数:11,代码来源:magic_remote_ssh.py

示例14: dfs_mkdir_parser

 def dfs_mkdir_parser():
     """
     defines the way to parse the magic command ``%dfs_mkdir``
     """
     parser = MagicCommandParser(prog="dfs_mkdir",
                                 description='create a folder')
     parser.add_argument(
         'path',
         type=str,
         help='path to remove')
     return parser
开发者ID:GuillaumeSalha,项目名称:pyensae,代码行数:11,代码来源:magic_remote_ssh.py

示例15: job_syntax_parser

 def job_syntax_parser():
     """
     defines the way to parse the magic command ``%job_syntax``
     """
     parser = MagicCommandParser(prog="remote_py",
                                 description='check syntax of a pig job')
     parser.add_argument(
         'file',
         type=str,
         help='file name')
     return parser
开发者ID:GuillaumeSalha,项目名称:pyensae,代码行数:11,代码来源:magic_remote_ssh.py


注:本文中的pyquickhelper.ipythonhelper.MagicCommandParser类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。