Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
[build-system]
build-backend = "hatchling.build"
requires = [ "hatchling" ]
requires = [ "hatch-vcs", "hatchling" ]

[project]
name = "docstringify"
version = "2.0.0"
description = "Flag missing docstrings and, optionally, generate them from signatures and type annotations."
readme = "README.md"
keywords = [
Expand All @@ -30,6 +29,7 @@ classifiers = [
"Programming Language :: Python :: 3.14",
"Programming Language :: Python :: 3.15",
]
dynamic = [ "version" ]
dependencies = []
urls.Documentation = "https://github.com/stefmolin/docstringify"
urls.Homepage = "https://github.com/stefmolin/docstringify"
Expand All @@ -44,11 +44,14 @@ test = [
"pytest-randomly>=3.12.0",
]

[tool.hatch]
version.source = "vcs"

[tool.ruff]
line-length = 88
format.indent-style = "space"
format.quote-style = "single"
format.skip-magic-trailing-comma = false
format.skip-magic-trailing-comma = true
format.docstring-code-format = true
lint.select = [
"ANN", # flake8-annotations
Expand Down
6 changes: 1 addition & 5 deletions src/docstringify/nodes/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,7 @@ class DocstringNode:

@overload
def __init__(
self,
node: ast.Module,
module_name: str,
source_code: str,
parent: None = None,
self, node: ast.Module, module_name: str, source_code: str, parent: None = None
) -> None: ...

@overload
Expand Down
5 changes: 1 addition & 4 deletions src/docstringify/traversal/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,4 @@
from .transformer import DocstringTransformer
from .visitor import DocstringVisitor

__all__ = [
'DocstringTransformer',
'DocstringVisitor',
]
__all__ = ['DocstringTransformer', 'DocstringVisitor']
7 changes: 2 additions & 5 deletions src/docstringify/traversal/transformer.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,9 +164,7 @@ def _convert_to_source_code(self) -> str:
output_lines.append(
indent(
self.docstring_converter.format_docstring(
docstring.splitlines(),
indent=0,
quote=True,
docstring.splitlines(), indent=0, quote=True
)
+ (f'\n{suffix}' if suffix else ''),
' ' * prefix,
Expand Down Expand Up @@ -199,8 +197,7 @@ def handle_missing_docstring(self, docstring_node: DocstringNode) -> None:
)

suggested_docstring = self.docstring_converter.suggest_docstring(
docstring_node,
indent=indent,
docstring_node, indent=indent
)
docstring_ast_node = ast.Expr(ast.Constant(suggested_docstring))

Expand Down
16 changes: 4 additions & 12 deletions src/docstringify/traversal/visitor.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,30 +135,22 @@ def process_docstring(self, docstring_node: DocstringNode) -> DocstringNode:

@overload
def visit_docstring(
self,
node: ast.Module,
docstring_class: type[DocstringNode],
self, node: ast.Module, docstring_class: type[DocstringNode]
) -> ast.Module: ...

@overload
def visit_docstring(
self,
node: ast.ClassDef,
docstring_class: type[DocstringNode],
self, node: ast.ClassDef, docstring_class: type[DocstringNode]
) -> ast.ClassDef: ...

@overload
def visit_docstring(
self,
node: ast.FunctionDef,
docstring_class: type[FunctionDocstringNode],
self, node: ast.FunctionDef, docstring_class: type[FunctionDocstringNode]
) -> ast.FunctionDef: ...

@overload
def visit_docstring(
self,
node: ast.AsyncFunctionDef,
docstring_class: type[FunctionDocstringNode],
self, node: ast.AsyncFunctionDef, docstring_class: type[FunctionDocstringNode]
) -> ast.AsyncFunctionDef: ...

def visit_docstring(
Expand Down
1 change: 0 additions & 1 deletion uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading