diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 5f21c5b..bbd32ff 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -8,7 +8,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: ["3.9", "3.10", "3.11"] + python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"] steps: - uses: actions/checkout@v3 @@ -19,6 +19,7 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip + pip install setuptools pip install -r requirements.txt - name: Test with pytest run: | diff --git a/ast_scope/utils.py b/ast_scope/utils.py index a55e6dd..c3de88f 100644 --- a/ast_scope/utils.py +++ b/ast_scope/utils.py @@ -62,15 +62,10 @@ def compute_class_fields(class_node): :returns: (class_fields, parent_fields) two lists containing the fields in the class scope and the parent scope, respectively. """ - assert class_node._fields == ( - "name", - "bases", - "keywords", - "body", - "decorator_list", - ) - return [class_node.body], [ - class_node.bases, - class_node.keywords, - class_node.decorator_list, - ] + fields_in_all = ("name", "bases", "keywords", "body", "decorator_list") + assert class_node._fields in (fields_in_all, fields_in_all + ("type_params",)) + class_fields = [class_node.body] + parent_fields = [class_node.bases, class_node.keywords, class_node.decorator_list] + if "type_params" in class_node._fields: + class_fields.append(class_node.type_params) + return class_fields, parent_fields diff --git a/setup.py b/setup.py index 6ad2df9..a5d91fc 100644 --- a/setup.py +++ b/setup.py @@ -5,7 +5,7 @@ setuptools.setup( name="ast_scope", # Replace with your own username - version="0.4.6", + version="0.5.0", author="Kavi Gupta", author_email="ast_scope@kavigupta.org", description="Annotates a Python AST with the scope of symbols.", @@ -17,6 +17,8 @@ "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", + "Programming Language :: Python :: 3.13", "Operating System :: OS Independent", ], python_requires=">=3.9",