Skip to content

Commit 09308bf

Browse files
feat: Add command-line seed option for random file shuffling
1 parent f5a607d commit 09308bf

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

test.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,10 @@
33
from tqdm import tqdm
44
import random
55
import time
6-
def main():
6+
import argparse
7+
def main(seed=None):
8+
if seed is not None:
9+
random.seed(seed)
710
lsproxy = Lsproxy(timeout=600)
811
files = lsproxy.list_files()
912
files = [f for f in files if f.endswith(".py")]
@@ -23,4 +26,7 @@ def main():
2326
end = time.time()
2427
print(f"Time taken: {end - start}")
2528
if __name__ == "__main__":
26-
main()
29+
parser = argparse.ArgumentParser()
30+
parser.add_argument("--seed", type=int, help="Random seed for shuffling files")
31+
args = parser.parse_args()
32+
main(args.seed)

0 commit comments

Comments
 (0)