Skip to content

Commit 28862bb

Browse files
committed
Remove unused keep flag from LRUShards and ShardListDataset
1 parent 62ac192 commit 28862bb

2 files changed

Lines changed: 7 additions & 8 deletions

File tree

src/wids/wids.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -283,11 +283,10 @@ class LRUShards:
283283
stores the local names of the shards as keys and the downloaded paths as
284284
values. The shards are downloaded to a directory specified by dldir.
285285
The local name of a shard is computed by the localname function, which
286-
takes the shard URL as an argument. If keep is True, the downloaded files
287-
are not deleted when they are no longer needed.
286+
takes the shard URL as an argument.
288287
"""
289288

290-
def __init__(self, lru_size, keep=False, localname=DefaultLocalname()):
289+
def __init__(self, lru_size, localname=DefaultLocalname()):
291290
self.localname = localname
292291
# the cache contains the local name as the key and the downloaded path as the value
293292
self.lru = LRUCache(lru_size, release_handler=self.release_handler)
@@ -459,7 +458,8 @@ def __init__(
459458

460459
if lru_size > 200:
461460
warnings.warn("LRU size is very large; consider reducing it to avoid running out of file descriptors")
462-
self.cache = LRUShards(lru_size, localname=self.localname, keep=keep)
461+
# instantiate LRU cache of shards (keep flag removed)
462+
self.cache = LRUShards(lru_size, localname=self.localname)
463463

464464
def add_transform(self, transform):
465465
"""Add a transformation to the dataset."""

src/wids/wids.pyi

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,10 +72,9 @@ class LRUShards:
7272
last_missed: bool
7373

7474
def __init__(
75-
self,
76-
lru_size: int,
77-
keep: bool = False,
78-
localname: Callable[[str], str] = ...,
75+
self,
76+
lru_size: int,
77+
localname: Callable[[str], str] = ...,
7978
) -> None: ...
8079

8180
def reset_stats(self) -> None: ...

0 commit comments

Comments
 (0)