Merge pull request #10285 from akx/ruff-spacing

Indentation + ruff whitespace fixes
This commit is contained in:
AUTOMATIC1111 2023-05-11 21:25:15 +03:00 committed by GitHub
commit abe32cefa3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
41 changed files with 301 additions and 296 deletions

View File

@ -25,6 +25,7 @@ def crop_image(im, settings):
elif is_portrait(settings.crop_width, settings.crop_height): elif is_portrait(settings.crop_width, settings.crop_height):
scale_by = settings.crop_height / im.height scale_by = settings.crop_height / im.height
im = im.resize((int(im.width * scale_by), int(im.height * scale_by))) im = im.resize((int(im.width * scale_by), int(im.height * scale_by)))
im_debug = im.copy() im_debug = im.copy()
@ -260,6 +261,7 @@ def image_entropy(im):
hist = hist[hist > 0] hist = hist[hist > 0]
return -np.log2(hist / hist.sum()).sum() return -np.log2(hist / hist.sum()).sum()
def centroid(pois): def centroid(pois):
x = [poi.x for poi in pois] x = [poi.x for poi in pois]
y = [poi.y for poi in pois] y = [poi.y for poi in pois]

View File

@ -1841,15 +1841,15 @@ def versions_html():
return f""" return f"""
version: <a href="https://github.com/AUTOMATIC1111/stable-diffusion-webui/commit/{commit}">{tag}</a> version: <a href="https://github.com/AUTOMATIC1111/stable-diffusion-webui/commit/{commit}">{tag}</a>
    
python: <span title="{sys.version}">{python_version}</span> python: <span title="{sys.version}">{python_version}</span>
    
torch: {getattr(torch, '__long_version__',torch.__version__)} torch: {getattr(torch, '__long_version__',torch.__version__)}
    
xformers: {xformers_version} xformers: {xformers_version}
    
gradio: {gr.__version__} gradio: {gr.__version__}
    
checkpoint: <a id="sd_checkpoint_hash">N/A</a> checkpoint: <a id="sd_checkpoint_hash">N/A</a>
""" """

View File

@ -6,6 +6,7 @@ extend-select = [
"B", "B",
"C", "C",
"I", "I",
"W",
] ]
exclude = [ exclude = [
@ -20,7 +21,7 @@ ignore = [
"I001", # Import block is un-sorted or un-formatted "I001", # Import block is un-sorted or un-formatted
"C901", # Function is too complex "C901", # Function is too complex
"C408", # Rewrite as a literal "C408", # Rewrite as a literal
"W605", # invalid escape sequence, messes with some docstrings
] ]
[tool.ruff.per-file-ignores] [tool.ruff.per-file-ignores]

View File

@ -1,6 +1,7 @@
import unittest import unittest
import requests import requests
class UtilsTests(unittest.TestCase): class UtilsTests(unittest.TestCase):
def setUp(self): def setUp(self):
self.url_options = "http://localhost:7860/sdapi/v1/options" self.url_options = "http://localhost:7860/sdapi/v1/options"
@ -58,5 +59,6 @@ class UtilsTests(unittest.TestCase):
def test_embeddings(self): def test_embeddings(self):
self.assertEqual(requests.get(self.url_embeddings).status_code, 200) self.assertEqual(requests.get(self.url_embeddings).status_code, 200)
if __name__ == "__main__": if __name__ == "__main__":
unittest.main() unittest.main()