Skip to content

Commit

Permalink
improve enum docstring (#1216)
Browse files Browse the repository at this point in the history
  • Loading branch information
iscai-msft authored Mar 31, 2022
1 parent 2815250 commit f01e7ef
Show file tree
Hide file tree
Showing 147 changed files with 2,553 additions and 2,589 deletions.
2 changes: 1 addition & 1 deletion autorest/codegen/models/enum_schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ def extra_description_information(self):
possible_values[: len(possible_values) - 1]
) + f", and {possible_values[-1]}"

return "Possible values are: {}.".format(possible_values_str)
return "Known values are: {}.".format(possible_values_str)

@property
def docstring_type(self) -> str:
Expand Down
2 changes: 1 addition & 1 deletion autorest/codegen/models/parameter.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ def description(self):
if isinstance(self.schema, ConstantSchema) and not self.constant:
if description:
description += " "
description += f"Possible values are {self.schema.get_declaration(self.schema.value)} or {None}."
description += f"Known values are {self.schema.get_declaration(self.schema.value)} or {None}."
if self.has_default_value and not any(
l for l in ["default value is", "default is"] if l in description.lower()
):
Expand Down
2 changes: 1 addition & 1 deletion autorest/codegen/models/property.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def _create_description(self, description_input: Optional[str], yaml_data: Dict[
values = [self.schema.enum_type.get_declaration(v.value) for v in self.schema.values]
if description and description[-1] != " ":
description += " "
description += "Possible values include: {}.".format(", ".join(values))
description += "Known values are: {}.".format(", ".join(values))
if self.schema.default_value:
description += f' Default value: "{self.schema.default_value}".'
return description
Expand Down
2 changes: 1 addition & 1 deletion autorest/codegen/serializers/builder_serializer.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ def _content_type_docstring(builder) -> str:
).default_value_declaration
return (
":keyword content_type: Media type of the body sent to the API. " +
f"Possible values are: {possible_values_str}. " +
f"Known values are: {possible_values_str}. " +
f"Default value is {default_value}."
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ async def test_four( # pylint: disable=inconsistent-return-statements
:param input: Input parameter. Default value is None.
:type input: IO or ~azure.multiapi.sample.v3.models.SourcePath
:keyword content_type: Media type of the body sent to the API. Possible values are:
:keyword content_type: Media type of the body sent to the API. Known values are:
"application/pdf", "image/jpeg", "image/png", "image/tiff", and "application/json". Default
value is "application/json".
:paramtype content_type: str or ~azure.multiapi.sample.v3.models.ContentType
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ def test_four( # pylint: disable=inconsistent-return-statements
:param input: Input parameter. Default value is None.
:type input: IO or ~azure.multiapi.sample.v3.models.SourcePath
:keyword content_type: Media type of the body sent to the API. Possible values are:
:keyword content_type: Media type of the body sent to the API. Known values are:
"application/pdf", "image/jpeg", "image/png", "image/tiff", and "application/json". Default
value is "application/json".
:paramtype content_type: str or ~azure.multiapi.sample.v3.models.ContentType
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,8 @@ def __init__(
class OperationResult(msrest.serialization.Model):
"""OperationResult.
:ivar status: The status of the request. Possible values include: "Succeeded", "Failed",
"canceled", "Accepted", "Creating", "Created", "Updating", "Updated", "Deleting", "Deleted",
"OK".
:ivar status: The status of the request. Known values are: "Succeeded", "Failed", "canceled",
"Accepted", "Creating", "Created", "Updating", "Updated", "Deleting", "Deleted", "OK".
:vartype status: str or ~custompollerpager.models.OperationResultStatus
"""

Expand All @@ -92,7 +91,7 @@ def __init__(
**kwargs
):
"""
:keyword status: The status of the request. Possible values include: "Succeeded", "Failed",
:keyword status: The status of the request. Known values are: "Succeeded", "Failed",
"canceled", "Accepted", "Creating", "Created", "Updating", "Updated", "Deleting", "Deleted",
"OK".
:paramtype status: str or ~custompollerpager.models.OperationResultStatus
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,8 @@ def __init__(
class OperationResult(msrest.serialization.Model):
"""OperationResult.
:ivar status: The status of the request. Possible values include: "Succeeded", "Failed",
"canceled", "Accepted", "Creating", "Created", "Updating", "Updated", "Deleting", "Deleted",
"OK".
:ivar status: The status of the request. Known values are: "Succeeded", "Failed", "canceled",
"Accepted", "Creating", "Created", "Updating", "Updated", "Deleting", "Deleted", "OK".
:vartype status: str or ~custompollerpager.models.OperationResultStatus
"""

Expand All @@ -106,7 +105,7 @@ def __init__(
**kwargs
):
"""
:keyword status: The status of the request. Possible values include: "Succeeded", "Failed",
:keyword status: The status of the request. Known values are: "Succeeded", "Failed",
"canceled", "Accepted", "Creating", "Created", "Updating", "Updated", "Deleting", "Deleted",
"OK".
:paramtype status: str or ~custompollerpager.models.OperationResultStatus
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,8 @@
class OperationResult(msrest.serialization.Model):
"""OperationResult.
:ivar status: The status of the request. Possible values include: "Succeeded", "Failed",
"canceled", "Accepted", "Creating", "Created", "Updating", "Updated", "Deleting", "Deleted",
"OK".
:ivar status: The status of the request. Known values are: "Succeeded", "Failed", "canceled",
"Accepted", "Creating", "Created", "Updating", "Updated", "Deleting", "Deleted", "OK".
:vartype status: str or ~lro.models.OperationResultStatus
:ivar error:
:vartype error: ~lro.models.OperationResultError
Expand All @@ -27,7 +26,7 @@ class OperationResult(msrest.serialization.Model):

def __init__(self, **kwargs):
"""
:keyword status: The status of the request. Possible values include: "Succeeded", "Failed",
:keyword status: The status of the request. Known values are: "Succeeded", "Failed",
"canceled", "Accepted", "Creating", "Created", "Updating", "Updated", "Deleting", "Deleted",
"OK".
:paramtype status: str or ~lro.models.OperationResultStatus
Expand Down Expand Up @@ -128,7 +127,7 @@ class Product(Resource):
:vartype name: str
:ivar provisioning_state:
:vartype provisioning_state: str
:ivar provisioning_state_values: Possible values include: "Succeeded", "Failed", "canceled",
:ivar provisioning_state_values: Known values are: "Succeeded", "Failed", "canceled",
"Accepted", "Creating", "Created", "Updating", "Updated", "Deleting", "Deleted", "OK".
:vartype provisioning_state_values: str or ~lro.models.ProductPropertiesProvisioningStateValues
"""
Expand Down Expand Up @@ -222,7 +221,7 @@ class SubProduct(SubResource):
:vartype id: str
:ivar provisioning_state:
:vartype provisioning_state: str
:ivar provisioning_state_values: Possible values include: "Succeeded", "Failed", "canceled",
:ivar provisioning_state_values: Known values are: "Succeeded", "Failed", "canceled",
"Accepted", "Creating", "Created", "Updating", "Updated", "Deleting", "Deleted", "OK".
:vartype provisioning_state_values: str or
~lro.models.SubProductPropertiesProvisioningStateValues
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,8 @@
class OperationResult(msrest.serialization.Model):
"""OperationResult.
:ivar status: The status of the request. Possible values include: "Succeeded", "Failed",
"canceled", "Accepted", "Creating", "Created", "Updating", "Updated", "Deleting", "Deleted",
"OK".
:ivar status: The status of the request. Known values are: "Succeeded", "Failed", "canceled",
"Accepted", "Creating", "Created", "Updating", "Updated", "Deleting", "Deleted", "OK".
:vartype status: str or ~lro.models.OperationResultStatus
:ivar error:
:vartype error: ~lro.models.OperationResultError
Expand All @@ -39,7 +38,7 @@ def __init__(
**kwargs
):
"""
:keyword status: The status of the request. Possible values include: "Succeeded", "Failed",
:keyword status: The status of the request. Known values are: "Succeeded", "Failed",
"canceled", "Accepted", "Creating", "Created", "Updating", "Updated", "Deleting", "Deleted",
"OK".
:paramtype status: str or ~lro.models.OperationResultStatus
Expand Down Expand Up @@ -140,7 +139,7 @@ class Product(Resource):
:vartype name: str
:ivar provisioning_state:
:vartype provisioning_state: str
:ivar provisioning_state_values: Possible values include: "Succeeded", "Failed", "canceled",
:ivar provisioning_state_values: Known values are: "Succeeded", "Failed", "canceled",
"Accepted", "Creating", "Created", "Updating", "Updated", "Deleting", "Deleted", "OK".
:vartype provisioning_state_values: str or ~lro.models.ProductPropertiesProvisioningStateValues
"""
Expand Down Expand Up @@ -241,7 +240,7 @@ class SubProduct(SubResource):
:vartype id: str
:ivar provisioning_state:
:vartype provisioning_state: str
:ivar provisioning_state_values: Possible values include: "Succeeded", "Failed", "canceled",
:ivar provisioning_state_values: Known values are: "Succeeded", "Failed", "canceled",
"Accepted", "Creating", "Created", "Updating", "Updated", "Deleting", "Deleted", "OK".
:vartype provisioning_state_values: str or
~lro.models.SubProductPropertiesProvisioningStateValues
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,8 @@ def __init__(self, **kwargs):
class OperationResult(msrest.serialization.Model):
"""OperationResult.
:ivar status: The status of the request. Possible values include: "Succeeded", "Failed",
"canceled", "Accepted", "Creating", "Created", "Updating", "Updated", "Deleting", "Deleted",
"OK".
:ivar status: The status of the request. Known values are: "Succeeded", "Failed", "canceled",
"Accepted", "Creating", "Created", "Updating", "Updated", "Deleting", "Deleted", "OK".
:vartype status: str or ~paging.models.OperationResultStatus
"""

Expand All @@ -83,7 +82,7 @@ class OperationResult(msrest.serialization.Model):

def __init__(self, **kwargs):
"""
:keyword status: The status of the request. Possible values include: "Succeeded", "Failed",
:keyword status: The status of the request. Known values are: "Succeeded", "Failed",
"canceled", "Accepted", "Creating", "Created", "Updating", "Updated", "Deleting", "Deleted",
"OK".
:paramtype status: str or ~paging.models.OperationResultStatus
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,8 @@ def __init__(
class OperationResult(msrest.serialization.Model):
"""OperationResult.
:ivar status: The status of the request. Possible values include: "Succeeded", "Failed",
"canceled", "Accepted", "Creating", "Created", "Updating", "Updated", "Deleting", "Deleted",
"OK".
:ivar status: The status of the request. Known values are: "Succeeded", "Failed", "canceled",
"Accepted", "Creating", "Created", "Updating", "Updated", "Deleting", "Deleted", "OK".
:vartype status: str or ~paging.models.OperationResultStatus
"""

Expand All @@ -91,7 +90,7 @@ class OperationResult(msrest.serialization.Model):

def __init__(self, *, status: Optional[Union[str, "_models.OperationResultStatus"]] = None, **kwargs):
"""
:keyword status: The status of the request. Possible values include: "Succeeded", "Failed",
:keyword status: The status of the request. Known values are: "Succeeded", "Failed",
"canceled", "Accepted", "Creating", "Created", "Updating", "Updated", "Deleting", "Deleted",
"OK".
:paramtype status: str or ~paging.models.OperationResultStatus
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ async def check_name_availability(
Storage account names must be between 3 and 24 characters in length and use numbers and
lower-case letters only.
:type account_name: ~storage.models.StorageAccountCheckNameAvailabilityParameters
:keyword content_type: Media type of the body sent to the API. Possible values are:
:keyword content_type: Media type of the body sent to the API. Known values are:
"application/json" or "text/json". Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
Expand Down Expand Up @@ -203,7 +203,7 @@ async def begin_create(
:type account_name: str
:param parameters: The parameters to provide for the created account.
:type parameters: ~storage.models.StorageAccountCreateParameters
:keyword content_type: Media type of the body sent to the API. Possible values are:
:keyword content_type: Media type of the body sent to the API. Known values are:
"application/json" or "text/json". Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
Expand Down Expand Up @@ -401,7 +401,7 @@ async def update(
:param parameters: The parameters to update on the account. Note that only one property can be
changed at a time using this API.
:type parameters: ~storage.models.StorageAccountUpdateParameters
:keyword content_type: Media type of the body sent to the API. Possible values are:
:keyword content_type: Media type of the body sent to the API. Known values are:
"application/json" or "text/json". Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
Expand Down Expand Up @@ -672,7 +672,7 @@ async def regenerate_key(
:type account_name: str
:param key_name: Default value is None.
:type key_name: str or ~storage.models.KeyName
:keyword content_type: Media type of the body sent to the API. Possible values are:
:keyword content_type: Media type of the body sent to the API. Known values are:
"application/json" or "text/json". Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
Expand Down
Loading

0 comments on commit f01e7ef

Please sign in to comment.