diff --git a/parso/_compatibility.py b/parso/_compatibility.py index 0f1c85b..485a0b4 100644 --- a/parso/_compatibility.py +++ b/parso/_compatibility.py @@ -2,7 +2,6 @@ To ensure compatibility from Python ``2.7`` - ``3.3``, a module has been created. Clearly there is huge need to use conforming syntax. """ -import os import sys import platform @@ -42,28 +41,3 @@ def u(string): if not isinstance(string, unicode): return unicode(str(string), 'UTF-8') return string - - -if sys.version_info < (3, 5): - """ - A super-minimal shim around listdir that behave like - scandir for the information we need. - """ - class _DirEntry: - - def __init__(self, name, basepath): - self.name = name - self.basepath = basepath - - @property - def path(self): - return os.path.join(self.basepath, self.name) - - def stat(self): - # won't follow symlinks - return os.lstat(os.path.join(self.basepath, self.name)) - - def scandir(dir): - return [_DirEntry(name, dir) for name in os.listdir(dir)] -else: - from os import scandir diff --git a/parso/cache.py b/parso/cache.py index d9be412..324f82a 100644 --- a/parso/cache.py +++ b/parso/cache.py @@ -14,7 +14,6 @@ try: except: import pickle -from parso._compatibility import scandir from parso.file_io import FileIO LOG = logging.getLogger(__name__) @@ -232,7 +231,7 @@ def clear_inactive_cache( version_path = os.path.join(cache_path, version_path) if not os.path.isdir(version_path): continue - for file in scandir(version_path): + for file in os.scandir(version_path): if ( file.stat().st_atime + _CACHED_FILE_MAXIMUM_SURVIVAL <= time.time()