Skip to content

Commit 4ba11d8

Browse files
committed
Purely aesthetic: calculate column width in the output of icatsummary.py
example script dynamically the maximum length of entity type name
1 parent a11d015 commit 4ba11d8

8 files changed

Lines changed: 281 additions & 281 deletions

File tree

doc/examples/icatsummary.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
print("User: %s" % client.getUserName())
1919
print()
2020

21-
entitycolwidth = 27
21+
entitycolwidth = max(len(e) for e in client.typemap.keys())
2222
print("%-*s %s" % (entitycolwidth, "Entity", "count"))
2323
print("-" * (entitycolwidth + 3 + 5))
2424
for entityname in client.getEntityNames():

tests/data/summary-4

Lines changed: 40 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,43 @@
11
User: simple/root
22

3-
Entity count
4-
-----------------------------------
5-
Application : 1
6-
DataCollection : 3
7-
DataCollectionDatafile : 3
8-
DataCollectionDataset : 4
9-
DataCollectionParameter : 1
10-
Datafile : 10
11-
DatafileFormat : 6
12-
DatafileParameter : 10
13-
Dataset : 8
14-
DatasetParameter : 6
15-
DatasetType : 3
16-
Facility : 1
17-
FacilityCycle : 20
18-
Grouping : 13
19-
Instrument : 3
20-
InstrumentScientist : 3
21-
Investigation : 3
22-
InvestigationGroup : 9
23-
InvestigationInstrument : 3
24-
InvestigationParameter : 3
25-
InvestigationType : 5
26-
InvestigationUser : 5
27-
Job : 1
28-
Keyword : 9
29-
ParameterType : 9
30-
PermissibleStringValue : 6
31-
PublicStep : 24
32-
Publication : 1
33-
RelatedDatafile : 1
34-
Rule : 111
35-
Sample : 3
36-
SampleParameter : 2
37-
SampleType : 3
38-
Shift : 4
39-
Study : 1
40-
StudyInvestigation : 2
41-
User : 10
42-
UserGroup : 17
3+
Entity count
4+
-------------------------------
5+
Application : 1
6+
DataCollection : 3
7+
DataCollectionDatafile : 3
8+
DataCollectionDataset : 4
9+
DataCollectionParameter : 1
10+
Datafile : 10
11+
DatafileFormat : 6
12+
DatafileParameter : 10
13+
Dataset : 8
14+
DatasetParameter : 6
15+
DatasetType : 3
16+
Facility : 1
17+
FacilityCycle : 20
18+
Grouping : 13
19+
Instrument : 3
20+
InstrumentScientist : 3
21+
Investigation : 3
22+
InvestigationGroup : 9
23+
InvestigationInstrument : 3
24+
InvestigationParameter : 3
25+
InvestigationType : 5
26+
InvestigationUser : 5
27+
Job : 1
28+
Keyword : 9
29+
ParameterType : 9
30+
PermissibleStringValue : 6
31+
PublicStep : 24
32+
Publication : 1
33+
RelatedDatafile : 1
34+
Rule : 111
35+
Sample : 3
36+
SampleParameter : 2
37+
SampleType : 3
38+
Shift : 4
39+
Study : 1
40+
StudyInvestigation : 2
41+
User : 10
42+
UserGroup : 17
4343

tests/data/summary-4.acord

Lines changed: 40 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,43 @@
11
User: db/acord
22

3-
Entity count
4-
-----------------------------------
5-
Application : 1
6-
DataCollection : 0
7-
DataCollectionDatafile : 0
8-
DataCollectionDataset : 0
9-
DataCollectionParameter : 0
10-
Datafile : 10
11-
DatafileFormat : 6
12-
DatafileParameter : 10
13-
Dataset : 8
14-
DatasetParameter : 6
15-
DatasetType : 3
16-
Facility : 1
17-
FacilityCycle : 20
18-
Grouping : 1
19-
Instrument : 3
20-
InstrumentScientist : 0
21-
Investigation : 3
22-
InvestigationGroup : 0
23-
InvestigationInstrument : 0
24-
InvestigationParameter : 3
25-
InvestigationType : 5
26-
InvestigationUser : 0
27-
Job : 0
28-
Keyword : 9
29-
ParameterType : 9
30-
PermissibleStringValue : 6
31-
PublicStep : 0
32-
Publication : 1
33-
RelatedDatafile : 0
34-
Rule : 0
35-
Sample : 3
36-
SampleParameter : 2
37-
SampleType : 3
38-
Shift : 4
39-
Study : 0
40-
StudyInvestigation : 0
41-
User : 10
42-
UserGroup : 0
3+
Entity count
4+
-------------------------------
5+
Application : 1
6+
DataCollection : 0
7+
DataCollectionDatafile : 0
8+
DataCollectionDataset : 0
9+
DataCollectionParameter : 0
10+
Datafile : 10
11+
DatafileFormat : 6
12+
DatafileParameter : 10
13+
Dataset : 8
14+
DatasetParameter : 6
15+
DatasetType : 3
16+
Facility : 1
17+
FacilityCycle : 20
18+
Grouping : 1
19+
Instrument : 3
20+
InstrumentScientist : 0
21+
Investigation : 3
22+
InvestigationGroup : 0
23+
InvestigationInstrument : 0
24+
InvestigationParameter : 3
25+
InvestigationType : 5
26+
InvestigationUser : 0
27+
Job : 0
28+
Keyword : 9
29+
ParameterType : 9
30+
PermissibleStringValue : 6
31+
PublicStep : 0
32+
Publication : 1
33+
RelatedDatafile : 0
34+
Rule : 0
35+
Sample : 3
36+
SampleParameter : 2
37+
SampleType : 3
38+
Shift : 4
39+
Study : 0
40+
StudyInvestigation : 0
41+
User : 10
42+
UserGroup : 0
4343

tests/data/summary-4.ahau

Lines changed: 40 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,43 @@
11
User: db/ahau
22

3-
Entity count
4-
-----------------------------------
5-
Application : 1
6-
DataCollection : 0
7-
DataCollectionDatafile : 0
8-
DataCollectionDataset : 0
9-
DataCollectionParameter : 0
10-
Datafile : 4
11-
DatafileFormat : 6
12-
DatafileParameter : 4
13-
Dataset : 3
14-
DatasetParameter : 4
15-
DatasetType : 3
16-
Facility : 1
17-
FacilityCycle : 20
18-
Grouping : 3
19-
Instrument : 3
20-
InstrumentScientist : 0
21-
Investigation : 1
22-
InvestigationGroup : 0
23-
InvestigationInstrument : 0
24-
InvestigationParameter : 1
25-
InvestigationType : 5
26-
InvestigationUser : 0
27-
Job : 0
28-
Keyword : 4
29-
ParameterType : 9
30-
PermissibleStringValue : 6
31-
PublicStep : 0
32-
Publication : 1
33-
RelatedDatafile : 0
34-
Rule : 0
35-
Sample : 1
36-
SampleParameter : 1
37-
SampleType : 3
38-
Shift : 2
39-
Study : 0
40-
StudyInvestigation : 0
41-
User : 10
42-
UserGroup : 4
3+
Entity count
4+
-------------------------------
5+
Application : 1
6+
DataCollection : 0
7+
DataCollectionDatafile : 0
8+
DataCollectionDataset : 0
9+
DataCollectionParameter : 0
10+
Datafile : 4
11+
DatafileFormat : 6
12+
DatafileParameter : 4
13+
Dataset : 3
14+
DatasetParameter : 4
15+
DatasetType : 3
16+
Facility : 1
17+
FacilityCycle : 20
18+
Grouping : 3
19+
Instrument : 3
20+
InstrumentScientist : 0
21+
Investigation : 1
22+
InvestigationGroup : 0
23+
InvestigationInstrument : 0
24+
InvestigationParameter : 1
25+
InvestigationType : 5
26+
InvestigationUser : 0
27+
Job : 0
28+
Keyword : 4
29+
ParameterType : 9
30+
PermissibleStringValue : 6
31+
PublicStep : 0
32+
Publication : 1
33+
RelatedDatafile : 0
34+
Rule : 0
35+
Sample : 1
36+
SampleParameter : 1
37+
SampleType : 3
38+
Shift : 2
39+
Study : 0
40+
StudyInvestigation : 0
41+
User : 10
42+
UserGroup : 4
4343

tests/data/summary-4.jbotu

Lines changed: 40 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,43 @@
11
User: db/jbotu
22

3-
Entity count
4-
-----------------------------------
5-
Application : 1
6-
DataCollection : 1
7-
DataCollectionDatafile : 1
8-
DataCollectionDataset : 2
9-
DataCollectionParameter : 0
10-
Datafile : 5
11-
DatafileFormat : 6
12-
DatafileParameter : 5
13-
Dataset : 5
14-
DatasetParameter : 4
15-
DatasetType : 3
16-
Facility : 1
17-
FacilityCycle : 20
18-
Grouping : 4
19-
Instrument : 3
20-
InstrumentScientist : 0
21-
Investigation : 2
22-
InvestigationGroup : 0
23-
InvestigationInstrument : 0
24-
InvestigationParameter : 2
25-
InvestigationType : 5
26-
InvestigationUser : 0
27-
Job : 0
28-
Keyword : 5
29-
ParameterType : 9
30-
PermissibleStringValue : 6
31-
PublicStep : 0
32-
Publication : 1
33-
RelatedDatafile : 0
34-
Rule : 0
35-
Sample : 2
36-
SampleParameter : 1
37-
SampleType : 3
38-
Shift : 3
39-
Study : 0
40-
StudyInvestigation : 0
41-
User : 10
42-
UserGroup : 4
3+
Entity count
4+
-------------------------------
5+
Application : 1
6+
DataCollection : 1
7+
DataCollectionDatafile : 1
8+
DataCollectionDataset : 2
9+
DataCollectionParameter : 0
10+
Datafile : 5
11+
DatafileFormat : 6
12+
DatafileParameter : 5
13+
Dataset : 5
14+
DatasetParameter : 4
15+
DatasetType : 3
16+
Facility : 1
17+
FacilityCycle : 20
18+
Grouping : 4
19+
Instrument : 3
20+
InstrumentScientist : 0
21+
Investigation : 2
22+
InvestigationGroup : 0
23+
InvestigationInstrument : 0
24+
InvestigationParameter : 2
25+
InvestigationType : 5
26+
InvestigationUser : 0
27+
Job : 0
28+
Keyword : 5
29+
ParameterType : 9
30+
PermissibleStringValue : 6
31+
PublicStep : 0
32+
Publication : 1
33+
RelatedDatafile : 0
34+
Rule : 0
35+
Sample : 2
36+
SampleParameter : 1
37+
SampleType : 3
38+
Shift : 3
39+
Study : 0
40+
StudyInvestigation : 0
41+
User : 10
42+
UserGroup : 4
4343

0 commit comments

Comments
 (0)