From 14cd51c1b7431cdec5c3e7510b8a0e3b66c2f7d4 Mon Sep 17 00:00:00 2001 From: Henrik Seidel Date: Sat, 9 Mar 2024 05:55:19 +0100 Subject: [PATCH] REF: Fix deprecation warnings for PEP224 docstrings of class variables (#437) * Update __init__.py ast.Str is deprecated and will be removed in Python 3.14; use ast.Constant instead * Update __init__.py Attribute s is deprecated and will be removed in Python 3.14; use value instead * Update __init__.py DeprecationWarning: Attribute s is deprecated and will be removed in Python 3.14; use value instead --- pdoc/__init__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pdoc/__init__.py b/pdoc/__init__.py index c1e784ee..84e06a4e 100644 --- a/pdoc/__init__.py +++ b/pdoc/__init__.py @@ -316,14 +316,14 @@ def get_name(assign_node): for assign_node, str_node in _pairwise(ast.iter_child_nodes(tree)): if not (isinstance(assign_node, (ast.Assign, ast.AnnAssign)) and isinstance(str_node, ast.Expr) and - isinstance(str_node.value, ast.Str)): + isinstance(str_node.value, ast.Constant)): continue name = get_name(assign_node) if not name: continue - docstring = inspect.cleandoc(str_node.value.s).strip() + docstring = inspect.cleandoc(str_node.value.value).strip() if not docstring: continue