Skip to content

Commit ff7d99e

Browse files
committed
YDA-5992: cleanup and replace itertools.ifilter with filter
1 parent dfb2ae9 commit ff7d99e

File tree

2 files changed

+4
-9
lines changed

2 files changed

+4
-9
lines changed

util/collection.py

+1-3
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,7 @@
55

66
import itertools
77
import json
8-
import sys
9-
if sys.version_info > (2, 7):
10-
from functools import reduce
8+
from functools import reduce
119

1210
import genquery
1311
import irods_types

vault.py

+3-6
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
__copyright__ = 'Copyright (c) 2019-2024, Utrecht University'
44
__license__ = 'GPLv3, see LICENSE'
55

6-
import itertools
76
import os
87
import re
98
import subprocess
@@ -264,13 +263,13 @@ def api_vault_preservable_formats_lists(ctx):
264263

265264
@api.make()
266265
def api_vault_unpreservable_files(ctx, coll, list_name):
267-
"""Retrieve the set of unpreservable file formats in a collection.
266+
"""Retrieve list of unpreservable file formats in a collection.
268267
269268
:param ctx: Combined type of a callback and rei struct
270269
:param coll: Collection of folder to check
271270
:param list_name: Name of preservable file format list
272271
273-
:returns: Set of unpreservable file formats
272+
:returns: List of unpreservable file formats
274273
"""
275274
space, zone, _, _ = pathutil.info(coll)
276275
if space not in [pathutil.Space.RESEARCH, pathutil.Space.VAULT]:
@@ -285,9 +284,7 @@ def api_vault_unpreservable_files(ctx, coll, list_name):
285284
collection.data_objects(ctx, coll, recursive=True))
286285

287286
# Exclude Yoda metadata files
288-
data_names = itertools.ifilter(lambda
289-
x: not re.match(r"yoda\-metadata(\[\d+\])?\.(xml|json)", x),
290-
data_names)
287+
data_names = filter(lambda x: not re.match(r"yoda\-metadata(\[\d+\])?\.(xml|json)", x), data_names)
291288

292289
# Data names -> lowercase extensions, without the dot.
293290
exts = set(list(map(lambda x: os.path.splitext(x)[1][1:].lower(), data_names)))

0 commit comments

Comments
 (0)