10000 docs: remove examples · tableau/server-client-python@05d5248 · GitHub
[go: up one dir, main page]

Skip to content

Commit 05d5248

Browse files
committed
docs: remove examples
1 parent 0fcbd0c commit 05d5248

File tree

1 file changed

+0
-204
lines changed

1 file changed

+0
-204
lines changed

tableauserverclient/server/endpoint/workbooks_endpoint.py

Lines changed: 0 additions & 204 deletions
Original file line numberDiff line numberDiff line change
@@ -85,17 +85,6 @@ def get(self, req_options: Optional["RequestOptions"] = None) -> tuple[list[Work
8585
-------
8686
Tuple containing one page's worth of workbook items and pagination
8787
information.
88-
89-
Examples
90-
--------
91-
>>> import tableauserverclient as TSC
92-
>>> tableau_auth = TSC.TableauAuth('username', 'password', site_id='site')
93-
>>> server = TSC.Server('https://servername')
94-
95-
>>> with server.auth.sign_in(tableau_auth):
96-
>>> all_workbooks_items, pagination_item = server.workbooks.get()
97-
>>> # print names of first 100 workbooks
98-
>>> print([workbook.name for workbook in all_workbooks_items])
9988
"""
10089
logger.info("Querying all workbooks on site")
10190
url = self.baseurl
@@ -119,11 +108,6 @@ def get_by_id(self, workbook_id: str) -> WorkbookItem:
119108
-------
120109
WorkbookItem
121110
The workbook item.
122-
123-
Examples
124-
--------
125-
>>> workbook = server.workbooks.get_by_id('1a1b1c1d-2e2f-2a2b-3c3d-3e3f4a4b4c4d')
126-
>>> print(workbook.name)
127111
"""
128112
if not workbook_id:
129113
error = "Workbook ID undefined."
@@ -147,21 +131,6 @@ def refresh(self, workbook_item: Union[WorkbookItem, str]) -> JobItem:
147131
-------
148132
JobItem
149133
The job item.
150-
151-
Examples
152-
--------
153-
>>> import tableauserverclient as TSC
154-
>>> tableau_auth = TSC.TableauAuth('username', 'password', site_id='site')
155-
>>> server = TSC.Server('https://servername')
156-
157-
>>> with server.auth.sign_in(tableau_auth):
158-
159-
>>> # get the workbook item from the site
160-
>>> workbook = server.workbooks.get_by_id('1a1b1c1d-2e2f-2a2b-3c3d-3e3f4a4b4c4d')
161-
162-
>>> # call the update method
163-
>>> workbook = server.workbooks.refresh(workbook)
164-
>>> print("\nThe data of workbook {0} is refreshed.".format(workbook.name))
165134
"""
166135
id_ = getattr(workbook_item, "id", workbook_item)
167136
url = f"{self.baseurl}/{id_}/refresh"
@@ -205,10 +174,6 @@ def create_extract(
205174
-------
206175
JobItem
207176
The job item for the extract creation.
208-
209-
Examples
210-
--------
211-
212177
"""
213178
id_ = getattr(workbook_item, "id", workbook_item)
214179
url = f"{self.baseurl}/{id_}/createExtract?encrypt={encrypt}"
@@ -243,10 +208,6 @@ def delete_extract(self, workbook_item: WorkbookItem, includeAll: bool = True, d
243208
Returns
244209
-------
245210
JobItem
246-
247-
Examples
248-
--------
249-
250211
"""
251212
id_ = getattr(workbook_item, "id", workbook_item)
252213
url = f"{self.baseurl}/{id_}/deleteExtract"
@@ -269,10 +230,6 @@ def delete(self, workbook_id: str) -> None:
269230
Returns
270231
-------
271232
None
272-
273-
Examples
274-
--------
275-
>>> server.workbooks.delete('1a1b1c1d-2e2f-2a2b-3c3d-3e3f4a4b4c4d')
276233
"""
277234
if not workbook_id:
278235
error = "Workbook ID undefined."
@@ -311,26 +268,6 @@ def update(
311268
-------
312269
WorkbookItem
313270
The updated workbook item.
314-
315-
Examples
316-
--------
317-
318-
>>> import tableauserverclient as TSC
319-
>>> tableau_auth = TSC.TableauAuth('username', 'password', site_id='site')
320-
>>> server = TSC.Server('https://servername')
321-
322-
>>> with server.auth.sign_in(tableau_auth):
323-
324-
>>> # get the workbook item from the site
325-
>>> workbook = server.workbooks.get_by_id('1a1b1c1d-2e2f-2a2b-3c3d-3e3f4a4b4c4d')
326-
>>> print("\nUpdate {0} workbook. Project was {1}".format(workbook.name, workbook.project_name))
327-
328-
>>> # make an change, for example a new project ID
329-
>>> workbook.project_id = '1f2f3e4e-5d6d-7c8c-9b0b-1a2a3f4f5e6e'
330-
331-
>>> # call the update method
332-
>>> workbook = server.workbooks.update(workbook)
333-
>>> print("\nUpdated {0} workbook. Project is now {1}".format(workbook.name, workbook.project_name))
334271
"""
335272
if not workbook_item.id:
336273
error = "Workbook item missing ID. Workbook must be retrieved from server first."
@@ -373,20 +310,6 @@ def update_connection(self, workbook_item: WorkbookItem, connection_item: Connec
373310
-------
374311
ConnectionItem
375312
The updated connection item.
376-
377-
Examples
378-
--------
379-
>>> # query for workbook connections
380-
>>> server.workbooks.populate_connections(workbook)
381-
382-
>>> # update the connection
383-
>>> connection = workbook.connections[0]
384-
>>> connection.username = 'new_username'
385-
>>> connection.password = 'new_password'
386-
387-
>>> # call the update method
388-
>>> connection = server.workbooks.update_connection(workbook, connection)
389-
390313
"""
391314
url = f"{self.baseurl}/{workbook_item.id}/connections/{connection_item.id}"
392315
update_req = RequestFactory.Connection.update_req(connection_item)
@@ -432,10 +355,6 @@ def download(
432355
------
433356
ValueError
434357
If the workbook ID is not defined.
435-
436-
Examples
437-
--------
438-
>>> filepath = server.workbooks.download('1a1b1c1d-2e2f-2a2b-3c3d-3e3f4a4b4c4d')
439358
"""
440359

441360
return self.download_revision(
@@ -477,24 +396,6 @@ def populate_views(self, workbook_item: WorkbookItem, usage: bool = False) -> No
477396
------
478397
MissingRequiredFieldError
479398
If the workbook item is missing an ID.
480-
481-
Examples
482-
--------
483-
>>> # import tableauserverclient as TSC
484-
485-
>>> # server = TSC.Server('https://SERVERURL')
486-
>>> # ...
487-
488-
>>> # get the workbook item
489-
>>> workbook = server.workbooks.get_by_id('1a1b1c1d-2e2f-2a2b-3c3d-3e3f4a4b4c4d')
490-
491-
492-
>>> # get the view information
493-
>>> server.workbooks.populate_views(workbook)
494-
495-
>>> # print information about the views for the work item
496-
>>> print("\nThe views for {0}: ".format(workbook.name))
497-
>>> print([view.name for view in workbook.views])
498399
"""
499400
if not workbook_item.id:
500401
error = "Workbook item missing ID. Workbook must be retrieved from server first."
@@ -550,24 +451,6 @@ def populate_connections(self, workbook_item: WorkbookItem) -> None:
550451
------
551452
MissingRequiredFieldError
552453
If the workbook item is missing an ID.
553-
554-
Examples
555-
--------
556-
>>> # import tableauserverclient as TSC
557-
558-
>>> # server = TSC.Server('https://SERVERURL')
559-
>>> # ...
560-
561-
>>> # get the workbook item
562-
>>> workbook = server.workbooks.get_by_id('1a1b1c1d-2e2f-2a2b-3c3d-3e3f4a4b4c4d')
563-
564-
565-
>>> # get the connection information
566-
>>> server.workbooks.populate_connections(workbook)
567-
568-
>>> # print information about the data connections for the workbook item
569-
>>> print("\nThe connections for {0}: ".format(workbook.name))
570-
>>> print([connection.id for connection in workbook.connections])
571454
"""
572455
if not workbook_item.id:
573456
error = "Workbook item missing ID. Workbook must be retrieved from server first."
@@ -617,12 +500,6 @@ def populate_pdf(self, workbook_item: WorkbookItem, req_options: Optional["Reque
617500
------
618501
MissingRequiredFieldError
619502
If the workbook item is missing an ID.
620-
621-
Examples
622-
--------
623-
>>> server.workbooks.populate_pdf(workbook)
624-
>>> with open("workbook.pdf", "wb") as f:
625-
>>> f.write(workbook.pdf)
626503
"""
627504
if not workbook_item.id:
628505
error = "Workbook item missing ID."
@@ -671,12 +548,6 @@ def populate_powerpoint(self, workbook_item: WorkbookItem, req_options: Optional
671548
------
672549
MissingRequiredFieldError
673550
If the workbook item is missing an ID.
674-
675-
Examples
676-
--------
677-
>>> server.workbooks.populate_powerpoint(workbook)
678-
>>> with open("workbook.pptx", "wb") as f:
679-
>>> f.write(workbook.pptx)
680551
"""
681552
if not workbook_item.id:
682553
error = "Workbook item missing ID."
@@ -716,18 +587,6 @@ def populate_preview_image(self, workbook_item: WorkbookItem) -> None:
716587
------
717588
MissingRequiredFieldError
718589
If the workbook item is missing an ID.
719-
720-
Examples
721-
--------
722-
>>> # import tableauserverclient as TSC
723-
>>> # server = TSC.Server('https://SERVERURL')
724-
>>> # ...
725-
726-
>>> # get the workbook item
727-
>>> workbook = server.workbooks.get_by_id('1a1b1c1d-2e2f-2a2b-3c3d-3e3f4a4b4c4d')
728-
729-
>>> # get the preview image
730-
>>> server.workbooks.populate_preview_image(workbook)
731590
"""
732591
if not workbook_item.id:
733592
error = "Workbook item missing ID. W 179B orkbook must be retrieved from server first."
@@ -760,11 +619,6 @@ def populate_permissions(self, item: WorkbookItem) -> None:
760619
Returns
761620
-------
762621
None
763-
764-
Examples
765-
--------
766-
>>> workbook = server.workbooks.get_by_id('1a1b1c1d-2e2f-2a2b-3c3d-3e3f4a4b4c4d')
767-
>>> server.workbooks.populate_permissions(workbook)
768622
"""
769623
self._permissions.populate(item)
770624

@@ -789,14 +643,6 @@ def update_permissions(self, resource: WorkbookItem, rules: list[PermissionsRule
789643
-------
790644
list[PermissionsRule]
791645
The updated permissions rules.
792-
793-
Examples
794-
--------
795-
>>> workbook = server.workbooks.get_by_id('1a1b1c1d-2e2f-2a2b-3c3d-3e3f4a4b4c4d')
796-
>>> server.workbooks.populate_permissions(workbook)
797-
>>> rules = workbook.permissions
798-
>>> rules[0].capabilities |= {TSC.PermissionRule.Capability.Read: TSC.PermissionRule.Mode.Allow}
799-
>>> server.workbooks.update_permissions(workbook, rules)
800646
"""
801647
return self._permissions.update(resource, rules)
802648

@@ -818,13 +664,6 @@ def delete_permission(self, item: WorkbookItem, capability_item: PermissionsRule
818664
Returns
819665
-------
820666
None
821-
822-
Examples
823-
--------
824-
>>> workbook = server.workbooks.get_by_id('1a1b1c1d-2e2f-2a2b-3c3d-3e3f4a4b4c4d')
825-
>>> server.workbooks.populate_permissions(workbook)
826-
>>> rule = workbook.permissions[0]
827-
>>> server.workbooks.delete_permission(workbook, rule)
828667
"""
829668
return self._permissions.delete(item, capability_item)
830669

@@ -917,20 +756,6 @@ def publish(
917756
-------
918757
WorkbookItem | JobItem
919758
The workbook item or job item that was published.
920-
921-
Examples
922-
--------
923-
>>> import tableauserverclient as TSC
924-
>>> tableau_auth = TSC.TableauAuth('username', 'password', site_id='site')
925-
>>> server = TSC.Server('https://servername')
926-
927-
>>> with server.auth.sign_in(tableau_auth):
928-
>>> # create a workbook item
929-
>>> wb_item = TSC.WorkbookItem(name='Sample', project_id='1f2f3e4e-5d6d-7c8c-9b0b-1a2a3f4f5e6e')
930-
>>> # set hidden views
931-
>>> wb_item.hidden_views = ['Sheet1', 'Sheet2']
932-
>>> # call the publish method with the workbook item
933-
>>> wb_item = server.workbooks.publish(wb_item, 'SampleWB.twbx', 'Overwrite')
934759
"""
935760
if isinstance(file, (str, os.PathLike)):
936761
if not os.path.isfile(file):
@@ -1059,13 +884,6 @@ def populate_revisions(self, workbook_item: WorkbookItem) -> None:
1059884
------
1060885
MissingRequiredFieldError
1061886
If the workbook item is missing an ID.
1062-
1063-
Examples
1064-
--------
1065-
>>> workbook = server.workbooks.get_by_id('1a1b1c1d-2e2f-2a2b-3c3d-3e3f4a4b4c4d')
1066-
>>> server.workbooks.populate_revisions(workbook)
1067-
>>> print([revision.revision_number for revision in workbook.revisions])
1068-
1069887
"""
1070888
if not workbook_item.id:
1071889
error = "Workbook item missing ID. Workbook must be retrieved from server first."
@@ -1126,10 +944,6 @@ def download_revision(
1126944
------
1127945
ValueError
1128946
If the workbook ID is not defined.
1129-
1130-
Examples
1131-
--------
1132-
>>> filepath = server.workbooks.download('1a1b1c1d-2e2f-2a2b-3c3d-3e3f4a4b4c4d', '5')
1133947
"""
1134948

1135949
if not workbook_id:
@@ -1186,10 +1000,6 @@ def delete_revision(self, workbook_id: str, revision_number: str) -> None:
11861000
------
11871001
ValueError
11881002
If the workbook ID or revision number is not defined.
1189-
1190-
Examples
1191-
--------
1192-
>>> server.workbooks.delete_revision('1a1b1c1d-2e2f-2a2b-3c3d-3e3f4a4b4c4d', '5')
11931003
"""
11941004
if workbook_id is None or revision_number is None:
11951005
raise ValueError
@@ -1220,10 +1030,6 @@ def schedule_extract_refresh(
12201030
-------
12211031
list[AddResponse]
12221032
The response from the server.
1223-
1224-
Examples
1225-
--------
1226-
>>> server.workbooks.schedule_extract_refresh('1a1b1c1d-2e2f-2a2b-3c3d-3e3f4a4b4c4d', workbook)
12271033
"""
12281034
return self.parent_srv.schedules.add_to_schedule(schedule_id, workbook=item)
12291035

@@ -1248,11 +1054,6 @@ def add_tags(self, item: Union[WorkbookItem, str], tags: Union[Iterable[str], st
12481054
-------
12491055
set[str]
12501056
The set of tags added to the workbook.
1251-
1252-
Examples
1253-
--------
1254-
>>> server.workbooks.add_tags(workbook, 'tag1')
1255-
>>> server.workbooks.add_tags(workbook, ['tag1', 'tag2'])
12561057
"""
12571058
return super().add_tags(item, tags)
12581059

@@ -1275,11 +1076,6 @@ def delete_tags(self, item: Union[WorkbookItem, str], tags: Union[Iterable[str],
12751076
Returns
12761077
-------
12771078
None
1278-
1279-
Examples
1280-
--------
1281-
>>> server.workbooks.delete_tags(workbook, 'tag1')
1282-
>>> server.workbooks.delete_tags(workbook, ['tag1', 'tag2'])
12831079
"""
12841080
return super().delete_tags(item, tags)
12851081

0 commit comments

Comments
 (0)
0