mirror of
https://github.com/AUTOMATIC1111/stable-diffusion-webui.git
synced 2025-02-06 13:42:52 +08:00
Merge pull request #10285 from akx/ruff-spacing
Indentation + ruff whitespace fixes
This commit is contained in:
commit
abe32cefa3
@ -25,6 +25,7 @@ def crop_image(im, settings):
|
||||
elif is_portrait(settings.crop_width, settings.crop_height):
|
||||
scale_by = settings.crop_height / im.height
|
||||
|
||||
|
||||
im = im.resize((int(im.width * scale_by), int(im.height * scale_by)))
|
||||
im_debug = im.copy()
|
||||
|
||||
@ -260,10 +261,11 @@ def image_entropy(im):
|
||||
hist = hist[hist > 0]
|
||||
return -np.log2(hist / hist.sum()).sum()
|
||||
|
||||
|
||||
def centroid(pois):
|
||||
x = [poi.x for poi in pois]
|
||||
y = [poi.y for poi in pois]
|
||||
return PointOfInterest(sum(x)/len(pois), sum(y)/len(pois))
|
||||
return PointOfInterest(sum(x) / len(pois), sum(y) / len(pois))
|
||||
|
||||
|
||||
def poi_average(pois, settings):
|
||||
@ -320,10 +322,10 @@ class PointOfInterest:
|
||||
|
||||
def bounding(self, size):
|
||||
return [
|
||||
self.x - size//2,
|
||||
self.y - size//2,
|
||||
self.x + size//2,
|
||||
self.y + size//2
|
||||
self.x - size // 2,
|
||||
self.y - size // 2,
|
||||
self.x + size // 2,
|
||||
self.y + size // 2
|
||||
]
|
||||
|
||||
|
||||
|
@ -1841,15 +1841,15 @@ def versions_html():
|
||||
|
||||
return f"""
|
||||
version: <a href="https://github.com/AUTOMATIC1111/stable-diffusion-webui/commit/{commit}">{tag}</a>
|
||||
•
|
||||
•
|
||||
python: <span title="{sys.version}">{python_version}</span>
|
||||
•
|
||||
•
|
||||
torch: {getattr(torch, '__long_version__',torch.__version__)}
|
||||
•
|
||||
•
|
||||
xformers: {xformers_version}
|
||||
•
|
||||
•
|
||||
gradio: {gr.__version__}
|
||||
•
|
||||
•
|
||||
checkpoint: <a id="sd_checkpoint_hash">N/A</a>
|
||||
"""
|
||||
|
||||
|
@ -6,6 +6,7 @@ extend-select = [
|
||||
"B",
|
||||
"C",
|
||||
"I",
|
||||
"W",
|
||||
]
|
||||
|
||||
exclude = [
|
||||
@ -20,7 +21,7 @@ ignore = [
|
||||
"I001", # Import block is un-sorted or un-formatted
|
||||
"C901", # Function is too complex
|
||||
"C408", # Rewrite as a literal
|
||||
|
||||
"W605", # invalid escape sequence, messes with some docstrings
|
||||
]
|
||||
|
||||
[tool.ruff.per-file-ignores]
|
||||
|
@ -1,6 +1,7 @@
|
||||
import unittest
|
||||
import requests
|
||||
|
||||
|
||||
class UtilsTests(unittest.TestCase):
|
||||
def setUp(self):
|
||||
self.url_options = "http://localhost:7860/sdapi/v1/options"
|
||||
@ -23,7 +24,7 @@ class UtilsTests(unittest.TestCase):
|
||||
|
||||
pre_value = response.json()["send_seed"]
|
||||
|
||||
self.assertEqual(requests.post(self.url_options, json={"send_seed":not pre_value}).status_code, 200)
|
||||
self.assertEqual(requests.post(self.url_options, json={"send_seed": not pre_value}).status_code, 200)
|
||||
|
||||
response = requests.get(self.url_options)
|
||||
self.assertEqual(response.status_code, 200)
|
||||
@ -58,5 +59,6 @@ class UtilsTests(unittest.TestCase):
|
||||
def test_embeddings(self):
|
||||
self.assertEqual(requests.get(self.url_embeddings).status_code, 200)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
|
Loading…
Reference in New Issue
Block a user