summaryrefslogtreecommitdiff
path: root/isort/compat.py
diff options
context:
space:
mode:
authorJon Dufresne <jon.dufresne@gmail.com>2019-08-14 03:53:12 -0700
committerTimothy Edmund Crosley <timothy.crosley@gmail.com>2019-08-14 08:26:04 -0700
commit6c0ec9f62f8d1d33f8b10d032a499c3e6dff5ff0 (patch)
treed2f244b28f1b2a35078dcb1bd9c51aba7d2b79af /isort/compat.py
parent2a6700f619c22f2a26560a10781e389e37fa2dc4 (diff)
downloadisort-6c0ec9f62f8d1d33f8b10d032a499c3e6dff5ff0.tar.gz
Specify targeted Python version to mypy
Discovered a typing bug where a Path object was passed to os.path.relpath(), but Path support was not added until Python 3.6. https://docs.python.org/3/library/os.path.html#os.path.relpath > Changed in version 3.6: Accepts a path-like object.
Diffstat (limited to 'isort/compat.py')
-rw-r--r--isort/compat.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/isort/compat.py b/isort/compat.py
index 2d6317ba..9f618636 100644
--- a/isort/compat.py
+++ b/isort/compat.py
@@ -95,7 +95,8 @@ class SortImports(object):
absolute_file_path = resolve(file_path)
if check_skip:
if run_path and run_path in absolute_file_path.parents:
- file_name = os.path.relpath(absolute_file_path, run_path)
+ # TODO: Drop str() when isort is Python 3.6+.
+ file_name = os.path.relpath(str(absolute_file_path), run_path)
else:
file_name = str(absolute_file_path)
run_path = ''