Exemplo n.º 1
0
 def to_ContentObject(self):
     """Returns 2dx as a ContentObject.  It's .io contents
     are cStringIO buffer.
     """
     sio = self.to_StringIO()
     resref = self.co.resref
     res_type = 2017
     sio.seek(0, os.SEEK_END)
     size = sio.tell()
     return ContentObject(resref, res_type, sio, 0, size)
Exemplo n.º 2
0
    def __init__(self, source):
        if isinstance(source, str):
            source = ContentObject.from_file(source)
        elif not isinstance(source, ContentObject):
            raise ValueError("Unsupported source type %s!" % type(source))

        self.columns = []
        self.rows = []
        self.max = None
        self.newline = "\n"
        self.tlk_columns = None
        self.tlk_offset = None
        self.co = source
        self.description = None
        self.parse(source.get('r'))
Exemplo n.º 3
0
    def __init__(self, source):
        if isinstance(source, str):
            source = ContentObject.from_file(source)
        elif not isinstance(source, ContentObject):
            raise ValueError("Unsupported source type %s!" % type(source))

        self.columns = []
        self.rows = []
        self.max = None
        self.newline = "\n"
        self.default = None
        self.co = source
        data = source.get()
        if not isinstance(data, str):
            data = data.decode(get_encoding())
        self.parse(data)
Exemplo n.º 4
0
    def __init__(self, source):
        if isinstance(source, str):
            source = ContentObject.from_file(source)
        elif not isinstance(source, ContentObject):
            raise ValueError("Unsupported source type %s!" % type(source))

        self.columns = []
        self.rows = []
        self.max = None
        self.newline = "\n"
        self.default = None
        self.co = source
        data = source.get()
        if not isinstance(data, str):
            data = data.decode(get_encoding())
        self.parse(data)