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


Python pydoc.pager方法代码示例

本文整理汇总了Python中pydoc.pager方法的典型用法代码示例。如果您正苦于以下问题:Python pydoc.pager方法的具体用法?Python pydoc.pager怎么用?Python pydoc.pager使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pydoc的用法示例。


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

示例1: pager_print

# 需要导入模块: import pydoc [as 别名]
# 或者: from pydoc import pager [as 别名]
def pager_print(expr, **settings):
    """Prints expr using the pager, in pretty form.

    This invokes a pager command using pydoc. Lines are not wrapped
    automatically. This routine is meant to be used with a pager that allows
    sideways scrolling, like ``less -S``.

    Parameters are the same as for ``pretty_print``. If you wish to wrap lines,
    pass ``num_columns=None`` to auto-detect the width of the terminal.

    """
    from pydoc import pager
    from locale import getpreferredencoding
    if 'num_columns' not in settings:
        settings['num_columns'] = 500000  # disable line wrap
    pager(pretty(expr, **settings).encode(getpreferredencoding())) 
开发者ID:ktraunmueller,项目名称:Computable,代码行数:18,代码来源:pretty.py

示例2: _log_logs_list

# 需要导入模块: import pydoc [as 别名]
# 或者: from pydoc import pager [as 别名]
def _log_logs_list(self, data, table, table_data, follow):
        if not data:
            self.logger.log("No logs found")
            return
        if follow:
            # TODO track number of jobs seen to look for PSEOF
            if data[-1].get("message") == "PSEOF":
                self.is_logs_complete = True
            else:
                self.last_line_number = data[-1].get("line")
            for log in data:
                log_str = "{}\t{}\t{}"
                self.logger.log(log_str.format(style(fg="blue", text=str(log.get("jobId"))), style(fg="red", text=str(log.get("line"))), log.get("message")))
        else:
            table_str = self._make_table(data, table, table_data)
            if len(table_str.splitlines()) > get_terminal_lines():
                pydoc.pager(table_str)
            else:
                self.logger.log(table_str) 
开发者ID:Paperspace,项目名称:paperspace-python,代码行数:21,代码来源:experiments.py

示例3: _log_logs_list

# 需要导入模块: import pydoc [as 别名]
# 或者: from pydoc import pager [as 别名]
def _log_logs_list(self, data, table, table_data, follow):
        if not data:
            self.logger.log("No Logs found")
            return
        if follow:
            if data[-1].get("message") == "PSEOF":
                self.is_logs_complete = True
            else:
                self.last_line_number = data[-1].get("line")
            for log in data:
                log_str = "{}\t{}\t{}"
                self.logger.log(log_str.format(style(fg="blue", text=str(log.get("jobId"))),
                                               style(fg="red", text=str(log.get("line"))), log.get("message")))
        else:
            table_str = self._make_table(data, table, table_data)
            if len(table_str.splitlines()) > get_terminal_lines():
                pydoc.pager(table_str)
            else:
                self.logger.log(table_str) 
开发者ID:Paperspace,项目名称:paperspace-python,代码行数:21,代码来源:jobs.py

示例4: page_string

# 需要导入模块: import pydoc [as 别名]
# 或者: from pydoc import pager [as 别名]
def page_string(str_to_page, pager_cmd):
    """
    Page str_to_page via the pager.
    """
    # By default, we expect the command to be `less -R`. If that is the
    # pager_cmd, but they don't have less on their machine, odds are they're
    # just using the default value. In this case the pager will fail, so we'll
    # just go via pydoc.pager, which tries to do smarter checking that we don't
    # want to bother trying to replicate.
    use_fallback_page_function = False
    if pager_cmd is None:
        use_fallback_page_function = True
    elif pager_cmd == FLAG_FALLBACK:
        use_fallback_page_function = True

    try:
        if use_fallback_page_function:
            pydoc.pager(str_to_page)
        else:
            # Otherwise, obey the user.
            pydoc.pipepager(str_to_page, cmd=pager_cmd)
    except KeyboardInterrupt:
        pass 
开发者ID:srsudar,项目名称:eg,代码行数:25,代码来源:util.py

示例5: __init__

# 需要导入模块: import pydoc [as 别名]
# 或者: from pydoc import pager [as 别名]
def __init__(self, db = None, driver = None, path = None):
        cmd.Cmd.__init__(self)

        # default to .head off
        self.show_headers = False
        # default to .mode list
        self.format = self.format_list
        # a dictionary of column number: width for manual setting
        self.manual_widths = {}
        # use a pager?
        self.use_pager = False
        # calculate column widths for column view?
        self.auto_width = False
        # display stats: N rows in set (0.00 sec)
        self.show_stats = True

        if driver and path:
            self.db = dbstore.connect(path, driver=driver)
        elif db:
            self.db = db
        else:
            raise RuntimeError, 'driver and path OR db must be given'
        self.cu = self.db.cursor() 
开发者ID:sassoftware,项目名称:conary,代码行数:25,代码来源:shell.py

示例6: display

# 需要导入模块: import pydoc [as 别名]
# 或者: from pydoc import pager [as 别名]
def display(self, cu):
        lines = self.format(cu)
        if self.use_pager:
            import pydoc
            rows = [ x for x in lines ]
            text = '\n'.join(x[1] for x in rows)
            rows = sum(x[0] for x in rows)
            end = time.time()
            pydoc.pager(text)
        else:
            rows = 0
            for isrow, line in lines:
                if isrow:
                    rows += 1
                print line
            end = time.time()
        return rows, end 
开发者ID:sassoftware,项目名称:conary,代码行数:19,代码来源:shell.py

示例7: choice_README

# 需要导入模块: import pydoc [as 别名]
# 或者: from pydoc import pager [as 别名]
def choice_README(self):
        """View README file
        """
        README = ReadSBo(self.sbo_url).readme("README")
        fill = self.fill_pager(README)
        self.pager(README + fill) 
开发者ID:dslackw,项目名称:slpkg,代码行数:8,代码来源:network.py

示例8: choice_SlackBuild

# 需要导入模块: import pydoc [as 别名]
# 或者: from pydoc import pager [as 别名]
def choice_SlackBuild(self):
        """View .SlackBuild file
        """
        SlackBuild = ReadSBo(self.sbo_url).slackbuild(self.name, ".SlackBuild")
        fill = self.fill_pager(SlackBuild)
        self.pager(SlackBuild + fill) 
开发者ID:dslackw,项目名称:slpkg,代码行数:8,代码来源:network.py

示例9: choice_info

# 需要导入模块: import pydoc [as 别名]
# 或者: from pydoc import pager [as 别名]
def choice_info(self):
        """View .info file
        """
        info = ReadSBo(self.sbo_url).info(self.name, ".info")
        fill = self.fill_pager(info)
        self.pager(info + fill) 
开发者ID:dslackw,项目名称:slpkg,代码行数:8,代码来源:network.py

示例10: choice_doinst

# 需要导入模块: import pydoc [as 别名]
# 或者: from pydoc import pager [as 别名]
def choice_doinst(self):
        """View doinst.sh file
        """
        if "doinst.sh" in self.sbo_files.split():
            doinst_sh = ReadSBo(self.sbo_url).doinst("doinst.sh")
            fill = self.fill_pager(doinst_sh)
            self.pager(doinst_sh + fill) 
开发者ID:dslackw,项目名称:slpkg,代码行数:9,代码来源:network.py

示例11: pager

# 需要导入模块: import pydoc [as 别名]
# 或者: from pydoc import pager [as 别名]
def pager(self, text):
        """Read text
        """
        pydoc.pager(text) 
开发者ID:dslackw,项目名称:slpkg,代码行数:6,代码来源:network.py

示例12: _log_objects_list

# 需要导入模块: import pydoc [as 别名]
# 或者: from pydoc import pager [as 别名]
def _log_objects_list(self, objects):
        if not objects:
            self.logger.warning("No data found")
            return

        table_data = self._get_table_data(objects)
        table_str = self._make_table(table_data)
        if len(table_str.splitlines()) > get_terminal_lines():
            pydoc.pager(table_str)
        else:
            self.logger.log(table_str) 
开发者ID:Paperspace,项目名称:paperspace-python,代码行数:13,代码来源:common.py

示例13: echo_with_pager

# 需要导入模块: import pydoc [as 别名]
# 或者: from pydoc import pager [as 别名]
def echo_with_pager(output):
    pydoc.pager(output) 
开发者ID:QData,项目名称:deepWordBug,代码行数:4,代码来源:io.py

示例14: render_doc

# 需要导入模块: import pydoc [as 别名]
# 或者: from pydoc import pager [as 别名]
def render_doc():
    with open(file_path, 'r', encoding="utf-8") as f:
        content = f.read()
        pydoc.pager(content) 
开发者ID:satwikkansal,项目名称:wtfpython,代码行数:6,代码来源:main.py

示例15: help

# 需要导入模块: import pydoc [as 别名]
# 或者: from pydoc import pager [as 别名]
def help():
    import pydoc
    pydoc.pager(__doc__) 
开发者ID:Microvellum,项目名称:Fluid-Designer,代码行数:5,代码来源:pdb.py


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