Skip to content

Commit

Permalink
🔧 Update pre-commit (#1121)
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisjsewell authored Feb 21, 2024
1 parent d162693 commit e142d24
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 14 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
repos:

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.1.6
rev: v0.2.2
hooks:
- id: ruff
args: [--fix]
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ markers = [
"jstest: marks tests as JavaScript test (deselect with '-m \"not jstest\"')",
]

[tool.ruff]
[tool.ruff.lint]
extend-select = [
"B", # flake8-bugbear
"C4", # flake8-comprehensions
Expand Down
2 changes: 1 addition & 1 deletion sphinx_needs/api/need.py
Original file line number Diff line number Diff line change
Expand Up @@ -805,7 +805,7 @@ def _merge_global_options(
config = NeedsSphinxConfig(app.config)
for key, value in global_options.items():
# If key already exists in needs_info, this global_option got overwritten manually in current need
if key in needs_info and needs_info[key]:
if needs_info.get(key):
continue

if isinstance(value, tuple):
Expand Down
2 changes: 1 addition & 1 deletion sphinx_needs/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def extra_options(self) -> dict[str, Callable[[str], Any]]:

@property
def warnings(
self
self,
) -> dict[str, str | Callable[[NeedsInfoType, SphinxLoggerAdapter], bool]]:
"""Warning handlers that are added by the user,
then called at the end of the build.
Expand Down
8 changes: 4 additions & 4 deletions sphinx_needs/directives/needflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,7 @@ def process_needflow(
else:
comment = ""

if "style_part" in link_type and link_type["style_part"]:
if link_type.get("style_part"):
link_style = "[{style}]".format(
style=link_type["style_part"]
)
Expand All @@ -414,7 +414,7 @@ def process_needflow(
else:
comment = ""

if "style" in link_type and link_type["style"]:
if link_type.get("style"):
link_style = "[{style}]".format(
style=link_type["style"]
)
Expand All @@ -429,12 +429,12 @@ def process_needflow(
]:
continue

if "style_start" in link_type and link_type["style_start"]:
if link_type.get("style_start"):
style_start = link_type["style_start"]
else:
style_start = "-"

if "style_end" in link_type and link_type["style_end"]:
if link_type.get("style_end"):
style_end = link_type["style_end"]
else:
style_end = "->"
Expand Down
8 changes: 2 additions & 6 deletions sphinx_needs/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -576,11 +576,7 @@ def variant_handling(
r"(:[\w':.\-\" ]+)$", variant_definition
)
filter_string = re.sub(r"^\[|[:\]]$", "", filter_string)
filter_string = (
needs_variants[filter_string]
if filter_string in needs_variants
else filter_string
)
filter_string = needs_variants.get(filter_string, filter_string)
try:
# https://docs.python.org/3/library/functions.html?highlight=compile#compile
filter_compiled = compile(filter_string, "<string>", "eval")
Expand Down Expand Up @@ -671,7 +667,7 @@ def clean_log(data: str) -> str:


def node_match(
node_types: type[nodes.Element] | list[type[nodes.Element]]
node_types: type[nodes.Element] | list[type[nodes.Element]],
) -> Callable[[nodes.Node], bool]:
"""
Returns a condition function for doctuils.nodes.findall()
Expand Down

0 comments on commit e142d24

Please sign in to comment.