Skip to content

Commit 19759a8

Browse files
[pre-commit.ci] pre-commit autoupdate (#1392)
1 parent 75fd3c9 commit 19759a8

23 files changed

+64
-54
lines changed

.pre-commit-config.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,14 @@ repos:
66
- id: taplo-format
77

88
- repo: https://github.com/astral-sh/ruff-pre-commit
9-
rev: v0.8.6
9+
rev: v0.9.6
1010
hooks:
1111
- id: ruff
1212
args: [--fix]
1313
- id: ruff-format
1414

1515
- repo: https://github.com/pre-commit/mirrors-mypy
16-
rev: v1.14.1
16+
rev: v1.15.0
1717
hooks:
1818
- id: mypy
1919
files: sphinx_needs/.*

performance/performance_test.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ def start(
141141
print(f" Project = {source_tmp_path}")
142142
print(f" Build = {project_path}")
143143
if debug:
144-
print(f' Call: {" ".join(params)} ')
144+
print(f" Call: {' '.join(params)} ")
145145

146146
if debug:
147147
subprocess.run(params)
@@ -298,7 +298,7 @@ def series(
298298
proc = subprocess.Popen(["snakeviz", f"profile/{p}.prof"])
299299
procs.append(proc)
300300

301-
print(f"\nKilling snakeviz server in {len(procs)*5} secs.")
301+
print(f"\nKilling snakeviz server in {len(procs) * 5} secs.")
302302
time.sleep(len(procs) * 5)
303303
for proc in procs:
304304
proc.kill()

sphinx_needs/api/need.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -727,7 +727,7 @@ def _make_hashed_id(
727727
hashed = hashlib.sha1(hashable_content.encode("UTF-8")).hexdigest().upper()
728728
if config.id_from_title:
729729
hashed = full_title.upper().replace(" ", "_") + "_" + hashed
730-
return f"{type_prefix}{hashed[:config.id_length]}"
730+
return f"{type_prefix}{hashed[: config.id_length]}"
731731

732732

733733
def _split_list_with_dyn_funcs(
@@ -749,9 +749,9 @@ def _split_list_with_dyn_funcs(
749749
return
750750

751751
if not isinstance(text, str):
752-
assert isinstance(text, list) and all(
753-
isinstance(x, str) for x in text
754-
), "text must be a string or a list of strings"
752+
assert isinstance(text, list) and all(isinstance(x, str) for x in text), (
753+
"text must be a string or a list of strings"
754+
)
755755
yield from ((x, False) for x in text)
756756
return
757757

sphinx_needs/debug.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -146,11 +146,11 @@ def measure_time_func(
146146
def _print_timing_results(app: Sphinx) -> None:
147147
for value in TIME_MEASUREMENTS.values():
148148
print(value["name"])
149-
print(f' amount: {value["amount"]}')
150-
print(f' overall: {value["overall"]:2f}')
151-
print(f' avg: {value["avg"]:2f}')
152-
print(f' max: {value["max"]:2f}')
153-
print(f' min: {value["min"]:2f} \n')
149+
print(f" amount: {value['amount']}")
150+
print(f" overall: {value['overall']:2f}")
151+
print(f" avg: {value['avg']:2f}")
152+
print(f" max: {value['max']:2f}")
153+
print(f" min: {value['min']:2f} \n")
154154

155155

156156
def _store_timing_results_json(app: Sphinx, build_data: dict[str, Any]) -> None:

sphinx_needs/diagrams_common.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -189,9 +189,9 @@ def calculate_link(
189189
builder = app.builder
190190
try:
191191
if need_info["is_external"]:
192-
assert (
193-
need_info["external_url"] is not None
194-
), "external_url must be set for external needs"
192+
assert need_info["external_url"] is not None, (
193+
"external_url must be set for external needs"
194+
)
195195
link = need_info["external_url"]
196196
# check if need_info["external_url"] is relative path
197197
parsed_url = urlparse(need_info["external_url"])

sphinx_needs/directives/needflow/_plantuml.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,7 @@ def process_needflow_plantuml(
274274
)
275275

276276
if found_needs:
277-
plantuml_block_text = ".. plantuml::\n" "\n" " @startuml" " @enduml"
277+
plantuml_block_text = ".. plantuml::\n\n @startuml @enduml"
278278
puml_node = plantuml(plantuml_block_text)
279279
# TODO if an alt is not set then sphinxcontrib.plantuml uses the plantuml source code as alt text.
280280
# I think this is not great, but currently setting a more sensible default breaks some tests

sphinx_needs/directives/needgantt.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ def run(self) -> Sequence[nodes.Node]:
8585
timeline_options = ["daily", "weekly", "monthly"]
8686
if timeline and timeline not in timeline_options:
8787
raise NeedGanttException(
88-
"Given scale value {} is invalid. Please use: " "{}".format(
88+
"Given scale value {} is invalid. Please use: {}".format(
8989
timeline, ",".join(timeline_options)
9090
)
9191
)
@@ -178,7 +178,7 @@ def process_needgantt(
178178
no_plantuml(node)
179179
continue
180180

181-
plantuml_block_text = ".. plantuml::\n" "\n" " @startgantt" " @endgantt"
181+
plantuml_block_text = ".. plantuml::\n\n @startgantt @endgantt"
182182
puml_node = plantuml(plantuml_block_text)
183183

184184
# Add source origin
@@ -321,7 +321,7 @@ def process_needgantt(
321321
start_with_links = need[link_type] # type: ignore[literal-required]
322322
for start_with_link in start_with_links:
323323
start_need = all_needs_dict[start_with_link]
324-
gantt_constraint = "[{}] {} at [{}]'s " "{}\n".format(
324+
gantt_constraint = "[{}] {} at [{}]'s {}\n".format(
325325
need["id"], keyword, start_need["id"], start_end_sync
326326
)
327327
puml_node["uml"] += gantt_constraint

sphinx_needs/directives/needimport.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ def run(self) -> Sequence[nodes.Node]:
128128
f"Schema validation errors detected in file {correct_need_import_path}:"
129129
)
130130
for error in errors.schema:
131-
logger.info(f' {error.message} -> {".".join(error.path)}')
131+
logger.info(f" {error.message} -> {'.'.join(error.path)}")
132132

133133
if version is None:
134134
try:
@@ -256,8 +256,9 @@ def run(self) -> Sequence[nodes.Node]:
256256
# These keys need to be different for add_need() api call.
257257
need_params["need_type"] = need_params.pop("type", "") # type: ignore[misc,typeddict-unknown-key]
258258
need_params["title"] = need_params.pop(
259-
"full_title", need_params.get("title", "")
260-
) # type: ignore[misc]
259+
"full_title", # type: ignore[misc]
260+
need_params.get("title", ""),
261+
)
261262

262263
# Replace id, to get unique ids
263264
need_id = need_params["id"] = id_prefix + need_params["id"]

sphinx_needs/directives/needlist.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -114,9 +114,9 @@ def process_needlist(
114114
if need_info["hide"]:
115115
para += title
116116
elif need_info["is_external"]:
117-
assert (
118-
need_info["external_url"] is not None
119-
), "External need without URL"
117+
assert need_info["external_url"] is not None, (
118+
"External need without URL"
119+
)
120120
ref = nodes.reference("", "")
121121

122122
ref["refuri"] = check_and_calc_base_url_rel_path(

sphinx_needs/directives/needpie.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,9 @@ def process_needpie(
187187
# execute filter_func code
188188
if ff_result:
189189
args = ff_result.args.split(",") if ff_result.args else []
190-
args_context = {f"arg{index+1}": arg for index, arg in enumerate(args)}
190+
args_context = {
191+
f"arg{index + 1}": arg for index, arg in enumerate(args)
192+
}
191193

192194
sizes = []
193195
ff_result.func(needs=need_list, results=sizes, **args_context)

0 commit comments

Comments
 (0)