Skip to content

Commit 0d71c2f

Browse files
committed
style: Format
1 parent 23bbbf6 commit 0d71c2f

5 files changed

Lines changed: 9 additions & 12 deletions

File tree

scripts/insiders.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
def human_readable_amount(amount: int) -> str: # noqa: D103
2727
str_amount = str(amount)
2828
if len(str_amount) >= 4: # noqa: PLR2004
29-
return f"{str_amount[:len(str_amount)-3]},{str_amount[-3:]}"
29+
return f"{str_amount[: len(str_amount) - 3]},{str_amount[-3:]}"
3030
return str_amount
3131

3232

src/_griffe/docstrings/google.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -123,8 +123,8 @@ def _read_block_items(docstring: Docstring, *, offset: int, **options: Any) -> _
123123
docstring_warning(
124124
docstring,
125125
new_offset,
126-
f"Confusing indentation for continuation line {new_offset+1} in docstring, "
127-
f"should be {indent} * 2 = {indent*2} spaces, not {cont_indent}",
126+
f"Confusing indentation for continuation line {new_offset + 1} in docstring, "
127+
f"should be {indent} * 2 = {indent * 2} spaces, not {cont_indent}",
128128
)
129129

130130
elif line.startswith(indent * " "):
@@ -201,8 +201,7 @@ def _read_parameters(
201201
if " " in name_with_type:
202202
name, annotation = name_with_type.split(" ", 1)
203203
annotation = annotation.strip("()")
204-
if annotation.endswith(", optional"):
205-
annotation = annotation[:-10]
204+
annotation = annotation.removesuffix(", optional")
206205
# try to compile the annotation to transform it into an expression
207206
annotation = parse_docstring_annotation(annotation, docstring)
208207
else:
@@ -280,8 +279,7 @@ def _read_attributes_section(
280279
if " " in name_with_type:
281280
name, annotation = name_with_type.split(" ", 1)
282281
annotation = annotation.strip("()")
283-
if annotation.endswith(", optional"):
284-
annotation = annotation[:-10]
282+
annotation = annotation.removesuffix(", optional")
285283
# try to compile the annotation to transform it into an expression
286284
annotation = parse_docstring_annotation(annotation, docstring)
287285
else:

src/_griffe/docstrings/numpy.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ def _read_block_items(
130130
docstring_warning(
131131
docstring,
132132
new_offset,
133-
f"Confusing indentation for continuation line {new_offset+1} in docstring, "
133+
f"Confusing indentation for continuation line {new_offset + 1} in docstring, "
134134
f"should be 4 spaces, not {cont_indent}",
135135
)
136136

src/_griffe/docstrings/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ def warn(docstring: Docstring, offset: int, message: str, log_level: LogLevel =
4343
except BuiltinModuleError:
4444
prefix = f"<module: {docstring.parent.module.name}>" # type: ignore[union-attr]
4545
log = getattr(logger, log_level.value)
46-
log(f"{prefix}:{(docstring.lineno or 0)+offset}: {message}")
46+
log(f"{prefix}:{(docstring.lineno or 0) + offset}: {message}")
4747

4848
warn(docstring, offset, message, log_level)
4949

src/_griffe/finder.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -247,8 +247,7 @@ def find_package(self, module_name: str) -> Package | NamespacePackage:
247247
]
248248

249249
real_module_name = module_name
250-
if real_module_name.endswith("-stubs"):
251-
real_module_name = real_module_name[:-6]
250+
real_module_name = real_module_name.removesuffix("-stubs")
252251
namespace_dirs = []
253252
for path in self.search_paths:
254253
path_contents = self._contents(path)
@@ -462,7 +461,7 @@ def _handle_pth_file(path: Path) -> list[_SP]:
462461
for line in text.strip().replace(";", "\n").splitlines(keepends=False):
463462
line = line.strip() # noqa: PLW2901
464463
if _re_import_line.match(line):
465-
editable_module = path.parent / f"{line[len('import'):].lstrip()}.py"
464+
editable_module = path.parent / f"{line[len('import') :].lstrip()}.py"
466465
with suppress(UnhandledEditableModuleError):
467466
return _handle_editable_module(editable_module)
468467
if line and not line.startswith("#") and os.path.exists(line): # noqa: PTH110

0 commit comments

Comments
 (0)