@@ -59,13 +59,13 @@ def main():
59
59
if default_project is not None :
60
60
new_workbook = TSC .WorkbookItem (default_project .id )
61
61
new_workbook = server .workbooks .publish (new_workbook , args .publish , overwrite_true )
62
- print ("Workbook published. ID: {}" . format ( new_workbook .id ) )
62
+ print (f "Workbook published. ID: { new_workbook .id } " )
63
63
else :
64
64
print ("Publish failed. Could not find the default project." )
65
65
66
66
# Gets all workbook items
67
67
all_workbooks , pagination_item = server .workbooks .get ()
68
- print ("\n There are {} workbooks on site: " . format ( pagination_item . total_available ) )
68
+ print (f "\n There are { pagination_item . total_available } workbooks on site: " )
69
69
print ([workbook .name for workbook in all_workbooks ])
70
70
71
71
if all_workbooks :
@@ -78,27 +78,22 @@ def main():
78
78
79
79
# Populate views
80
80
server .workbooks .populate_views (sample_workbook )
81
- print ("\n Name of views in {}: " . format ( sample_workbook . name ) )
81
+ print (f "\n Name of views in { sample_workbook . name } : " )
82
82
print ([view .name for view in sample_workbook .views ])
83
83
84
84
# Populate connections
85
85
server .workbooks .populate_connections (sample_workbook )
86
- print ("\n Connections for {}: " .format (sample_workbook .name ))
87
- print (
88
- [
89
- "{0}({1})" .format (connection .id , connection .datasource_name )
90
- for connection in sample_workbook .connections
91
- ]
92
- )
86
+ print (f"\n Connections for { sample_workbook .name } : " )
87
+ print ([f"{ connection .id } ({ connection .datasource_name } )" for connection in sample_workbook .connections ])
93
88
94
89
# Update tags and show_tabs flag
95
90
original_tag_set = set (sample_workbook .tags )
96
91
sample_workbook .tags .update ("a" , "b" , "c" , "d" )
97
92
sample_workbook .show_tabs = True
98
93
server .workbooks .update (sample_workbook )
99
- print ("\n Workbook's old tag set: {}" . format ( original_tag_set ) )
100
- print ("Workbook's new tag set: {}" . format ( sample_workbook .tags ) )
101
- print ("Workbook tabbed: {}" . format ( sample_workbook .show_tabs ) )
94
+ print (f "\n Workbook's old tag set: { original_tag_set } " )
95
+ print (f "Workbook's new tag set: { sample_workbook .tags } " )
96
+ print (f "Workbook tabbed: { sample_workbook .show_tabs } " )
102
97
103
98
# Delete all tags that were added by setting tags to original
104
99
sample_workbook .tags = original_tag_set
@@ -109,8 +104,8 @@ def main():
109
104
original_tag_set = set (sample_view .tags )
110
105
sample_view .tags .add ("view_tag" )
111
106
server .views .update (sample_view )
112
- print ("\n View's old tag set: {}" . format ( original_tag_set ) )
113
- print ("View's new tag set: {}" . format ( sample_view .tags ) )
107
+ print (f "\n View's old tag set: { original_tag_set } " )
108
+ print (f "View's new tag set: { sample_view .tags } " )
114
109
115
110
# Delete tag from just one view
116
111
sample_view .tags = original_tag_set
@@ -119,14 +114,14 @@ def main():
119
114
if args .download :
120
115
# Download
121
116
path = server .workbooks .download (sample_workbook .id , args .download )
122
- print ("\n Downloaded workbook to {}" . format ( path ) )
117
+ print (f "\n Downloaded workbook to { path } " )
123
118
124
119
if args .preview_image :
125
120
# Populate workbook preview image
126
121
server .workbooks .populate_preview_image (sample_workbook )
127
122
with open (args .preview_image , "wb" ) as f :
128
123
f .write (sample_workbook .preview_image )
129
- print ("\n Downloaded preview image of workbook to {}" . format ( os .path .abspath (args .preview_image )) )
124
+ print (f "\n Downloaded preview image of workbook to { os .path .abspath (args .preview_image )} " )
130
125
131
126
# get custom views
132
127
cvs , _ = server .custom_views .get ()
@@ -153,10 +148,10 @@ def main():
153
148
server .workbooks .populate_powerpoint (sample_workbook )
154
149
with open (args .powerpoint , "wb" ) as f :
155
150
f .write (sample_workbook .powerpoint )
156
- print ("\n Downloaded powerpoint of workbook to {}" . format ( os .path .abspath (args .powerpoint )) )
151
+ print (f "\n Downloaded powerpoint of workbook to { os .path .abspath (args .powerpoint )} " )
157
152
158
153
if args .delete :
159
- print ("deleting {}" . format ( c .id ) )
154
+ print (f "deleting { c .id } " )
160
155
unlucky = TSC .CustomViewItem (c .id )
161
156
server .custom_views .delete (unlucky .id )
162
157
0 commit comments