lint formatting

Signed-off-by: Vladimir Mandic <mandic00@live.com>
pull/4039/head
Vladimir Mandic 2025-07-05 17:13:31 -04:00
parent a5b77b8ee2
commit 8c676d0a61
130 changed files with 398 additions and 446 deletions

View File

@ -19,7 +19,7 @@ ci:
repos: repos:
# Standard hooks # Standard hooks
- repo: https://github.com/pre-commit/pre-commit-hooks - repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0 rev: v5.0.0
hooks: hooks:
- id: check-added-large-files - id: check-added-large-files
- id: check-case-conflict - id: check-case-conflict
@ -27,7 +27,6 @@ repos:
- id: check-symlinks - id: check-symlinks
- id: check-yaml - id: check-yaml
args: ["--allow-multiple-documents"] args: ["--allow-multiple-documents"]
- id: debug-statements
- id: end-of-file-fixer - id: end-of-file-fixer
- id: mixed-line-ending - id: mixed-line-ending
- id: trailing-whitespace - id: trailing-whitespace
@ -36,31 +35,3 @@ repos:
.*\.md| .*\.md|
.github/ISSUE_TEMPLATE/.*\.yml .github/ISSUE_TEMPLATE/.*\.yml
)$ )$
- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: 'v0.0.285'
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix]
- repo: local
hooks:
- id: pylint
name: pylint
entry: pylint
language: system
types: [python]
args: []
# Black, the code formatter, natively supports pre-commit
# - repo: https://github.com/psf/black
# rev: 23.7.0
# hooks:
# - id: black
# exclude: ^(docs)
# Changes tabs to spaces
# - repo: https://github.com/Lucas-C/pre-commit-hooks
# rev: v1.5.3
# hooks:
# - id: remove-tabs
# exclude: ^(docs)

View File

@ -55,7 +55,7 @@
- major refactoring of requirements and dependencies to unblock `numpy>=2.1.0` - major refactoring of requirements and dependencies to unblock `numpy>=2.1.0`
- patch `insightface` - patch `insightface`
- stronger lint rules - stronger lint rules
add separate `npm run lint`, `npm run todo`, `npm run test` macros add separate `npm run lint`, `npm run todo`, `npm run test`, `npm run format` macros
## Update for 2025-06-30 ## Update for 2025-06-30

View File

@ -234,4 +234,3 @@ def resnext101_32x8d(pretrained=True, **kwargs):
model = ResNet(Bottleneck, [3, 4, 23, 3], **kwargs) model = ResNet(Bottleneck, [3, 4, 23, 3], **kwargs)
return model return model

View File

@ -416,4 +416,3 @@ if __name__ == '__main__':
inputs = torch.ones(4,3,128,128) inputs = torch.ones(4,3,128,128)
out = net(inputs) out = net(inputs)
print(out.size()) print(out.size())

View File

@ -165,4 +165,3 @@ class MiDaSInference(nn.Module):
def forward(self, x): def forward(self, x):
prediction = self.model(x) prediction = self.model(x)
return prediction return prediction

View File

@ -339,4 +339,3 @@ class FeatureFusionBlock_custom(nn.Module):
output = self.out_conv(output) output = self.out_conv(output)
return output return output

View File

@ -106,4 +106,3 @@ class DPTDepthModel(DPT):
def forward(self, x): def forward(self, x):
return super().forward(x).squeeze(dim=1) return super().forward(x).squeeze(dim=1)

View File

@ -199,4 +199,3 @@ class Decoder(nn.Module):
return [out_res8, out_res4, out_res2, out_res1], \ return [out_res8, out_res4, out_res2, out_res1], \
[out_res8, samples_pred_res4, samples_pred_res2, samples_pred_res1], \ [out_res8, samples_pred_res4, samples_pred_res2, samples_pred_res1], \
[None, point_coords_res4, point_coords_res2, point_coords_res1] [None, point_coords_res4, point_coords_res2, point_coords_res1]

View File

@ -319,5 +319,3 @@ export now requires additional args mentioned in the export script (not needed i
2. TF ported models with 'SAME' padding will have the padding fixed at export time to the resolution used for export. Even though dynamic padding is supported in opset >= 11, I can't get it working. 2. TF ported models with 'SAME' padding will have the padding fixed at export time to the resolution used for export. Even though dynamic padding is supported in opset >= 11, I can't get it working.
3. ONNX optimize facility doesn't work reliably in PyTorch 1.6 / ONNX 1.7. Fortunately, the onnxruntime based inference is working very well now and includes on the fly optimization. 3. ONNX optimize facility doesn't work reliably in PyTorch 1.6 / ONNX 1.7. Fortunately, the onnxruntime based inference is working very well now and includes on the fly optimization.
3. ONNX / Caffe2 export/import frequently breaks with different PyTorch and ONNX version releases. Please check their respective issue trackers before filing issues here. 3. ONNX / Caffe2 export/import frequently breaks with different PyTorch and ONNX version releases. Please check their respective issue trackers before filing issues here.

View File

@ -133,5 +133,3 @@ def get_act_layer(name='relu'):
if use_jit and name in _ACT_FN_JIT: # jit scripted models should be okay for export/scripting if use_jit and name in _ACT_FN_JIT: # jit scripted models should be okay for export/scripting
return _ACT_LAYER_JIT[name] return _ACT_LAYER_JIT[name]
return _ACT_LAYER_DEFAULT[name] return _ACT_LAYER_DEFAULT[name]

View File

@ -98,5 +98,3 @@ class HardSigmoid(nn.Module):
def forward(self, x): def forward(self, x):
return hard_sigmoid(x, self.inplace) return hard_sigmoid(x, self.inplace)

View File

@ -49,4 +49,3 @@ def get_outdir(path, *paths, inc=False):
outdir = outdir_inc outdir = outdir_inc
os.makedirs(outdir) os.makedirs(outdir)
return outdir return outdir

View File

@ -155,5 +155,3 @@ def _build_sam(
state_dict = torch.load(f) state_dict = torch.load(f)
sam.load_state_dict(state_dict) sam.load_state_dict(state_dict)
return sam return sam

View File

@ -21,4 +21,3 @@
# SOFTWARE. # SOFTWARE.
# File author: Shariq Farooq Bhat # File author: Shariq Farooq Bhat

View File

@ -21,4 +21,3 @@
# SOFTWARE. # SOFTWARE.
# File author: Shariq Farooq Bhat # File author: Shariq Farooq Bhat

View File

@ -438,4 +438,3 @@ class FeatureFusionBlock_custom(nn.Module):
output = self.out_conv(output) output = self.out_conv(output)
return output return output

View File

@ -21,4 +21,3 @@
# SOFTWARE. # SOFTWARE.
# File author: Shariq Farooq Bhat # File author: Shariq Farooq Bhat

View File

@ -717,7 +717,7 @@ options_templates.update(options_section(('saving-paths', "Image Paths"), {
"outdir_extras_samples": OptionInfo("outputs/extras", 'Folder for processed images', component_args=hide_dirs, folder=True), "outdir_extras_samples": OptionInfo("outputs/extras", 'Folder for processed images', component_args=hide_dirs, folder=True),
"outdir_save": OptionInfo("outputs/save", "Folder for manually saved images", component_args=hide_dirs, folder=True), "outdir_save": OptionInfo("outputs/save", "Folder for manually saved images", component_args=hide_dirs, folder=True),
"outdir_video": OptionInfo("outputs/video", "Folder for videos", component_args=hide_dirs, folder=True), "outdir_video": OptionInfo("outputs/video", "Folder for videos", component_args=hide_dirs, folder=True),
"outdir_init_images": OptionInfo("outputs/init-images", "Folder for init images", component_args=hide_dirs, folder=True), "outdir_init_images": OptionInfo("outputs/inputs", "Folder for init images", component_args=hide_dirs, folder=True),
"outdir_sep_grids": OptionInfo("<h2>Grids</h2>", "", gr.HTML), "outdir_sep_grids": OptionInfo("<h2>Grids</h2>", "", gr.HTML),
"outdir_grids": OptionInfo("", "Grids folder", component_args=hide_dirs, folder=True), "outdir_grids": OptionInfo("", "Grids folder", component_args=hide_dirs, folder=True),

1
motd
View File

@ -1 +0,0 @@

View File

@ -22,7 +22,8 @@
"eslint": "eslint javascript/ extensions-builtin/sdnext-modernui/javascript/", "eslint": "eslint javascript/ extensions-builtin/sdnext-modernui/javascript/",
"ruff": ". venv/bin/activate && ruff check", "ruff": ". venv/bin/activate && ruff check",
"pylint": ". venv/bin/activate && pylint *.py modules/ pipelines/ scripts/ extensions-builtin/ | grep -v '^*'", "pylint": ". venv/bin/activate && pylint *.py modules/ pipelines/ scripts/ extensions-builtin/ | grep -v '^*'",
"lint": "npm run eslint && npm run ruff && npm run pylint | grep -v TODO", "format": ". venv/bin/activate && pre-commit run -a",
"lint": "npm run eslint && npm run format && npm run ruff && npm run pylint | grep -v TODO",
"todo": "npm run pylint | grep W0511 | awk -F'TODO ' '{print \"- \"$NF}' | sed 's/ (fixme)//g' | sort", "todo": "npm run pylint | grep W0511 | awk -F'TODO ' '{print \"- \"$NF}' | sed 's/ (fixme)//g' | sort",
"test": ". venv/bin/activate; python launch.py --debug --test" "test": ". venv/bin/activate; python launch.py --debug --test"
}, },

View File

@ -168,4 +168,3 @@ def crop_border(imgs, crop_border):
return [v[crop_border:-crop_border, crop_border:-crop_border, ...] for v in imgs] return [v[crop_border:-crop_border, crop_border:-crop_border, ...] for v in imgs]
else: else:
return imgs[crop_border:-crop_border, crop_border:-crop_border, ...] return imgs[crop_border:-crop_border, crop_border:-crop_border, ...]

View File

@ -26,8 +26,6 @@ voluptuous
yapf yapf
fasteners fasteners
orjson orjson
ruff
pylint
sqlalchemy sqlalchemy
invisible-watermark invisible-watermark
pi-heif pi-heif
@ -70,6 +68,11 @@ scikit-image
seam-carving seam-carving
sentencepiece sentencepiece
# lint
ruff
pylint
pre-commit
# block # block
torch!=2.5.0 torch!=2.5.0
torchvision!=0.20.0 torchvision!=0.20.0

View File

@ -1824,4 +1824,3 @@ class StableDiffusionXLAdapterControlnetPipeline(DiffusionPipeline, FromSingleFi
init_latents = self.scheduler.add_noise(init_latents, noise, timestep) init_latents = self.scheduler.add_noise(init_latents, noise, timestep)
return init_latents return init_latents

View File

@ -1910,4 +1910,3 @@ class StableDiffusionXLAdapterControlnetI2IPipeline(DiffusionPipeline, FromSingl
# image.save(f'./test_img/noisy_image_sd1_5_{int(timestep)}.jpg') # image.save(f'./test_img/noisy_image_sd1_5_{int(timestep)}.jpg')
return init_latents return init_latents