diff options
| author | Pierre Sassoulas <pierre.sassoulas@gmail.com> | 2021-03-30 23:40:38 +0200 |
|---|---|---|
| committer | Pierre Sassoulas <pierre.sassoulas@gmail.com> | 2021-03-31 00:01:42 +0200 |
| commit | 3a2a579d1561c6248862e8573b8740c1d9d13e8e (patch) | |
| tree | 5b4886214928ebcd51ab05b984cda69391e77fa3 | |
| parent | da599c68b07694213666660e8e9f06afb88ef7ec (diff) | |
| download | pylint-git-3a2a579d1561c6248862e8573b8740c1d9d13e8e.tar.gz | |
Make import from os.path more explicit
| -rwxr-xr-x | pylint/epylint.py | 17 | ||||
| -rw-r--r-- | pylint/graph.py | 7 |
2 files changed, 12 insertions, 12 deletions
diff --git a/pylint/epylint.py b/pylint/epylint.py index b273b0bad..849955cee 100755 --- a/pylint/epylint.py +++ b/pylint/epylint.py @@ -59,7 +59,6 @@ import os import shlex import sys from io import StringIO -from os import path as osp from subprocess import PIPE, Popen @@ -88,13 +87,15 @@ def lint(filename, options=()): the tree) """ # traverse downwards until we are out of a python package - full_path = osp.abspath(filename) - parent_path = osp.dirname(full_path) - child_path = osp.basename(full_path) + full_path = os.path.abspath(filename) + parent_path = os.path.dirname(full_path) + child_path = os.path.basename(full_path) - while parent_path != "/" and osp.exists(osp.join(parent_path, "__init__.py")): - child_path = osp.join(osp.basename(parent_path), child_path) - parent_path = osp.dirname(parent_path) + while parent_path != "/" and os.path.exists( + os.path.join(parent_path, "__init__.py") + ): + child_path = os.path.join(os.path.basename(parent_path), child_path) + parent_path = os.path.dirname(parent_path) # Start pylint # Ensure we use the python and pylint associated with the running epylint @@ -189,7 +190,7 @@ def Run(): if len(sys.argv) == 1: print("Usage: %s <filename> [options]" % sys.argv[0]) sys.exit(1) - elif not osp.exists(sys.argv[1]): + elif not os.path.exists(sys.argv[1]): print("%s does not exist" % sys.argv[1]) sys.exit(1) else: diff --git a/pylint/graph.py b/pylint/graph.py index b5c36fa52..519012f87 100644 --- a/pylint/graph.py +++ b/pylint/graph.py @@ -23,14 +23,13 @@ import shutil import subprocess import sys import tempfile -from os import path as osp def target_info_from_filename(filename): """Transforms /some/path/foo.png into ('/some/path', 'foo.png', 'png').""" - basename = osp.basename(filename) - storedir = osp.dirname(osp.abspath(filename)) - target = osp.splitext(filename)[-1][1:] + basename = os.path.basename(filename) + storedir = os.path.dirname(os.path.abspath(filename)) + target = os.path.splitext(filename)[-1][1:] return storedir, basename, target |
