Skip to content

Commit e142d24

Browse files
authored
🔧 Update pre-commit (#1121)
1 parent d162693 commit e142d24

File tree

6 files changed

+10
-14
lines changed

6 files changed

+10
-14
lines changed

‎.pre-commit-config.yaml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
repos:
22

33
- repo: https://github.com/astral-sh/ruff-pre-commit
4-
rev: v0.1.6
4+
rev: v0.2.2
55
hooks:
66
- id: ruff
77
args: [--fix]

‎pyproject.toml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ markers = [
9999
"jstest: marks tests as JavaScript test (deselect with '-m \"not jstest\"')",
100100
]
101101

102-
[tool.ruff]
102+
[tool.ruff.lint]
103103
extend-select = [
104104
"B", # flake8-bugbear
105105
"C4", # flake8-comprehensions

‎sphinx_needs/api/need.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -805,7 +805,7 @@ def _merge_global_options(
805805
config = NeedsSphinxConfig(app.config)
806806
for key, value in global_options.items():
807807
# If key already exists in needs_info, this global_option got overwritten manually in current need
808-
if key in needs_info and needs_info[key]:
808+
if needs_info.get(key):
809809
continue
810810

811811
if isinstance(value, tuple):

‎sphinx_needs/config.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ def extra_options(self) -> dict[str, Callable[[str], Any]]:
4747

4848
@property
4949
def warnings(
50-
self
50+
self,
5151
) -> dict[str, str | Callable[[NeedsInfoType, SphinxLoggerAdapter], bool]]:
5252
"""Warning handlers that are added by the user,
5353
then called at the end of the build.

‎sphinx_needs/directives/needflow.py‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -398,7 +398,7 @@ def process_needflow(
398398
else:
399399
comment = ""
400400

401-
if "style_part" in link_type and link_type["style_part"]:
401+
if link_type.get("style_part"):
402402
link_style = "[{style}]".format(
403403
style=link_type["style_part"]
404404
)
@@ -414,7 +414,7 @@ def process_needflow(
414414
else:
415415
comment = ""
416416

417-
if "style" in link_type and link_type["style"]:
417+
if link_type.get("style"):
418418
link_style = "[{style}]".format(
419419
style=link_type["style"]
420420
)
@@ -429,12 +429,12 @@ def process_needflow(
429429
]:
430430
continue
431431

432-
if "style_start" in link_type and link_type["style_start"]:
432+
if link_type.get("style_start"):
433433
style_start = link_type["style_start"]
434434
else:
435435
style_start = "-"
436436

437-
if "style_end" in link_type and link_type["style_end"]:
437+
if link_type.get("style_end"):
438438
style_end = link_type["style_end"]
439439
else:
440440
style_end = "->"

‎sphinx_needs/utils.py‎

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -576,11 +576,7 @@ def variant_handling(
576576
r"(:[\w':.\-\" ]+)$", variant_definition
577577
)
578578
filter_string = re.sub(r"^\[|[:\]]$", "", filter_string)
579-
filter_string = (
580-
needs_variants[filter_string]
581-
if filter_string in needs_variants
582-
else filter_string
583-
)
579+
filter_string = needs_variants.get(filter_string, filter_string)
584580
try:
585581
# https://docs.python.org/3/library/functions.html?highlight=compile#compile
586582
filter_compiled = compile(filter_string, "<string>", "eval")
@@ -671,7 +667,7 @@ def clean_log(data: str) -> str:
671667

672668

673669
def node_match(
674-
node_types: type[nodes.Element] | list[type[nodes.Element]]
670+
node_types: type[nodes.Element] | list[type[nodes.Element]],
675671
) -> Callable[[nodes.Node], bool]:
676672
"""
677673
Returns a condition function for doctuils.nodes.findall()

0 commit comments

Comments
 (0)