fixed up tests
This commit is contained in:
1 parent
4653b53a6c
commit
5af06a3f1e
3 files changed
+24
-24
No files matched your search
@@ -40,7 +40,7 @@ class PDFStream:
|
||||
self.dl: Optional[int] = dl
|
||||
|
||||
@classmethod
|
||||
def from_pdfdict(cls, offset: int, item: PDFObject) -> None:
|
||||
def from_pdfdict(cls, offset: int, item: PDFObject) -> "PDFStream":
|
||||
if not isinstance(item, PDFDictionary):
|
||||
raise ParserError(f"Cannot initilize a pdfstream with {type(item)}")
|
||||
data = item.to_python()
|
||||
|
||||
@@ -1,24 +1,24 @@
|
||||
import io
|
||||
from pdfmajor.streambuffer import BufferStream
|
||||
from .objects.stream import PDFStream
|
||||
from .fliters import process_filters_on_data
|
||||
# import io
|
||||
# from pdfmajor.streambuffer import BufferStream
|
||||
# from .objects.stream import PDFStream
|
||||
# from .fliters import process_filters_on_data
|
||||
|
||||
|
||||
# class PDFStreamPasrser(PDFParser):
|
||||
# def __init__(
|
||||
# self,
|
||||
# stream: PDFStream,
|
||||
# buffer: BufferStream,
|
||||
# strict: bool = True,
|
||||
# ) -> None:
|
||||
# cur_pos = buffer.tell()
|
||||
# buffer.seek(stream.offset)
|
||||
# data = buffer.read(stream.length).data
|
||||
# buffer.seek(cur_pos)
|
||||
# data = process_filters_on_data(data, stream.filter, stream.decode_parms)
|
||||
# data = process_filters_on_data(data, stream.ffilter, stream.fdecode_parms)
|
||||
# self.stream = stream
|
||||
# super().__init__(
|
||||
# buffer=BufferStream(io.BytesIO(data), buffer_size=stream.length),
|
||||
# strict=strict,
|
||||
# )
|
||||
# # class PDFStreamPasrser(PDFParser):
|
||||
# # def __init__(
|
||||
# # self,
|
||||
# # stream: PDFStream,
|
||||
# # buffer: BufferStream,
|
||||
# # strict: bool = True,
|
||||
# # ) -> None:
|
||||
# # cur_pos = buffer.tell()
|
||||
# # buffer.seek(stream.offset)
|
||||
# # data = buffer.read(stream.length).data
|
||||
# # buffer.seek(cur_pos)
|
||||
# # data = process_filters_on_data(data, stream.filter, stream.decode_parms)
|
||||
# # data = process_filters_on_data(data, stream.ffilter, stream.fdecode_parms)
|
||||
# # self.stream = stream
|
||||
# # super().__init__(
|
||||
# # buffer=BufferStream(io.BytesIO(data), buffer_size=stream.length),
|
||||
# # strict=strict,
|
||||
# # )
|
||||
+1
-1
@@ -352,7 +352,7 @@ func/a/b{(c)do*}def
|
||||
TokenDictionary(start_loc=258, end_loc=260, value=TDictValue.OPEN),
|
||||
TokenName(start_loc=261, end_loc=265, value="foo"),
|
||||
TokenString(start_loc=266, end_loc=271, value="bar"),
|
||||
TokenDictionary(start_loc=272, end_loc=274, value=TDictValue.CLOSE),
|
||||
TokenDictionary(start_loc=273, end_loc=275, value=TDictValue.CLOSE),
|
||||
],
|
||||
)
|
||||
|
||||
|
||||
Reference in new issue
Block a user