style: split out the user list func

This commit is contained in:
TING-JUN WANG 2024-04-29 22:30:48 +08:00
parent 7662f289dc
commit d367127b4e

36
src/users.py Normal file
View File

@ -0,0 +1,36 @@
import os
def get_master():
ans = []
for year in os.listdir(f'/volume2/m3/master/'):
if os.path.isdir(f'/volume2/m3/master/{year}'):
for user in os.listdir(f'/volume2/m3/master/{year}'):
ans.append(f'/volume2/m3/master/{year}/{user}')
for user in os.listdir(f'/volume2/m3/master08'):
ans.append(f'/volume2/m3/master08/{user}')
for user in os.listdir(f'/volume2/m3/master09'):
ans.append(f'/volume2/m3/master09/{user}')
return ans
def get_phd():
ans = []
for dir_name in os.listdir(f'/volume2/m3/phd/'):
if dir_name.isnumeric():
year = dir_name
for user in os.listdir(f'/volume2/m3/phd/{year}'):
ans.append(f'/volume2/m3/phd/{year}/{user}')
else:
ans.append(f'/volume2/m3/phd/{dir_name}')
return ans
def get_ra():
ans = []
for user in os.listdir(f'/volume2/m3/ra/'):
ans.append(f'/volume2/m3/ra/{user}')
return ans
def get_extra():
ans = []
for user in os.listdir(f'/volume2/m3/extra/'):
ans.append(f'/volume2/m3/extra/{user}')
return ans