Remove FileNotFoundError and PermissionError from _compatibility.py

This commit is contained in:
Dave Halter
2020-07-24 01:24:59 +02:00
parent b601ade90b
commit 736f616787
5 changed files with 4 additions and 20 deletions

View File

@@ -44,20 +44,6 @@ def u(string):
return string
try:
# Python 3.3+
FileNotFoundError = FileNotFoundError
except NameError:
# Python 2.7 (both IOError + OSError)
FileNotFoundError = EnvironmentError
try:
# Python 3.3+
PermissionError = PermissionError
except NameError:
# Python 2.7 (both IOError + OSError)
PermissionError = EnvironmentError
def utf8_repr(func):
"""
``__repr__`` methods in Python 2 don't allow unicode objects to be

View File

@@ -14,7 +14,7 @@ try:
except:
import pickle
from parso._compatibility import FileNotFoundError, PermissionError, scandir
from parso._compatibility import scandir
from parso.file_io import FileIO
LOG = logging.getLogger(__name__)

View File

@@ -1,5 +1,4 @@
import os
from parso._compatibility import FileNotFoundError
class FileIO(object):
@@ -19,8 +18,7 @@ class FileIO(object):
"""
try:
return os.path.getmtime(self.path)
except OSError:
# Might raise FileNotFoundError, OSError for Python 2
except FileNotFoundError:
return None
def _touch(self):

View File

@@ -1,7 +1,7 @@
import hashlib
import os
from parso._compatibility import FileNotFoundError, is_pypy
from parso._compatibility import is_pypy
from parso.pgen2 import generate_grammar
from parso.utils import split_lines, python_bytes_to_unicode, parse_version_string
from parso.python.diff import DiffParser

View File

@@ -13,7 +13,7 @@ from parso.cache import (_CACHED_FILE_MAXIMUM_SURVIVAL, _VERSION_TAG,
_load_from_file_system, _NodeCacheItem,
_remove_cache_and_update_lock, _save_to_file_system,
load_module, parser_cache, try_to_save_module)
from parso._compatibility import is_pypy, PermissionError
from parso._compatibility import is_pypy
from parso import load_grammar
from parso import cache
from parso import file_io