# Path: common/utils.py
# def read_file(filename):
# def write_file(filename, text):
# def save_obj(filename, data):
# def load_obj(filename):
# def sha1(filename):
# def write_sha1(sha1, filename):
# def url_opener():
# def copy_file_from_url(url, out_file, expect_sha1 = None, max_retry = 4):
# def compress_file_data(out_filename, data, compress_type):
# def compress_file(out_filename, in_filename, compress_type):
# def uncompress_file(filename, compress_type):
# def _retry_on_eintr(func, *args):
# def safe_read(fd):
# def safe_write(fd, text):
# def print_traceback(*kwargs):
# def readline_backward(filename, buf_size=8192):


import sys
import re
import xml.etree.ElementTree as etree
import subprocess
import os
import resource
from common import utils
        return self

    # compatible with hocr bbox string
    def __str__(self):
        return str(self.x1) + " " + str(self.y1) + " " + str(self.x2) + " " + str(self.y2)

class OcrPage:
    def __init__(self):
        self.page_buffer = ''
        self.logical_page_id = 1
        self.physical_page_id = 0

    def add_param(self, e):
        if e.attrib.get('name', '') == 'PAGE':
            self.page_name = e.attrib['value']

    def grow_bbox(self, bbox1, bbox2):
        bbox1 |= bbox2

    def start_page(self, e):
        self.width = int(e.attrib['width'])
        self.height = int(e.attrib['height'])
        self.page_name = ''
        self.column_box = Bbox(self.width, self.height, 0, 0)
        self.region_box = Bbox(self.width, self.height, 0, 0)
        self.para_box = Bbox(self.width, self.height, 0, 0)
        self.line_box = Bbox(self.width, self.height, 0, 0)
        self.word_box = Bbox(self.width, self.height, 0, 0)
        self.char_box = Bbox(self.width, self.height, 0, 0)
        self.column_id = 1

# Path: common/utils.py
# def read_file(filename):
# def write_file(filename, text):
# def save_obj(filename, data):
# def load_obj(filename):
# def sha1(filename):
# def write_sha1(sha1, filename):
# def url_opener():
# def copy_file_from_url(url, out_file, expect_sha1 = None, max_retry = 4):
# def compress_file_data(out_filename, data, compress_type):
# def compress_file(out_filename, in_filename, compress_type):
# def uncompress_file(filename, compress_type):
# def _retry_on_eintr(func, *args):
# def safe_read(fd):
# def safe_write(fd, text):
# def print_traceback(*kwargs):
# def readline_backward(filename, buf_size=8192):


# Path: ocr/djvu_text_to_hocr.py
import sys
import re
import xml.etree.ElementTree as etree
import subprocess
import os
import resource
from common import utils

        return self

    # compatible with hocr bbox string
    def __str__(self):
        return str(self.x1) + " " + str(self.y1) + " " + str(self.x2) + " " + str(self.y2)

class OcrPage:
    def __init__(self):
        self.page_buffer = ''
        self.logical_page_id = 1
        self.physical_page_id = 0

    def add_param(self, e):
        if e.attrib.get('name', '') == 'PAGE':
            self.page_name = e.attrib['value']

    def grow_bbox(self, bbox1, bbox2):
        bbox1 |= bbox2

    def start_page(self, e):
        self.width = int(e.attrib['width'])
        self.height = int(e.attrib['height'])
        self.page_name = ''
        self.column_box = Bbox(self.width, self.height, 0, 0)
        self.region_box = Bbox(self.width, self.height, 0, 0)
        self.para_box = Bbox(self.width, self.height, 0, 0)
        self.line_box = Bbox(self.width, self.height, 0, 0)
        self.word_box = Bbox(self.width, self.height, 0, 0)
        self.char_box = Bbox(self.width, self.height, 0, 0)
        self.column_id = 1

        self.region_id = 1