Skip to content

Commit

Permalink
Merge pull request #216 from kevinli7/docstring2
Browse files Browse the repository at this point in the history
Convert generated api client/message docstrings into raw strings.
  • Loading branch information
kevinli7 authored Apr 17, 2018
2 parents 60a08f8 + 75378a7 commit 21ad21e
Show file tree
Hide file tree
Showing 14 changed files with 677 additions and 673 deletions.
6 changes: 3 additions & 3 deletions apitools/gen/extended_descriptor.py
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,7 @@ def __PrintClassSeparator(self):

def __PrintEnumDocstringLines(self, enum_type):
description = enum_type.description or '%s enum type.' % enum_type.name
for line in textwrap.wrap('"""%s' % description,
for line in textwrap.wrap('r"""%s' % description,
self.__printer.CalculateWidth()):
self.__printer(line)
PrintIndentedDescriptions(self.__printer, enum_type.values, 'Values')
Expand Down Expand Up @@ -433,9 +433,9 @@ def __PrintMessageDocstringLines(self, message_type):
if short_description:
# Note that we use explicit string interpolation here since
# we're in comment context.
self.__printer('"""%s"""' % description)
self.__printer('r"""%s"""' % description)
return
for line in textwrap.wrap('"""%s' % description,
for line in textwrap.wrap('r"""%s' % description,
self.__printer.CalculateWidth()):
self.__printer(line)

Expand Down
2 changes: 1 addition & 1 deletion apitools/gen/service_registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ def __PrintDocstring(self, printer, method_info, method_name, name):
else:
description = '%s method for the %s service.' % (method_name, name)
with printer.CommentContext():
printer('"""%s' % description)
printer('r"""%s' % description)
printer()
printer('Args:')
printer(' request: (%s) input message', method_info.request_type_name)
Expand Down
42 changes: 21 additions & 21 deletions samples/bigquery_sample/bigquery_v2/bigquery_v2_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def __init__(self, client):
}

def Delete(self, request, global_params=None):
"""Deletes the dataset specified by the datasetId value. Before you can delete a dataset, you must delete all its tables, either manually or by specifying deleteContents. Immediately after deletion, you can create another dataset with the same name.
r"""Deletes the dataset specified by the datasetId value. Before you can delete a dataset, you must delete all its tables, either manually or by specifying deleteContents. Immediately after deletion, you can create another dataset with the same name.
Args:
request: (BigqueryDatasetsDeleteRequest) input message
Expand All @@ -78,7 +78,7 @@ def Delete(self, request, global_params=None):
)

def Get(self, request, global_params=None):
"""Returns the dataset specified by datasetID.
r"""Returns the dataset specified by datasetID.
Args:
request: (BigqueryDatasetsGetRequest) input message
Expand All @@ -104,7 +104,7 @@ def Get(self, request, global_params=None):
)

def Insert(self, request, global_params=None):
"""Creates a new empty dataset.
r"""Creates a new empty dataset.
Args:
request: (BigqueryDatasetsInsertRequest) input message
Expand All @@ -130,7 +130,7 @@ def Insert(self, request, global_params=None):
)

def List(self, request, global_params=None):
"""Lists all datasets in the specified project to which you have been granted the READER dataset role.
r"""Lists all datasets in the specified project to which you have been granted the READER dataset role.
Args:
request: (BigqueryDatasetsListRequest) input message
Expand All @@ -156,7 +156,7 @@ def List(self, request, global_params=None):
)

def Patch(self, request, global_params=None):
"""Updates information in an existing dataset. The update method replaces the entire dataset resource, whereas the patch method only replaces fields that are provided in the submitted dataset resource. This method supports patch semantics.
r"""Updates information in an existing dataset. The update method replaces the entire dataset resource, whereas the patch method only replaces fields that are provided in the submitted dataset resource. This method supports patch semantics.
Args:
request: (BigqueryDatasetsPatchRequest) input message
Expand All @@ -182,7 +182,7 @@ def Patch(self, request, global_params=None):
)

def Update(self, request, global_params=None):
"""Updates information in an existing dataset. The update method replaces the entire dataset resource, whereas the patch method only replaces fields that are provided in the submitted dataset resource.
r"""Updates information in an existing dataset. The update method replaces the entire dataset resource, whereas the patch method only replaces fields that are provided in the submitted dataset resource.
Args:
request: (BigqueryDatasetsUpdateRequest) input message
Expand Down Expand Up @@ -226,7 +226,7 @@ def __init__(self, client):
}

def Cancel(self, request, global_params=None):
"""Requests that a job be cancelled. This call will return immediately, and the client will need to poll for the job status to see if the cancel completed successfully. Cancelled jobs may still incur costs.
r"""Requests that a job be cancelled. This call will return immediately, and the client will need to poll for the job status to see if the cancel completed successfully. Cancelled jobs may still incur costs.
Args:
request: (BigqueryJobsCancelRequest) input message
Expand All @@ -252,7 +252,7 @@ def Cancel(self, request, global_params=None):
)

def Get(self, request, global_params=None):
"""Returns information about a specific job. Job information is available for a six month period after creation. Requires that you're the person who ran the job, or have the Is Owner project role.
r"""Returns information about a specific job. Job information is available for a six month period after creation. Requires that you're the person who ran the job, or have the Is Owner project role.
Args:
request: (BigqueryJobsGetRequest) input message
Expand All @@ -278,7 +278,7 @@ def Get(self, request, global_params=None):
)

def GetQueryResults(self, request, global_params=None):
"""Retrieves the results of a query job.
r"""Retrieves the results of a query job.
Args:
request: (BigqueryJobsGetQueryResultsRequest) input message
Expand All @@ -304,7 +304,7 @@ def GetQueryResults(self, request, global_params=None):
)

def Insert(self, request, global_params=None, upload=None):
"""Starts a new asynchronous job. Requires the Can View project role.
r"""Starts a new asynchronous job. Requires the Can View project role.
Args:
request: (BigqueryJobsInsertRequest) input message
Expand Down Expand Up @@ -334,7 +334,7 @@ def Insert(self, request, global_params=None, upload=None):
)

def List(self, request, global_params=None):
"""Lists all jobs that you started in the specified project. Job information is available for a six month period after creation. The job list is sorted in reverse chronological order, by job creation time. Requires the Can View project role, or the Is Owner project role if you set the allUsers property.
r"""Lists all jobs that you started in the specified project. Job information is available for a six month period after creation. The job list is sorted in reverse chronological order, by job creation time. Requires the Can View project role, or the Is Owner project role if you set the allUsers property.
Args:
request: (BigqueryJobsListRequest) input message
Expand All @@ -360,7 +360,7 @@ def List(self, request, global_params=None):
)

def Query(self, request, global_params=None):
"""Runs a BigQuery SQL query synchronously and returns query results if the query completes within a specified timeout.
r"""Runs a BigQuery SQL query synchronously and returns query results if the query completes within a specified timeout.
Args:
request: (BigqueryJobsQueryRequest) input message
Expand Down Expand Up @@ -396,7 +396,7 @@ def __init__(self, client):
}

def List(self, request, global_params=None):
"""Lists all projects to which you have been granted any project role.
r"""Lists all projects to which you have been granted any project role.
Args:
request: (BigqueryProjectsListRequest) input message
Expand Down Expand Up @@ -432,7 +432,7 @@ def __init__(self, client):
}

def InsertAll(self, request, global_params=None):
"""Streams data into BigQuery one record at a time without needing to run a load job. Requires the WRITER dataset role.
r"""Streams data into BigQuery one record at a time without needing to run a load job. Requires the WRITER dataset role.
Args:
request: (BigqueryTabledataInsertAllRequest) input message
Expand All @@ -458,7 +458,7 @@ def InsertAll(self, request, global_params=None):
)

def List(self, request, global_params=None):
"""Retrieves table data from a specified set of rows. Requires the READER dataset role.
r"""Retrieves table data from a specified set of rows. Requires the READER dataset role.
Args:
request: (BigqueryTabledataListRequest) input message
Expand Down Expand Up @@ -494,7 +494,7 @@ def __init__(self, client):
}

def Delete(self, request, global_params=None):
"""Deletes the table specified by tableId from the dataset. If the table contains data, all the data will be deleted.
r"""Deletes the table specified by tableId from the dataset. If the table contains data, all the data will be deleted.
Args:
request: (BigqueryTablesDeleteRequest) input message
Expand All @@ -520,7 +520,7 @@ def Delete(self, request, global_params=None):
)

def Get(self, request, global_params=None):
"""Gets the specified table resource by table ID. This method does not return the data in the table, it only returns the table resource, which describes the structure of this table.
r"""Gets the specified table resource by table ID. This method does not return the data in the table, it only returns the table resource, which describes the structure of this table.
Args:
request: (BigqueryTablesGetRequest) input message
Expand All @@ -546,7 +546,7 @@ def Get(self, request, global_params=None):
)

def Insert(self, request, global_params=None):
"""Creates a new, empty table in the dataset.
r"""Creates a new, empty table in the dataset.
Args:
request: (BigqueryTablesInsertRequest) input message
Expand All @@ -572,7 +572,7 @@ def Insert(self, request, global_params=None):
)

def List(self, request, global_params=None):
"""Lists all tables in the specified dataset. Requires the READER dataset role.
r"""Lists all tables in the specified dataset. Requires the READER dataset role.
Args:
request: (BigqueryTablesListRequest) input message
Expand All @@ -598,7 +598,7 @@ def List(self, request, global_params=None):
)

def Patch(self, request, global_params=None):
"""Updates information in an existing table. The update method replaces the entire table resource, whereas the patch method only replaces fields that are provided in the submitted table resource. This method supports patch semantics.
r"""Updates information in an existing table. The update method replaces the entire table resource, whereas the patch method only replaces fields that are provided in the submitted table resource. This method supports patch semantics.
Args:
request: (BigqueryTablesPatchRequest) input message
Expand All @@ -624,7 +624,7 @@ def Patch(self, request, global_params=None):
)

def Update(self, request, global_params=None):
"""Updates information in an existing table. The update method replaces the entire table resource, whereas the patch method only replaces fields that are provided in the submitted table resource.
r"""Updates information in an existing table. The update method replaces the entire table resource, whereas the patch method only replaces fields that are provided in the submitted table resource.
Args:
request: (BigqueryTablesUpdateRequest) input message
Expand Down
Loading

0 comments on commit 21ad21e

Please sign in to comment.