ran flake

This commit is contained in:
ari committed 2020-10-30 17:15:31 -04:00
1 parent 1829277245
commit df50637e70
12 files changed
+13 -49

No files matched your search

+4 -2
View File
@@ -10,13 +10,15 @@ clean:
rm -rf *.egg-info
lint:
autoflake --remove-all-unused-imports -r -i pdfmajor
autoflake --remove-all-unused-imports -r -i tests
isort pdfmajor
black pdfmajor
bandit -r pdfmajor
mypy pdfmajor
isort tests
black tests
mypy pdfmajor
mypy tests
bandit -r pdfmajor
test:
./venv/bin/python -m unittest discover tests
+1 -1
View File
@@ -1,4 +1,4 @@
from typing import Optional, Union
from typing import Optional
from pdfmajor.lexer.exceptions import LexerEOF
from pdfmajor.lexer.regex import END_KEYWORD
+1 -23
View File
@@ -1,6 +1,6 @@
from decimal import Decimal
from enum import Enum
from typing import Any, Generic, NamedTuple, TypeVar, Union
from typing import Any, Generic, TypeVar, Union
T = TypeVar("T")
@@ -42,72 +42,54 @@ class TokenComment(Token[bytes]):
Detection of this type of token can be found in PDF 1.7 spec section 7.2.3
"""
pass
class TokenKeyword(Token[bytes]):
"""Token representing PDF comments
Detection of this type of token can be found in PDF 1.7 spec
"""
pass
class TokenName(Token[str]):
"""Token representing literal name tokens
Detection of this type of token can be found in PDF 1.7 spec section 7.3.5
"""
pass
class TokenBoolean(Token[bool]):
"""Token representing PDF booleans
Detection of this type of token can be found in PDF 1.7 spec section 7.3.2
"""
pass
class TokenNull(Token[None]):
"""Token representing the PDF null object
Detection of this type of token can be found in PDF 1.7 spec section 7.3.9
"""
pass
class TokenString(Token[bytes]):
"""Token representing PDF literal string
Detection of this type of token can be found in PDF 1.7 spec section 7.3.4.2
"""
pass
class TokenHexString(Token[bytes]):
"""Token representing PDF hex strings
Detection of this type of token can be found in PDF 1.7 spec section 7.3.4.3
"""
pass
class TokenInteger(Token[int]):
"""Token representing PDF integers
Detection of this type of token can be found in PDF 1.7 spec section 7.3.3
"""
pass
class TokenReal(Token[Decimal]):
"""Token representing PDF decimals
Detection of this type of token can be found in PDF 1.7 spec section 7.3.3
"""
pass
TokenNumber = Union[TokenInteger, TokenReal]
TokenPrimitive = Union[
@@ -153,8 +135,6 @@ class TokenDictionary(Token[TDictValue]):
Detection of this type of token can be found in PDF 1.7 spec section 7.3.7
"""
pass
class TArrayValue(Enum):
OPEN = "["
@@ -166,8 +146,6 @@ class TokenArray(Token[TArrayValue]):
Detection of this type of token can be found in PDF 1.7 spec section 7.3.6
"""
pass
TokenComplexType = Union[TokenDictionary, TokenArray]
TokenComplexTypeVal = Union[TDictValue, TArrayValue]
+3 -13
View File
@@ -1,24 +1,14 @@
from typing import Iterator, List, NamedTuple, Type, Union
from typing import Iterator, Type, Union
from pdfmajor.lexer import iter_tokens
from pdfmajor.lexer.token import (
Token,
TokenComplexType,
TokenComplexTypeVal,
TokenKeyword,
)
from pdfmajor.lexer.token import TokenComplexType, TokenComplexTypeVal, TokenKeyword
from pdfmajor.streambuffer import BufferStream
from .exceptions import BrokenFile, EarlyStop, ParserError
from .objects.base import PDFContextualObject, PDFObject
from .objects.collections import PDFDictionary
from .objects.indirect import IndirectObject, ObjectRef
from .objects.primitives import (
PDFInteger,
PDFNull,
PDFPrimitiveObject,
get_obj_from_token_primitive,
)
from .objects.primitives import PDFInteger, PDFNull, PDFPrimitiveObject
from .state import ParsingState
from .stream.PDFStream import PDFStream
+1 -1
View File
@@ -1,4 +1,4 @@
from typing import Any, List, Optional, TypeVar, Union
from typing import Any, List, Optional
from pdfmajor.parser.objects.base import PDFObject
from pdfmajor.util import get_single_or_list, to_python, to_python_list
+1 -1
View File
@@ -1,4 +1,4 @@
from typing import Any, Callable, Generic, List, Optional, Type, TypeVar, Union
from typing import Any, List, Optional, Type, TypeVar, Union
from pdfmajor.parser.objects.base import PDFObject
-1
View File
@@ -1,7 +1,6 @@
from typing import Dict, Iterator, List, Optional, Tuple
from pdfmajor.parser import get_first_object
from pdfmajor.parser.objects.base import PDFObject
from pdfmajor.parser.objects.collections import PDFDictionary
from pdfmajor.parser.objects.indirect import IndirectObject, ObjectRef
from pdfmajor.parser.objects.primitives import PDFInteger
+1
View File
@@ -21,6 +21,7 @@ with open("README.md") as readme_file:
"black==20.8b1",
"bandit==1.6.2",
"isort==5.6.4",
"autoflake==1.4",
]
},
"description": "PDF parser",
-2
View File
@@ -1,4 +1,3 @@
from pathlib import Path
from unittest import TestCase
from pdfmajor.document.catalog import PDFDocumentCatalog
@@ -10,7 +9,6 @@ from pdfmajor.parser.objects.primitives import (
PDFName,
PDFString,
)
from tests.util import all_pdf_files
+1 -1
View File
@@ -1,6 +1,6 @@
from decimal import Decimal
from pathlib import Path
from typing import Any, Callable, List, Optional
from typing import Any, List
from unittest import TestCase
from pdfmajor.parser import iter_objects
-1
View File
@@ -1 +0,0 @@
from unittest import TestCase
-3
View File
@@ -1,11 +1,8 @@
from pathlib import Path
from typing import Dict, Tuple
from unittest import TestCase
from pdfmajor.streambuffer import BufferStream
from pdfmajor.xref.xref import XRefRow
from pdfmajor.xref.xrefdb import XRefDB
from tests.util import all_pdf_files