diff --git a/.github/workflows/on_pull_request.yaml b/.github/workflows/on_pull_request.yaml
index c6111da58..924ab3266 100644
--- a/.github/workflows/on_pull_request.yaml
+++ b/.github/workflows/on_pull_request.yaml
@@ -16,11 +16,16 @@ jobs:
python-version: 3.10.6
cache: pip
cache-dependency-path: requirements.txt
- - name: run-lint
+ - name: run-ruff
run: |
python -m pip install --upgrade pip
- pip install pylint
- pylint $(git ls-files '*.py')
+ pip install ruff
+ ruff .
+ # - name: run-pylint
+ # run: |
+ # python -m pip install --upgrade pip
+ # pip install pylint
+ # pylint $(git ls-files '*.py')
- name: test-startup
run: |
export COMMANDLINE_ARGS="--debug --test"
diff --git a/.pylintrc b/.pylintrc
index d4ff272de..68a2f4093 100644
--- a/.pylintrc
+++ b/.pylintrc
@@ -13,6 +13,8 @@ ignore-paths=^repositories/.*$,
^extensions/.*$,
^extensions-builtin/.*$,
/usr/lib/.*$,
+ ^modules/dml/.*$,
+ ^modules/models/diffusion/.*$,
ignore-patterns=
ignored-modules=
jobs=0
diff --git a/installer.py b/installer.py
index 1e07c5922..c48d28fbb 100644
--- a/installer.py
+++ b/installer.py
@@ -381,7 +381,7 @@ def check_modified_files():
try:
res = git('status --porcelain')
files = [x[2:].strip() for x in res.split('\n')]
- files = [x for x in files if len(x) > 0 and (not x.startswith('extensions')) and (not x.startswith('wiki')) and (not x.endswith('.json')) and (not '.log' in x)]
+ files = [x for x in files if len(x) > 0 and (not x.startswith('extensions')) and (not x.startswith('wiki')) and (not x.endswith('.json')) and ('.log' not in x)]
if len(files) > 0:
log.warning(f'Modified files: {files}')
except Exception:
diff --git a/modules/extras.py b/modules/extras.py
index a26908cf5..f13b61306 100644
--- a/modules/extras.py
+++ b/modules/extras.py
@@ -350,7 +350,7 @@ def run_modelconvert(model, checkpoint_formats, precision, conv_type, custom_nam
ema_k = "___"
try:
ema_k = "model_ema." + k[6:].replace(".", "")
- except:
+ except Exception:
pass
if ema_k in state_dict:
_hf(k, state_dict[ema_k])
diff --git a/modules/processing.py b/modules/processing.py
index 3d276e290..6d05beed4 100644
--- a/modules/processing.py
+++ b/modules/processing.py
@@ -239,7 +239,7 @@ class StableDiffusionProcessing:
pass
def sample(self, conditioning, unconditional_conditioning, seeds, subseeds, subseed_strength, prompts):
- raise NotImplementedError()
+ raise NotImplementedError
def close(self):
self.sampler = None # pylint: disable=attribute-defined-outside-init
diff --git a/modules/safe.py b/modules/safe.py
index c68e87aaa..b3b98897e 100644
--- a/modules/safe.py
+++ b/modules/safe.py
@@ -6,7 +6,7 @@ import zipfile
import re
import torch
-import numpy
+import numpy as np
import _codecs
# PyTorch 1.13 and later have _TypedStorage renamed to TypedStorage
@@ -43,9 +43,9 @@ class RestrictedUnpickler(pickle.Unpickler):
if module == 'torch.nn.modules.container' and name in ['ParameterDict']:
return getattr(torch.nn.modules.container, name)
if module == 'numpy.core.multiarray' and name in ['scalar', '_reconstruct']:
- return getattr(numpy.core.multiarray, name)
+ return getattr(np.core.multiarray, name)
if module == 'numpy' and name in ['dtype', 'ndarray']:
- return getattr(numpy, name)
+ return getattr(np, name)
if module == '_codecs' and name == 'encode':
return encode
if module == "pytorch_lightning.callbacks" and name == 'model_checkpoint':
diff --git a/modules/scripts.py b/modules/scripts.py
index 1ee340b44..55baa562b 100644
--- a/modules/scripts.py
+++ b/modules/scripts.py
@@ -33,7 +33,7 @@ class Script:
def title(self):
"""this function should return the title of the script. This is what will be displayed in the dropdown menu."""
- raise NotImplementedError()
+ raise NotImplementedError
def ui(self, is_img2img):
"""this function should create gradio UI elements. See https://gradio.app/docs/#components
diff --git a/modules/ui.py b/modules/ui.py
index 5b74223b0..d90c12d1a 100644
--- a/modules/ui.py
+++ b/modules/ui.py
@@ -556,9 +556,9 @@ def create_ui():
with gr.TabItem('Batch', id='batch', elem_id="img2img_batch_tab") as tab_batch:
hidden = '
Disabled when launched with --hide-ui-dir-config.' if modules.shared.cmd_opts.hide_ui_dir_config else ''
gr.HTML(
- "
Process images in a directory on the same machine where the server is running." +
- "
Use an empty output directory to save pictures normally instead of writing to the output directory." +
- "
Add inpaint batch mask directory to enable inpaint batch processing."
+ "
Process images in a directory on the same machine where the server is running" +
+ "
Use an empty output directory to save pictures normally instead of writing to the output directory" +
+ "
Add inpaint batch mask directory to enable inpaint batch processing"
f"{hidden}