Skip to content

Commit 6fd061c

Browse files
committed
Add support Python 3.9, 3.10
1 parent 557fafc commit 6fd061c

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

.github/workflows/tests.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414

1515
strategy:
1616
matrix:
17-
python-version: [3.6, 3.7, 3.8]
17+
python-version: ["3.6", "3.7", "3.8", "3.9", "3.10"]
1818

1919
steps:
2020
- name: Checkout repo

string_extractor/string_collector.py

+4-3
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ def _isStringClass(self, c):
2222
className = str(type(c))
2323
if className in ["<class '_ast.Str'>", "<class 'str'>"]:
2424
return True
25-
elif ( className == "<class '_ast.Constant'>" and
25+
elif ( className in [ "<class '_ast.Constant'>", "<class 'ast.Constant'>" ] and
2626
str(type(c.value)) == "<class 'str'>" ):
2727
return True
2828
else:
@@ -36,14 +36,15 @@ def _getStringValue(self, c):
3636

3737
def visit_Compare(self, node):
3838
opstype = str(type(node.ops[0]))
39-
if opstype in ["<class '_ast.Eq'>","<class '_ast.NotEq'>"]:
39+
if opstype in ["<class '_ast.Eq'>","<class '_ast.NotEq'>",
40+
"<class 'ast.Eq'>" ,"<class 'ast.NotEq'>" ]:
4041
left = node.left
4142
right = node.comparators[0]
4243
if self._isStringClass(left) and not self._isStringClass(right):
4344
self.fullStrings.add(self._getStringValue(left))
4445
elif (not self._isStringClass(left)) and self._isStringClass(right):
4546
self.fullStrings.add(self._getStringValue(right))
46-
elif opstype == "<class '_ast.In'>":
47+
elif opstype in ["<class '_ast.In'>", "<class 'ast.In'>"]:
4748
left = node.left
4849
comparators = node.comparators
4950
if self._isStringClass(left):

0 commit comments

Comments
 (0)