亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? tableparser.py

?? Requirement =====================================================================================
?? PY
?? 第 1 頁 / 共 2 頁
字號:
# Author: David Goodger# Contact: goodger@users.sourceforge.net# Revision: $Revision: 4152 $# Date: $Date: 2005-12-08 00:46:30 +0100 (Thu, 08 Dec 2005) $# Copyright: This module has been placed in the public domain."""This module defines table parser classes,which parse plaintext-graphic tablesand produce a well-formed data structure suitable for building a CALS table.:Classes:    - `GridTableParser`: Parse fully-formed tables represented with a grid.    - `SimpleTableParser`: Parse simple tables, delimited by top & bottom      borders.:Exception class: `TableMarkupError`:Function:    `update_dict_of_lists()`: Merge two dictionaries containing list values."""__docformat__ = 'reStructuredText'import reimport sysfrom docutils import DataErrorclass TableMarkupError(DataError): passclass TableParser:    """    Abstract superclass for the common parts of the syntax-specific parsers.    """    head_body_separator_pat = None    """Matches the row separator between head rows and body rows."""    double_width_pad_char = '\x00'    """Padding character for East Asian double-width text."""    def parse(self, block):        """        Analyze the text `block` and return a table data structure.        Given a plaintext-graphic table in `block` (list of lines of text; no        whitespace padding), parse the table, construct and return the data        necessary to construct a CALS table or equivalent.        Raise `TableMarkupError` if there is any problem with the markup.        """        self.setup(block)        self.find_head_body_sep()        self.parse_table()        structure = self.structure_from_cells()        return structure    def find_head_body_sep(self):        """Look for a head/body row separator line; store the line index."""        for i in range(len(self.block)):            line = self.block[i]            if self.head_body_separator_pat.match(line):                if self.head_body_sep:                    raise TableMarkupError(                        'Multiple head/body row separators in table (at line '                        'offset %s and %s); only one allowed.'                        % (self.head_body_sep, i))                else:                    self.head_body_sep = i                    self.block[i] = line.replace('=', '-')        if self.head_body_sep == 0 or self.head_body_sep == (len(self.block)                                                             - 1):            raise TableMarkupError('The head/body row separator may not be '                                   'the first or last line of the table.')class GridTableParser(TableParser):    """    Parse a grid table using `parse()`.    Here's an example of a grid table::        +------------------------+------------+----------+----------+        | Header row, column 1   | Header 2   | Header 3 | Header 4 |        +========================+============+==========+==========+        | body row 1, column 1   | column 2   | column 3 | column 4 |        +------------------------+------------+----------+----------+        | body row 2             | Cells may span columns.          |        +------------------------+------------+---------------------+        | body row 3             | Cells may  | - Table cells       |        +------------------------+ span rows. | - contain           |        | body row 4             |            | - body elements.    |        +------------------------+------------+---------------------+    Intersections use '+', row separators use '-' (except for one optional    head/body row separator, which uses '='), and column separators use '|'.    Passing the above table to the `parse()` method will result in the    following data structure::        ([24, 12, 10, 10],         [[(0, 0, 1, ['Header row, column 1']),           (0, 0, 1, ['Header 2']),           (0, 0, 1, ['Header 3']),           (0, 0, 1, ['Header 4'])]],         [[(0, 0, 3, ['body row 1, column 1']),           (0, 0, 3, ['column 2']),           (0, 0, 3, ['column 3']),           (0, 0, 3, ['column 4'])],          [(0, 0, 5, ['body row 2']),           (0, 2, 5, ['Cells may span columns.']),           None,           None],          [(0, 0, 7, ['body row 3']),           (1, 0, 7, ['Cells may', 'span rows.', '']),           (1, 1, 7, ['- Table cells', '- contain', '- body elements.']),           None],          [(0, 0, 9, ['body row 4']), None, None, None]])    The first item is a list containing column widths (colspecs). The second    item is a list of head rows, and the third is a list of body rows. Each    row contains a list of cells. Each cell is either None (for a cell unused    because of another cell's span), or a tuple. A cell tuple contains four    items: the number of extra rows used by the cell in a vertical span    (morerows); the number of extra columns used by the cell in a horizontal    span (morecols); the line offset of the first line of the cell contents;    and the cell contents, a list of lines of text.    """    head_body_separator_pat = re.compile(r'\+=[=+]+=\+ *$')    def setup(self, block):        self.block = block[:]           # make a copy; it may be modified        self.block.disconnect()         # don't propagate changes to parent        self.bottom = len(block) - 1        self.right = len(block[0]) - 1        self.head_body_sep = None        self.done = [-1] * len(block[0])        self.cells = []        self.rowseps = {0: [0]}        self.colseps = {0: [0]}    def parse_table(self):        """        Start with a queue of upper-left corners, containing the upper-left        corner of the table itself. Trace out one rectangular cell, remember        it, and add its upper-right and lower-left corners to the queue of        potential upper-left corners of further cells. Process the queue in        top-to-bottom order, keeping track of how much of each text column has        been seen.        We'll end up knowing all the row and column boundaries, cell positions        and their dimensions.        """        corners = [(0, 0)]        while corners:            top, left = corners.pop(0)            if top == self.bottom or left == self.right \                  or top <= self.done[left]:                continue            result = self.scan_cell(top, left)            if not result:                continue            bottom, right, rowseps, colseps = result            update_dict_of_lists(self.rowseps, rowseps)            update_dict_of_lists(self.colseps, colseps)            self.mark_done(top, left, bottom, right)            cellblock = self.block.get_2D_block(top + 1, left + 1,                                                bottom, right)            cellblock.disconnect()      # lines in cell can't sync with parent            cellblock.replace(self.double_width_pad_char, '')            self.cells.append((top, left, bottom, right, cellblock))            corners.extend([(top, right), (bottom, left)])            corners.sort()        if not self.check_parse_complete():            raise TableMarkupError('Malformed table; parse incomplete.')    def mark_done(self, top, left, bottom, right):        """For keeping track of how much of each text column has been seen."""        before = top - 1        after = bottom - 1        for col in range(left, right):            assert self.done[col] == before            self.done[col] = after    def check_parse_complete(self):        """Each text column should have been completely seen."""        last = self.bottom - 1        for col in range(self.right):            if self.done[col] != last:                return None        return 1    def scan_cell(self, top, left):        """Starting at the top-left corner, start tracing out a cell."""        assert self.block[top][left] == '+'        result = self.scan_right(top, left)        return result    def scan_right(self, top, left):        """        Look for the top-right corner of the cell, and make note of all column        boundaries ('+').        """        colseps = {}        line = self.block[top]        for i in range(left + 1, self.right + 1):            if line[i] == '+':                colseps[i] = [top]                result = self.scan_down(top, left, i)                if result:                    bottom, rowseps, newcolseps = result                    update_dict_of_lists(colseps, newcolseps)                    return bottom, i, rowseps, colseps            elif line[i] != '-':                return None        return None    def scan_down(self, top, left, right):        """        Look for the bottom-right corner of the cell, making note of all row        boundaries.        """        rowseps = {}        for i in range(top + 1, self.bottom + 1):            if self.block[i][right] == '+':                rowseps[i] = [right]                result = self.scan_left(top, left, i, right)                if result:                    newrowseps, colseps = result                    update_dict_of_lists(rowseps, newrowseps)                    return i, rowseps, colseps            elif self.block[i][right] != '|':                return None        return None    def scan_left(self, top, left, bottom, right):        """        Noting column boundaries, look for the bottom-left corner of the cell.        It must line up with the starting point.        """        colseps = {}        line = self.block[bottom]        for i in range(right - 1, left, -1):            if line[i] == '+':                colseps[i] = [bottom]            elif line[i] != '-':                return None        if line[left] != '+':            return None        result = self.scan_up(top, left, bottom, right)        if result is not None:            rowseps = result            return rowseps, colseps        return None    def scan_up(self, top, left, bottom, right):        """        Noting row boundaries, see if we can return to the starting point.        """

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
久久精品国产亚洲a| 亚洲精品中文字幕乱码三区| 久久不见久久见免费视频1| 欧美成人午夜电影| 韩国一区二区在线观看| 26uuuu精品一区二区| 国产成人在线免费观看| 国产精品国产三级国产有无不卡| 97aⅴ精品视频一二三区| 亚洲自拍偷拍九九九| 日韩一区二区三区av| 国产精品自在欧美一区| 亚洲视频一区在线| 欧美区一区二区三区| 国产一区二区三区电影在线观看| 欧美激情在线一区二区三区| 欧美专区日韩专区| 精品一二线国产| 亚洲精品成人天堂一二三| 91精品国产综合久久久久久漫画 | 99精品视频一区| 亚洲一区二区欧美日韩| www成人在线观看| 色天天综合久久久久综合片| 男男成人高潮片免费网站| 欧美激情在线观看视频免费| 欧美日韩国产美女| 国产成人精品三级| 天堂影院一区二区| 18欧美亚洲精品| 日韩欧美成人激情| 色欧美88888久久久久久影院| 蜜臀久久久久久久| 亚洲人成人一区二区在线观看| 精品少妇一区二区| 欧美自拍丝袜亚洲| 成人动漫av在线| 麻豆中文一区二区| 一区二区三区国产豹纹内裤在线| 亚洲精品一区二区三区香蕉 | 欧美性三三影院| 国产精品18久久久久久久网站| 一区二区三区中文在线| 国产性天天综合网| 日韩欧美中文字幕制服| 91久久一区二区| 国产激情91久久精品导航| 日韩国产高清在线| 亚洲精品视频免费看| 国产欧美精品国产国产专区 | 亚洲激情中文1区| 国产日韩欧美精品在线| 日韩一区二区三区免费观看| 精品视频在线免费观看| av亚洲精华国产精华精华| 国产一区二区三区蝌蚪| 蜜桃视频在线观看一区| 天天免费综合色| 亚洲一区二区在线播放相泽| 中文字幕一区日韩精品欧美| 国产亚洲美州欧州综合国| 欧美videossexotv100| 制服丝袜亚洲播放| 欧美军同video69gay| 在线中文字幕一区二区| 91蜜桃网址入口| 99在线热播精品免费| 成人免费高清视频| 国产成人无遮挡在线视频| 国产一区二区看久久| 国产一区二区三区在线观看精品| 秋霞午夜av一区二区三区| 欧美aaaaa成人免费观看视频| 天天综合天天做天天综合| 午夜欧美视频在线观看| 午夜精品久久久久久不卡8050| 亚洲成年人网站在线观看| 亚洲国产成人精品视频| 亚洲国产你懂的| 亚洲va欧美va天堂v国产综合| 亚洲一区在线观看网站| 亚洲国产日韩在线一区模特| 亚洲成人你懂的| 蜜臀久久久99精品久久久久久| 日韩电影在线观看电影| 久久精品国产精品青草| 久久国产免费看| 国产精品亚洲第一区在线暖暖韩国 | 国产精品不卡一区| 成人免费在线视频观看| 亚洲精品免费视频| 五月天丁香久久| 激情伊人五月天久久综合| 国产精品一区二区91| 成人一级视频在线观看| 91丝袜国产在线播放| 欧美网站一区二区| 日韩一级片在线播放| 久久青草国产手机看片福利盒子 | 91美女片黄在线| 欧美日韩一区三区四区| 精品国产一区二区三区四区四 | 香蕉久久夜色精品国产使用方法| 日韩精品电影一区亚洲| 国产乱人伦偷精品视频不卡| 91亚洲男人天堂| 欧美一级日韩免费不卡| 欧美国产一区视频在线观看| 一区二区三区在线播放| 免费人成在线不卡| 99久精品国产| 日韩亚洲国产中文字幕欧美| 欧美国产激情二区三区 | 欧美一级夜夜爽| 亚州成人在线电影| 国产福利精品导航| 在线日韩国产精品| 国产亚洲精品超碰| 五月天网站亚洲| 成人深夜在线观看| 欧美剧在线免费观看网站| 国产日本欧洲亚洲| 免费精品视频在线| 色就色 综合激情| 欧美精品一区二区三区高清aⅴ| 日韩一区中文字幕| 国产一区二区按摩在线观看| 日本国产一区二区| 欧美国产日韩亚洲一区| 婷婷综合久久一区二区三区| 91片在线免费观看| 国产日韩精品一区二区三区| 日韩国产欧美在线观看| 91在线观看免费视频| 国产亚洲污的网站| 奇米一区二区三区| 欧美在线影院一区二区| 中文字幕第一区二区| 韩国v欧美v亚洲v日本v| 欧美日韩国产小视频在线观看| 国产精品久久777777| 国产乱码字幕精品高清av | 一区二区久久久久久| 成人av在线网站| 精品国产百合女同互慰| 性做久久久久久久久| 91福利小视频| 《视频一区视频二区| 粗大黑人巨茎大战欧美成人| 精品久久久久久久一区二区蜜臀| 亚洲成人av中文| 色哟哟一区二区| 中文字幕一区二区三| 国产成人自拍网| 久久久久久久久久久久久久久99| 日本不卡123| 日韩西西人体444www| 日韩精品视频网站| 欧美日韩aaaaa| 视频一区二区三区在线| 欧美男男青年gay1069videost | 日韩免费看的电影| 日韩 欧美一区二区三区| 欧美精品国产精品| 日日夜夜免费精品视频| 欧美二区三区91| 肉肉av福利一精品导航| 日韩一区二区三区四区五区六区| 午夜精品久久久久久不卡8050| 欧美三级资源在线| 日韩在线卡一卡二| 欧美成人福利视频| 精品一区二区免费在线观看| 国产亚洲综合在线| a级精品国产片在线观看| 亚洲男人的天堂在线观看| 色婷婷久久一区二区三区麻豆| 一级精品视频在线观看宜春院 | 成人久久久精品乱码一区二区三区| 精品国产乱码久久久久久1区2区| 国产一区二区三区免费在线观看 | 国产精品久久久久aaaa| 91视视频在线观看入口直接观看www| 亚洲天堂av老司机| 欧美日韩在线亚洲一区蜜芽| 日韩电影免费一区| 久久久国产一区二区三区四区小说| 国产91精品精华液一区二区三区| 中文字幕av一区二区三区高| 亚洲精品一区二区在线观看| 高清av一区二区| 亚洲线精品一区二区三区八戒| 7777精品伊人久久久大香线蕉| 麻豆极品一区二区三区| 国产精品天干天干在观线| 91视频一区二区| 美女视频黄a大片欧美| 国产精品久久久久久久久久免费看| 91精品办公室少妇高潮对白| 日本不卡一区二区三区|