Revert "Merge branch 'fix-import-python-3-5' into 'develop'"
This reverts merge request !1129
This commit is contained in:
parent
6b0e022286
commit
ddb75c06ca
|
@ -23,7 +23,11 @@ from funkwhale_api.common import utils as common_utils
|
||||||
from funkwhale_api.music import models, tasks, utils
|
from funkwhale_api.music import models, tasks, utils
|
||||||
|
|
||||||
|
|
||||||
def dir_scanner(scanner, extensions, recursive, ignored):
|
def crawl_dir(dir, extensions, recursive=True, ignored=[]):
|
||||||
|
if os.path.isfile(dir):
|
||||||
|
yield dir
|
||||||
|
return
|
||||||
|
with os.scandir(dir) as scanner:
|
||||||
for entry in scanner:
|
for entry in scanner:
|
||||||
if entry.is_file():
|
if entry.is_file():
|
||||||
for e in extensions:
|
for e in extensions:
|
||||||
|
@ -31,24 +35,11 @@ def dir_scanner(scanner, extensions, recursive, ignored):
|
||||||
if entry.path not in ignored:
|
if entry.path not in ignored:
|
||||||
yield entry.path
|
yield entry.path
|
||||||
elif recursive and entry.is_dir():
|
elif recursive and entry.is_dir():
|
||||||
yield from dir_scanner(
|
yield from crawl_dir(
|
||||||
entry, extensions, recursive=recursive, ignored=ignored
|
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()
|
|
||||||
|
|
||||||
|
|
||||||
def batch(iterable, n=1):
|
def batch(iterable, n=1):
|
||||||
has_entries = True
|
has_entries = True
|
||||||
while has_entries:
|
while has_entries:
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
Fixed an issue where in-place importing didn't work for directories on machines running Python 3.5 (#1148, #1147)
|
|
Loading…
Reference in New Issue