Merge pull request #3680 from jdufresne/isinstance

Merge multiple isinstance() calls to one
This commit is contained in:
Hugo 2019-03-02 19:25:47 +02:00 committed by GitHub
commit b84ab5223d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 3 deletions

View File

@ -28,7 +28,7 @@ VERBOSE = 0
def _isconstant(v):
return isinstance(v, int) or isinstance(v, float)
return isinstance(v, (int, float))
class _Operand(object):

View File

@ -356,8 +356,7 @@ def pdf_repr(x):
return b"false"
elif x is None:
return b"null"
elif (isinstance(x, PdfName) or isinstance(x, PdfDict) or
isinstance(x, PdfArray) or isinstance(x, PdfBinary)):
elif isinstance(x, (PdfName, PdfDict, PdfArray, PdfBinary)):
return bytes(x)
elif isinstance(x, int):
return str(x).encode("us-ascii")