diff --git a/.pylintrc b/.pylintrc index 5dc22b99c..e483254dc 100644 --- a/.pylintrc +++ b/.pylintrc @@ -2,6 +2,7 @@ analyse-fallback-blocks=no clear-cache-post-run=no extension-pkg-allow-list= +prefer-stubs=yes extension-pkg-whitelist= fail-on= fail-under=10 @@ -69,11 +70,11 @@ ignore-patterns=.*test*.py$, .*_model_arch.py*, .*_model_arch_v2.py$, ignored-modules= -jobs=0 +jobs=8 limit-inference-results=100 load-plugins= -persistent=yes -py-version=3.9 +persistent=no +py-version=3.10 recursive=no source-roots= unsafe-load-any-extension=no @@ -207,6 +208,8 @@ disable=abstract-method, unnecessary-lambda-assigment, unnecessary-lambda, unused-wildcard-import, + unpacking-non-sequence, + unsubscriptable-object, useless-return, use-dict-literal, use-symbolic-message-instead, diff --git a/modules/masking.py b/modules/masking.py index 5b3319df0..4fc54adaa 100644 --- a/modules/masking.py +++ b/modules/masking.py @@ -339,7 +339,7 @@ def outpaint(input_image: Image.Image, outpaint_type: str = 'Edge'): debug(f'Run outpaint: fn={fn}') # pylint: disable=protected-access image = cv2.cvtColor(np.array(input_image), cv2.COLOR_RGB2BGR) h0, w0 = image.shape[:2] - empty = (image == 0).all(axis=2) + empty = (image == 0).all(axis=2) # pylint: disable=no-member y0, x0 = np.where(~empty) # non empty x1, x2 = min(x0), max(x0) y1, y2 = min(y0), max(y0) diff --git a/modules/postprocess/pixelart.py b/modules/postprocess/pixelart.py index d9ce620ee..90b9cb1ac 100644 --- a/modules/postprocess/pixelart.py +++ b/modules/postprocess/pixelart.py @@ -55,7 +55,7 @@ def edge_detect_for_pixelart(image: PipelineImageInput, image_weight: float = 1. block_height = height // block_size block_width = width // block_size - min_pool = -torch.nn.functional.max_pool2d(-new_image, block_size, 1, block_size//2, 1, False, False) + min_pool = 0 - torch.nn.functional.max_pool2d(-new_image, block_size, 1, block_size//2, 1, False, False) min_pool = min_pool[:, :, :height, :width] greyscale = (new_image[:,0,:,:] * 0.299).add_(new_image[:,1,:,:], alpha=0.587).add_(new_image[:,2,:,:], alpha=0.114) diff --git a/modules/sdnq/quantizer.py b/modules/sdnq/quantizer.py index aa539af02..dec88e3a9 100644 --- a/modules/sdnq/quantizer.py +++ b/modules/sdnq/quantizer.py @@ -482,7 +482,7 @@ class SDNQQuantizer(DiffusersQuantizer, HfQuantizer): param_value: "torch.Tensor", param_name: str, return_true: bool = True, - *args, **kwargs, # pylint: disable=unused-argument + *args, **kwargs, # pylint: disable=unused-argument,keyword-arg-before-vararg ): if return_true: return True diff --git a/pipelines/model_hyimage.py b/pipelines/model_hyimage.py index 86620d326..501dd9699 100644 --- a/pipelines/model_hyimage.py +++ b/pipelines/model_hyimage.py @@ -42,7 +42,7 @@ def load_hyimage3(checkpoint_info, diffusers_load_config={}): # pylint: disable= sd_models.hf_auth_check(checkpoint_info) shared.log.debug(f'Load model: type=HunyuanImage3 repo="{repo_id}" offload={shared.opts.diffusers_offload_mode} dtype={devices.dtype}') - from sdnq import SDNQConfig # import sdnq to register it into transformers + from sdnq import SDNQConfig # pylint: disable=unused-import pipe = transformers.AutoModelForCausalLM.from_pretrained( repo_id, attn_implementation="sdpa", diff --git a/scripts/nudenet/nudenet.py b/scripts/nudenet/nudenet.py index 06ab7db25..008ccaa97 100755 --- a/scripts/nudenet/nudenet.py +++ b/scripts/nudenet/nudenet.py @@ -150,8 +150,8 @@ class NudeDetector: return background if fg_channels < 4: # make sure that overlay is rgba log.warning('NudeNet overlay image does not have alpha channel') - foreground = cv2.cvtColor(foreground, cv2.COLOR_RGB2RGBA) - foreground[:, :, 3] = cv2.cvtColor(foreground, cv2.COLOR_BGR2GRAY) + foreground_color = cv2.cvtColor(foreground, cv2.COLOR_RGB2RGBA) + foreground[:, :, 3] = cv2.cvtColor(foreground_color, cv2.COLOR_BGR2GRAY) fg_h, fg_w, fg_channels = foreground.shape if x_offset is None: # center by default x_offset = (bg_w - fg_w) // 2