diff --git a/.github/codecov.yml b/.github/codecov.yml
index 0e46a9bd..b0bee6fe 100644
--- a/.github/codecov.yml
+++ b/.github/codecov.yml
@@ -4,10 +4,7 @@ coverage:
patch: yes
changes: yes
-comment:
- layout: "reach, diff, files"
- behavior: default
- require_changes: no
+comment: false
ignore:
- "setup.py"
diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
index 28d48bde..6a60265c 100644
--- a/.github/workflows/test.yml
+++ b/.github/workflows/test.yml
@@ -6,7 +6,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
- python-version: [3.6, 3.7, 3.8]
+ python-version: [3.6, 3.7, 3.8, 3.9]
steps:
- uses: actions/checkout@v2.3.4
@@ -20,7 +20,7 @@ jobs:
run: |
python -m pip install --upgrade pip
python -m pip install -r requirements-dev.txt
- python -m pip install pytest==6.1.1 pytest-cov==2.10.1
+ python -m pip install pytest==6.2.2 pytest-cov==2.11.1
- name: Test with pytest
run: |
diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md
index 4cdf2ee8..42ed80cc 100644
--- a/docs/CHANGELOG.md
+++ b/docs/CHANGELOG.md
@@ -2,6 +2,10 @@
All notable changes to this project will be documented in this file.
+## [0.7.2] - 31/January/2021
+
+- [Python3.9 Support](https://github.com/hakancelik96/unimport/pull/166)
+
## [0.7.1] - 1/January/2021/
- [Fix by @hakancelik96 #127](https://github.com/hakancelik96/unimport/pull/161)
diff --git a/docs/_coverpage.md b/docs/_coverpage.md
index 0b7c7a28..7f123834 100644
--- a/docs/_coverpage.md
+++ b/docs/_coverpage.md
@@ -1,6 +1,6 @@
-# ![logo](_media/icon.png ":size=30%") 0.7.1
+# ![logo](_media/icon.png ":size=30%") 0.7.2
> A linter, formatter for finding and removing unused import statements.
diff --git a/requirements-dev.txt b/requirements-dev.txt
index 6dd75c4c..30218526 100644
--- a/requirements-dev.txt
+++ b/requirements-dev.txt
@@ -1,7 +1,7 @@
-importlib_metadata==2.0.0
-libcst==0.3.13
-pathspec==0.8.0
-pytest
-pytest-cov
+importlib_metadata==3.4.0
+libcst==0.3.16
+pathspec==0.8.1
+pytest==6.2.2
+pytest-cov==2.11.1
semantic-version==2.8.5
-toml==0.10.1
+toml==0.10.2
diff --git a/setup.py b/setup.py
index ea2b4b7f..c75de90a 100644
--- a/setup.py
+++ b/setup.py
@@ -5,7 +5,7 @@
import unimport.constants as C
-assert sys.version_info >= (3, 6, 0), "unimport requires Python 3.6+"
+assert sys.version_info >= (3, 6), "unimport requires Python 3.6+"
CURRENT_DIR = Path(__file__).parent
@@ -32,13 +32,13 @@ def get_long_description():
},
license="MIT",
license_file="LICENSE",
- python_requires=">=3.6.0",
+ python_requires=">=3.6",
packages=["unimport"],
install_requires=[
- "libcst==0.3.13",
- "pathspec==0.8.0",
- "toml==0.10.1",
- "importlib_metadata==2.0.0",
+ "libcst==0.3.16",
+ "pathspec==0.8.1",
+ "toml==0.10.2",
+ "importlib_metadata==3.4.0",
],
extras_require={},
zip_safe=False,
@@ -53,6 +53,7 @@ def get_long_description():
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
+ "Programming Language :: Python :: 3.9",
"Programming Language :: Python :: Implementation :: CPython",
],
entry_points={"console_scripts": ["unimport = unimport.__main__:main"]},
diff --git a/tox.ini b/tox.ini
index 9d481c28..88b89d14 100644
--- a/tox.ini
+++ b/tox.ini
@@ -4,7 +4,7 @@
# and then run "tox" from this directory.
[tox]
-envlist = py36, py37, py38, pre-commit
+envlist = py36, py37, py38, py39, pre-commit
[testenv]
deps = -rrequirements-dev.txt
diff --git a/unimport/constants.py b/unimport/constants.py
index fe2063b3..1655822c 100644
--- a/unimport/constants.py
+++ b/unimport/constants.py
@@ -30,9 +30,10 @@
DESCRIPTION = (
"A linter, formatter for finding and removing unused import statements."
)
-VERSION = "0.7.1"
+VERSION = "0.7.2"
PY38_PLUS = sys.version_info >= (3, 8)
+PY39_PLUS = sys.version_info >= (3, 9)
SUBSCRIPT_TYPE_VARIABLE = frozenset(
{
diff --git a/unimport/scan.py b/unimport/scan.py
index 3691ef21..bc69b783 100644
--- a/unimport/scan.py
+++ b/unimport/scan.py
@@ -232,13 +232,19 @@ def visit_constant_str(node: Union[ast.Constant, ast.Str]) -> None:
isinstance(node.value, ast.Name)
and node.value.id in C.SUBSCRIPT_TYPE_VARIABLE
):
- if isinstance(node.slice.value, ast.Tuple): # type: ignore
- for elt in node.slice.value.elts: # type: ignore
+
+ if C.PY39_PLUS:
+ _slice = node.slice
+ else:
+ _slice = node.slice.value # type: ignore
+
+ if isinstance(_slice, ast.Tuple): # type: ignore
+ for elt in _slice.elts: # type: ignore
if isinstance(elt, (ast.Constant, ast.Str)):
visit_constant_str(elt)
else:
- if isinstance(node.slice.value, (ast.Constant, ast.Str)): # type: ignore
- visit_constant_str(node.slice.value) # type: ignore
+ if isinstance(_slice, (ast.Constant, ast.Str)): # type: ignore
+ visit_constant_str(_slice) # type: ignore
@recursive
def visit_Call(self, node: ast.Call) -> None: