summaryrefslogtreecommitdiff
path: root/dev-util/vint/files/vint-0.3.21-fix-py3.8.patch
blob: af97c51cf2c4ae5751929698837987cc4f291279 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
From f8bae710ba74dcc55a3b95995fe73139cf949b75 Mon Sep 17 00:00:00 2001
From: Daniel Hahler <git@thequod.de>
Date: Mon, 25 Nov 2019 06:41:39 +0100
Subject: [PATCH] Fix SyntaxWarning with py38 (#334)

> SyntaxWarning: "is not" with a literal. Did you mean "!="?
--- a/vint/ast/plugin/scope_plugin/scope_linker.py
+++ b/vint/ast/plugin/scope_plugin/scope_linker.py
@@ -406,14 +406,17 @@ def _handle_function_node(self, func_node):  # type: (Dict[str, Any]) -> None
         # We can access "a:firstline" and "a:lastline" if the function is
         # declared with an attribute "range". See :func-range
         attr = func_node['attr']
-        is_declared_with_range = attr['range'] is not 0
+        is_declared_with_range = attr['range'] != 0
         if is_declared_with_range:
             self._scope_tree_builder.handle_new_range_parameters_found()

         # We can access "l:self" is declared with an attribute "dict" or
         # the function is a member of a dict. See :help self
-        is_declared_with_dict = attr['dict'] is not 0 \
-            or NodeType(func_name_node['type']) in FunctionNameNodesDeclaringVariableSelf
+        is_declared_with_dict = (
+            attr["dict"] != 0
+            or NodeType(func_name_node["type"])
+            in FunctionNameNodesDeclaringVariableSelf
+        )
         if is_declared_with_dict:
             self._scope_tree_builder.handle_new_dict_parameter_found()