Merge branch 'revert-6b0e0222' into 'develop'

Revert "Merge branch 'fix-import-python-3-5' into 'develop'"

See merge request funkwhale/funkwhale!1132
This commit is contained in:
Agate 2020-06-05 06:14:51 +02:00
commit b52c9f98bc
2 changed files with 11 additions and 21 deletions

View File

@ -23,30 +23,21 @@ from funkwhale_api.common import utils as common_utils
from funkwhale_api.music import models, tasks, utils
def dir_scanner(scanner, extensions, recursive, ignored):
for entry in scanner:
if entry.is_file():
for e in extensions:
if entry.name.lower().endswith(".{}".format(e.lower())):
if entry.path not in ignored:
yield entry.path
elif recursive and entry.is_dir():
yield from dir_scanner(
entry, extensions, recursive=recursive, ignored=ignored
)
def crawl_dir(dir, extensions, recursive=True, ignored=[]):
if os.path.isfile(dir):
yield dir
return
else:
try:
scanner = os.scandir(dir)
yield from dir_scanner(scanner, extensions, recursive, ignored)
finally:
if hasattr(scanner, "close"):
scanner.close()
with os.scandir(dir) as scanner:
for entry in scanner:
if entry.is_file():
for e in extensions:
if entry.name.lower().endswith(".{}".format(e.lower())):
if entry.path not in ignored:
yield entry.path
elif recursive and entry.is_dir():
yield from crawl_dir(
entry, extensions, recursive=recursive, ignored=ignored
)
def batch(iterable, n=1):

View File

@ -1 +0,0 @@
Fixed an issue where in-place importing didn't work for directories on machines running Python 3.5 (#1148, #1147)