Skip to content

Commit

Permalink
misc: support Python 3.12 (#82)
Browse files Browse the repository at this point in the history
  • Loading branch information
mauvilsa authored Sep 15, 2023
1 parent 703c6ca commit 969b644
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-20.04, macOS-10.15, windows-2019]
python-version: [3.6, 3.7, 3.8, 3.9, "3.10"]
python-version: [3.6, 3.7, 3.8, 3.9, "3.10", 3.11, 3.12.0-rc.2]
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
Expand Down
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/pycqa/isort
rev: 5.10.1
rev: 5.12.0
hooks:
- id: isort
additional_dependencies: [toml]
Expand Down
18 changes: 11 additions & 7 deletions docstring_parser/attrdoc.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,23 @@

import ast
import inspect
import sys
import textwrap
import typing as T
from types import ModuleType

from .common import Docstring, DocstringParam

ast_constant_attr = {
ast.Constant: "value",
# python <= 3.7:
ast.NameConstant: "value",
ast.Num: "n",
ast.Str: "s",
}
ast_constant_attr = {ast.Constant: "value"}

if sys.version_info[:2] <= (3, 7):
ast_constant_attr.update(
{
ast.NameConstant: "value",
ast.Num: "n",
ast.Str: "s",
}
)


def ast_get_constant_value(node: ast.AST) -> T.Any:
Expand Down
3 changes: 3 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ classifiers = [
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Topic :: Documentation :: Sphinx",
"Topic :: Text Processing :: Markup",
"Topic :: Software Development :: Libraries :: Python Modules",
Expand Down

0 comments on commit 969b644

Please sign in to comment.