mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-11-10 19:56:47 +03:00
Use single isinstance call for multiple types
This commit is contained in:
parent
f30eb38e31
commit
b2b8c833aa
|
@ -328,9 +328,7 @@ def pdf_repr(x):
|
|||
return b"null"
|
||||
elif isinstance(x, (PdfName, PdfDict, PdfArray, PdfBinary)):
|
||||
return bytes(x)
|
||||
elif isinstance(x, int):
|
||||
return str(x).encode("us-ascii")
|
||||
elif isinstance(x, float):
|
||||
elif isinstance(x, (int, float)):
|
||||
return str(x).encode("us-ascii")
|
||||
elif isinstance(x, time.struct_time):
|
||||
return b"(D:" + time.strftime("%Y%m%d%H%M%SZ", x).encode("us-ascii") + b")"
|
||||
|
|
|
@ -39,7 +39,7 @@ def cmd_rmdir(path):
|
|||
def cmd_nmake(makefile=None, target="", params=None):
|
||||
if params is None:
|
||||
params = ""
|
||||
elif isinstance(params, list) or isinstance(params, tuple):
|
||||
elif isinstance(params, (list, tuple)):
|
||||
params = " ".join(params)
|
||||
else:
|
||||
params = str(params)
|
||||
|
@ -58,7 +58,7 @@ def cmd_nmake(makefile=None, target="", params=None):
|
|||
def cmd_cmake(params=None, file="."):
|
||||
if params is None:
|
||||
params = ""
|
||||
elif isinstance(params, list) or isinstance(params, tuple):
|
||||
elif isinstance(params, (list, tuple)):
|
||||
params = " ".join(params)
|
||||
else:
|
||||
params = str(params)
|
||||
|
|
Loading…
Reference in New Issue
Block a user