Skip to content

Commit ce89887

Browse files
committed
Add support for py3.9 in pylint_plugins
python3.9 removed the Slice type from the AST, so the property_name_node is not as deep as expected.
1 parent 76b8390 commit ce89887

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

pylint_plugins/api_models.py

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -147,11 +147,22 @@ def transform(cls: nodes.ClassDef):
147147
if (
148148
isinstance(target, nodes.Subscript)
149149
and target.value.value.name == "schema"
150-
and target.value.slice.value.value == "properties"
151150
):
152-
property_name_node = target.slice.value
151+
if (
152+
isinstance(target.value.slice.value, nodes.Const)
153+
and target.value.slice.value.value == "properties"
154+
):
155+
property_name_node = target.slice.value
156+
elif (
157+
isinstance(target.value.slice, nodes.Const)
158+
and target.value.slice.value == "properties"
159+
):
160+
property_name_node = target.slice
161+
else:
162+
# not schema["properties"]
163+
continue
153164
else:
154-
# not schema["properties"]
165+
# not schema[...]
155166
continue
156167
except AttributeError:
157168
continue

0 commit comments

Comments
 (0)