From 39a4aeba45864967ff590ba57532cae600c0331e Mon Sep 17 00:00:00 2001 From: Haoming Date: Wed, 6 Nov 2024 15:34:17 +0800 Subject: [PATCH] lint --- CHANGELOG.md | 3 +++ javascript/vec_cc.js | 8 ++++---- lib_cc/callback.py | 4 ++-- lib_cc/const.py | 8 ++++---- lib_cc/style.py | 3 +-- scripts/cc.py | 2 +- scripts/cc_hdr.py | 4 ++-- 7 files changed, 17 insertions(+), 15 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 31f4344..e80243a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +### v2.3.2 - 2024 Nov.06 +- Linting *(`internal`)* + ### v2.3.1 - 2024 Nov.04 - Implement **Range** Settings diff --git a/javascript/vec_cc.js b/javascript/vec_cc.js index 07b2901..c9bb2b9 100644 --- a/javascript/vec_cc.js +++ b/javascript/vec_cc.js @@ -8,7 +8,7 @@ class VectorscopeCC { */ static updateCursor(r, g, b, mode) { const mag = Math.abs(r) + Math.abs(g) + Math.abs(b); - var condX, condY; + let condX, condY; if (mag < Number.EPSILON) { condX = 0.0; @@ -44,9 +44,9 @@ class VectorscopeCC { const x = ((e.clientX - rect.left) - 100.0) / 25; const y = ((e.clientY - rect.top) - 100.0) / 25; - var r = -0.077 * (4.33 * x + 7.5 * y); - var g = y / 0.866 + r; - var b = x + 0.5 * r + 0.5 * g; + let r = -0.077 * (4.33 * x + 7.5 * y); + let g = y / 0.866 + r; + let b = x + 0.5 * r + 0.5 * g; const mag = Math.sqrt(r * r + g * g + b * b); const len = Math.abs(r) + Math.abs(g) + Math.abs(b); diff --git a/lib_cc/callback.py b/lib_cc/callback.py index 027596f..52a510f 100644 --- a/lib_cc/callback.py +++ b/lib_cc/callback.py @@ -68,7 +68,7 @@ class NoiseMethods: return noise / noise.std() -def RGB_2_CbCr(r: float, g: float, b: float) -> tuple[float, float]: +def RGB2CbCr(r: float, g: float, b: float) -> tuple[float, float]: """Convert RGB channels into YCbCr for SDXL""" cb = -0.17 * r - 0.33 * g + 0.5 * b cr = 0.5 * r - 0.42 * g - 0.08 * b @@ -151,7 +151,7 @@ def cc_callback(self, d): source[i][3] *= sat else: - cb, cr = RGB_2_CbCr(r, g, b) + cb, cr = RGB2CbCr(r, g, b) for i in range(batchSize): # Brightness diff --git a/lib_cc/const.py b/lib_cc/const.py index 29e9011..e863249 100644 --- a/lib_cc/const.py +++ b/lib_cc/const.py @@ -13,10 +13,10 @@ class Param: return round(random.uniform(self.minimum, self.maximum), 2) -Brightness: Param = None -Contrast: Param = None -Saturation: Param = None -Color: Param = None +Brightness: Param +Contrast: Param +Saturation: Param +Color: Param def init(): diff --git a/lib_cc/style.py b/lib_cc/style.py index d24a07b..584f3ba 100644 --- a/lib_cc/style.py +++ b/lib_cc/style.py @@ -5,14 +5,13 @@ import os STYLE_FILE = os.path.join(scripts.basedir(), "styles.json") - EMPTY_STYLE = {"styles": {}, "deleted": {}} class StyleManager: def __init__(self): - self.STYLE_SHEET: dict = None + self.STYLE_SHEET: dict = {} def load_styles(self): if os.path.isfile(STYLE_FILE): diff --git a/scripts/cc.py b/scripts/cc.py index f1d9c5c..d0bb5f9 100644 --- a/scripts/cc.py +++ b/scripts/cc.py @@ -12,7 +12,7 @@ from random import seed import gradio as gr -VERSION = "2.3.1" +VERSION = "2.3.2" style_manager = StyleManager() diff --git a/scripts/cc_hdr.py b/scripts/cc_hdr.py index 7fc16c5..8583158 100644 --- a/scripts/cc_hdr.py +++ b/scripts/cc_hdr.py @@ -7,7 +7,7 @@ import numpy as np import cv2 as cv -def _merge_HDR(imgs: list, path: str, depth: str, fmt: str, gamma: float): +def mergeHDR(imgs: list, path: str, depth: str, fmt: str, gamma: float): """https://docs.opencv.org/4.8.0/d2/df0/tutorial_py_hdr.html""" import datetime @@ -131,7 +131,7 @@ class VectorHDR(scripts.Script): imgs[it] = proc.images[0] if auto: - _merge_HDR(imgs, p.outpath_samples, depth, fmt, gamma) + mergeHDR(imgs, p.outpath_samples, depth, fmt, gamma) baseline.images = imgs return baseline