mirror of
https://github.com/morpheus65535/bazarr
synced 2025-03-13 07:32:52 +00:00
Merge pull request #813 from mvanbaak/native-scandir
Use builtin os.scandir if available
This commit is contained in:
commit
e3ee77d6ea
5 changed files with 14 additions and 3 deletions
|
@ -32,7 +32,11 @@ from subliminal.core import guessit, ProviderPool, io, is_windows_special_path,
|
||||||
from subliminal_patch.exceptions import TooManyRequests, APIThrottled
|
from subliminal_patch.exceptions import TooManyRequests, APIThrottled
|
||||||
|
|
||||||
from subzero.language import Language, ENDSWITH_LANGUAGECODE_RE, FULL_LANGUAGE_LIST
|
from subzero.language import Language, ENDSWITH_LANGUAGECODE_RE, FULL_LANGUAGE_LIST
|
||||||
from scandir import scandir, scandir_generic as _scandir_generic
|
try:
|
||||||
|
from os import scandir
|
||||||
|
_scandir_generic = scandir
|
||||||
|
except ImportError:
|
||||||
|
from scandir import scandir, scandir_generic as _scandir_generic
|
||||||
import six
|
import six
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
|
@ -4,7 +4,10 @@ from __future__ import absolute_import
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
from scandir import scandir as _scandir
|
try:
|
||||||
|
from os import scandir as _scandir
|
||||||
|
except ImportError:
|
||||||
|
from scandir import scandir as _scandir
|
||||||
|
|
||||||
# thanks @ plex trakt scrobbler: https://github.com/trakt/Plex-Trakt-Scrobbler/blob/master/Trakttv.bundle/Contents/Libraries/Shared/plugin/core/io.py
|
# thanks @ plex trakt scrobbler: https://github.com/trakt/Plex-Trakt-Scrobbler/blob/master/Trakttv.bundle/Contents/Libraries/Shared/plugin/core/io.py
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,11 @@ import sys
|
||||||
|
|
||||||
from json_tricks.nonp import loads
|
from json_tricks.nonp import loads
|
||||||
from subzero.lib.json import dumps
|
from subzero.lib.json import dumps
|
||||||
from scandir import scandir, scandir_generic as _scandir_generic
|
try:
|
||||||
|
from os import scandir
|
||||||
|
_scandir_generic = scandir
|
||||||
|
except ImportError:
|
||||||
|
from scandir import scandir, scandir_generic as _scandir_generic
|
||||||
from .constants import mode_map
|
from .constants import mode_map
|
||||||
import six
|
import six
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue