pgrouphelpers

This commit is contained in:
2022-07-05 15:48:54 +02:00
parent f7f30bdd55
commit 161e5b5a9d
2 changed files with 65 additions and 0 deletions

33
name2pgroups Executable file
View File

@@ -0,0 +1,33 @@
#!/sf/bernina/applications/bm/envs/default/bin/python
import sys
from pathlib import Path
name = sys.argv[1]
def name2pgrous(name):
tp = '/sf/bernina/exp/'
d = Path(tp)
dirs = [i for i in d.glob('*') if i.is_symlink()]
names = [i.name for i in dirs]
targets = [i.resolve().name for i in dirs]
return [[i_n,i_p] for i_n,i_p in zip(names,targets) if name in i_n]
for i in name2pgrous(name):
print(*i)

32
pgroup2name Executable file
View File

@@ -0,0 +1,32 @@
#!/sf/bernina/applications/bm/envs/default/bin/python
import sys
from pathlib import Path
pgroup = sys.argv[1]
def pgroup2name(pgroup):
tp = '/sf/bernina/exp/'
d = Path(tp)
dirs = [i for i in d.glob('*') if i.is_symlink()]
names = [i.name for i in dirs]
targets = [i.resolve().name for i in dirs]
return names[targets.index(pgroup)]
print(pgroup2name(pgroup))