Skip to content

Commit baf446b

Browse files
authored
ruff: RET504 rule (#304)
1 parent 41de8cd commit baf446b

File tree

8 files changed

+16
-21
lines changed

8 files changed

+16
-21
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@ coverage:
88
status:
99
project:
1010
default:
11-
threshold: 0.5%
11+
threshold: 0.1%

.github/workflows/pytest.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,5 @@ jobs:
3636
uses: codecov/codecov-action@18283e04ce6e62d37312384ff67231eb8fd56d24 # v5.4.3
3737
with:
3838
token: ${{ secrets.CODECOV_TOKEN }}
39-
files: ./coverage.xml
40-
flags: unittests
41-
name: codecov-umbrella
4239
fail_ci_if_error: true
4340
verbose: true

comfy_cli/command/models/models.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,7 @@ def get_workspace() -> pathlib.Path:
3434

3535

3636
def potentially_strip_param_url(path_name: str) -> str:
37-
path_name = path_name.split("?")[0]
38-
return path_name
37+
return path_name.split("?")[0]
3938

4039

4140
def check_huggingface_url(url: str) -> tuple[bool, Optional[str], Optional[str], Optional[str], Optional[str]]:

comfy_cli/command/run.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -197,8 +197,7 @@ def format_image_path(self, img):
197197
if subfolder:
198198
filename = os.path.join(subfolder, filename)
199199

200-
filename = os.path.join(workspace_manager.get_workspace_path()[0], output_type, filename)
201-
return filename
200+
return os.path.join(workspace_manager.get_workspace_path()[0], output_type, filename)
202201

203202
query = urllib.parse.urlencode(img)
204203
return f"http://{self.host}:{self.port}/view?{query}"

comfy_cli/file_utils.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,7 @@ def parse_json(input_data):
2525
input_data = input_data.decode("utf-8")
2626

2727
# Parse the string as JSON
28-
json_object = json.loads(input_data)
29-
30-
return json_object
28+
return json.loads(input_data)
3129

3230
except json.JSONDecodeError as e:
3331
# Handle JSON decoding error

comfy_cli/registry/api.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,7 @@ def list_all_nodes(self):
9696
response = requests.get(url)
9797
if response.status_code == 200:
9898
raw_nodes = response.json()["nodes"]
99-
mapped_nodes = [map_node_to_node_class(node) for node in raw_nodes]
100-
return mapped_nodes
99+
return [map_node_to_node_class(node) for node in raw_nodes]
101100
else:
102101
raise Exception(f"Failed to retrieve nodes: {response.status_code} - {response.text}")
103102

comfy_cli/workspace_manager.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -263,8 +263,7 @@ def get_comfyui_manager_path(self):
263263
return None
264264

265265
# To check more robustly, verify up to the `.git` path.
266-
manager_path = os.path.join(self.workspace_path, "custom_nodes", "ComfyUI-Manager")
267-
return manager_path
266+
return os.path.join(self.workspace_path, "custom_nodes", "ComfyUI-Manager")
268267

269268
def is_comfyui_manager_installed(self):
270269
if self.workspace_path is None:

pyproject.toml

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -69,10 +69,14 @@ target-version = "py39"
6969

7070
line-length = 120
7171
lint.select = [
72-
"E4", # default
73-
"E7", # default
74-
"E9", # default
75-
"F", # default
76-
"I", # isort-like behavior (import statement sorting)
77-
"UP", # pyupgrade
72+
"E", # pycodestyle - Error
73+
"F", # default
74+
"I", # isort-like behavior (import statement sorting)
75+
"Q", # flake8-quotes
76+
"RET504", # Unnecessary assignment to {name} before return statement
77+
"UP", # pyupgrade
78+
"W", # pycodestyle - Warning
79+
]
80+
lint.extend-ignore = [
81+
"E501", # Line too long
7882
]

0 commit comments

Comments
 (0)