mirror of
https://github.com/comfyanonymous/ComfyUI.git
synced 2026-01-11 23:00:51 +08:00
Fix pylint issues
This commit is contained in:
parent
51bb02e96b
commit
2528a76a05
@ -637,6 +637,8 @@ class SaveImagesResponse(CustomNode):
|
|||||||
image_as_numpy_array: np.ndarray = image.float().cpu().numpy()
|
image_as_numpy_array: np.ndarray = image.float().cpu().numpy()
|
||||||
|
|
||||||
cv_save_options = []
|
cv_save_options = []
|
||||||
|
image_as_pil: PIL.Image = None
|
||||||
|
additional_args = {}
|
||||||
if bits == 8:
|
if bits == 8:
|
||||||
image_scaled = np.ascontiguousarray(np.clip(image_as_numpy_array * 255, 0, 255).astype(np.uint8))
|
image_scaled = np.ascontiguousarray(np.clip(image_as_numpy_array * 255, 0, 255).astype(np.uint8))
|
||||||
|
|
||||||
@ -672,7 +674,7 @@ class SaveImagesResponse(CustomNode):
|
|||||||
mut_srgb_to_linear(image_as_numpy_array[:, :, :3])
|
mut_srgb_to_linear(image_as_numpy_array[:, :, :3])
|
||||||
image_scaled = image_as_numpy_array.astype(np.float32)
|
image_scaled = image_as_numpy_array.astype(np.float32)
|
||||||
if bits == 16:
|
if bits == 16:
|
||||||
cv_save_options = [cv2.IMWRITE_EXR_TYPE, cv2.IMWRITE_EXR_TYPE_HALF]
|
cv_save_options = [cv2.IMWRITE_EXR_TYPE, cv2.IMWRITE_EXR_TYPE_HALF] # pylint: disable=no-member
|
||||||
else:
|
else:
|
||||||
image_scaled = np.clip(image_as_numpy_array * 65535, 0, 65535).astype(np.uint16)
|
image_scaled = np.clip(image_as_numpy_array * 65535, 0, 65535).astype(np.uint16)
|
||||||
|
|
||||||
@ -724,7 +726,7 @@ class SaveImagesResponse(CustomNode):
|
|||||||
with fsspec.open(uri, mode="wb", **fsspec_kwargs) as f:
|
with fsspec.open(uri, mode="wb", **fsspec_kwargs) as f:
|
||||||
image_as_pil.save(f, format=save_format, **additional_args)
|
image_as_pil.save(f, format=save_format, **additional_args)
|
||||||
else:
|
else:
|
||||||
_, img_encode = cv2.imencode(f'.{save_format}', image_scaled, cv_save_options)
|
_, img_encode = cv2.imencode(f'.{save_format}', image_scaled, cv_save_options) # pylint: disable=no-member
|
||||||
|
|
||||||
with fsspec.open(uri, mode="wb", **fsspec_kwargs) as f:
|
with fsspec.open(uri, mode="wb", **fsspec_kwargs) as f:
|
||||||
f.write(img_encode.tobytes())
|
f.write(img_encode.tobytes())
|
||||||
@ -753,7 +755,7 @@ class SaveImagesResponse(CustomNode):
|
|||||||
if save_method == 'pil':
|
if save_method == 'pil':
|
||||||
image_as_pil.save(local_path, format=save_format, **additional_args)
|
image_as_pil.save(local_path, format=save_format, **additional_args)
|
||||||
else:
|
else:
|
||||||
cv2.imwrite(local_path, image_scaled)
|
cv2.imwrite(local_path, image_scaled) # pylint: disable=no-member
|
||||||
|
|
||||||
img_item: SaveNodeResultWithName = {
|
img_item: SaveNodeResultWithName = {
|
||||||
"abs_path": str(abs_path),
|
"abs_path": str(abs_path),
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user