mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-09 15:24:46 +08:00
Remove FileNotFoundError compatibility
This commit is contained in:
@@ -216,11 +216,6 @@ try:
|
|||||||
except ImportError:
|
except ImportError:
|
||||||
from itertools import izip_longest as zip_longest # Python 2 # noqa: F401
|
from itertools import izip_longest as zip_longest # Python 2 # noqa: F401
|
||||||
|
|
||||||
try:
|
|
||||||
FileNotFoundError = FileNotFoundError
|
|
||||||
except NameError:
|
|
||||||
FileNotFoundError = IOError
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
IsADirectoryError = IsADirectoryError
|
IsADirectoryError = IsADirectoryError
|
||||||
except NameError:
|
except NameError:
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import os
|
import os
|
||||||
|
|
||||||
from jedi._compatibility import FileNotFoundError, force_unicode
|
from jedi._compatibility import force_unicode
|
||||||
from jedi.api import classes
|
from jedi.api import classes
|
||||||
from jedi.api.strings import StringName, get_quote_ending
|
from jedi.api.strings import StringName, get_quote_ending
|
||||||
from jedi.api.helpers import match
|
from jedi.api.helpers import match
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ import errno
|
|||||||
import json
|
import json
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
from jedi._compatibility import FileNotFoundError, PermissionError, \
|
from jedi._compatibility import PermissionError, \
|
||||||
IsADirectoryError, NotADirectoryError
|
IsADirectoryError, NotADirectoryError
|
||||||
from jedi import debug
|
from jedi import debug
|
||||||
from jedi.api.environment import get_cached_default_environment, create_environment
|
from jedi.api.environment import get_cached_default_environment, create_environment
|
||||||
|
|||||||
@@ -71,7 +71,7 @@ class ZipFileIO(file_io.KnownContentFileIO, FileIOFolderMixin):
|
|||||||
def get_last_modified(self):
|
def get_last_modified(self):
|
||||||
try:
|
try:
|
||||||
return os.path.getmtime(self._zip_path)
|
return os.path.getmtime(self._zip_path)
|
||||||
except OSError: # Python 3 would probably only need FileNotFoundError
|
except (FileNotFoundError, PermissionError):
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ from collections import namedtuple
|
|||||||
|
|
||||||
from jedi import settings
|
from jedi import settings
|
||||||
from jedi.file_io import FileIO
|
from jedi.file_io import FileIO
|
||||||
from jedi._compatibility import FileNotFoundError, cast_path
|
from jedi._compatibility import cast_path
|
||||||
from jedi.parser_utils import get_cached_code_lines
|
from jedi.parser_utils import get_cached_code_lines
|
||||||
from jedi.inference.base_value import ValueSet, NO_VALUES
|
from jedi.inference.base_value import ValueSet, NO_VALUES
|
||||||
from jedi.inference.gradual.stub_value import TypingModuleWrapper, StubModuleValue
|
from jedi.inference.gradual.stub_value import TypingModuleWrapper, StubModuleValue
|
||||||
@@ -38,8 +38,7 @@ def _create_stub_map(directory_path_info):
|
|||||||
def generate():
|
def generate():
|
||||||
try:
|
try:
|
||||||
listed = os.listdir(directory_path_info.path)
|
listed = os.listdir(directory_path_info.path)
|
||||||
except (FileNotFoundError, OSError):
|
except FileNotFoundError:
|
||||||
# OSError is Python 2
|
|
||||||
return
|
return
|
||||||
|
|
||||||
for entry in listed:
|
for entry in listed:
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ import os
|
|||||||
from parso.python import tree
|
from parso.python import tree
|
||||||
from parso.tree import search_ancestor
|
from parso.tree import search_ancestor
|
||||||
|
|
||||||
from jedi._compatibility import ImplicitNSInfo, force_unicode, FileNotFoundError
|
from jedi._compatibility import ImplicitNSInfo, force_unicode
|
||||||
from jedi import debug
|
from jedi import debug
|
||||||
from jedi import settings
|
from jedi import settings
|
||||||
from jedi.file_io import FolderIO
|
from jedi.file_io import FolderIO
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ import re
|
|||||||
|
|
||||||
from parso import python_bytes_to_unicode
|
from parso import python_bytes_to_unicode
|
||||||
|
|
||||||
from jedi._compatibility import FileNotFoundError
|
|
||||||
from jedi.debug import dbg
|
from jedi.debug import dbg
|
||||||
from jedi.file_io import KnownContentFileIO
|
from jedi.file_io import KnownContentFileIO
|
||||||
from jedi.inference.imports import SubModuleName, load_module_from_path
|
from jedi.inference.imports import SubModuleName, load_module_from_path
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
from parso.python.tree import search_ancestor
|
from parso.python.tree import search_ancestor
|
||||||
from jedi._compatibility import FileNotFoundError
|
|
||||||
from jedi.inference.cache import inference_state_method_cache
|
from jedi.inference.cache import inference_state_method_cache
|
||||||
from jedi.inference.imports import load_module_from_path
|
from jedi.inference.imports import load_module_from_path
|
||||||
from jedi.inference.filters import ParserTreeFilter
|
from jedi.inference.filters import ParserTreeFilter
|
||||||
|
|||||||
Reference in New Issue
Block a user