From 1a68809ae79c5203863a8b4330b609370fff74f9 Mon Sep 17 00:00:00 2001
From: Christoffer Rehn <1280602+hoffa@users.noreply.github.com>
Date: Thu, 2 Feb 2023 14:33:53 -0800
Subject: [PATCH 1/3] chore: filter CFN docs
---
bin/parse_docs.py | 33 +++++++++---
schema_source/cloudformation-docs.json | 69 --------------------------
2 files changed, 25 insertions(+), 77 deletions(-)
diff --git a/bin/parse_docs.py b/bin/parse_docs.py
index 2feac48d7..506e32222 100755
--- a/bin/parse_docs.py
+++ b/bin/parse_docs.py
@@ -15,16 +15,15 @@
import re
from contextlib import suppress
from pathlib import Path
-from typing import Dict, Iterator, Tuple
+from typing import Dict, Optional, Iterator, Tuple
def parse(s: str) -> Iterator[Tuple[str, str]]:
"""Parse an AWS docs page in Markdown format, yielding each property."""
# Prevent from parsing return values accidentally
- with suppress(ValueError):
- s = s[: s.index("# Return Value")]
- with suppress(ValueError):
- s = s[: s.index("# Return value")]
+ s = stringbetween(s, "#\s+Properties", "#\s+Return values")
+ if not s:
+ return
parts = s.split("\n\n")
for part in parts:
match = re.match(r"^\s*`(\w+)`\s+ str:
return description
-def stringbetween(s: str, sep1: str, sep2: str) -> str:
- return s.split(sep1, 1)[1].split(sep2, 1)[0]
+def stringbetween(s: str, sep1: str, sep2: str) -> Optional[str]:
+ """
+ Return string between regexes. Case-insensitive. If sep2 doesn't match,
+ returns to end of string.
+ """
+ start = re.search(sep1, s, re.IGNORECASE)
+ if not start:
+ return None
+ s = s[start.end() :]
+ end = re.search(sep2, s, re.IGNORECASE)
+ if not end:
+ return s
+ return s[: end.start()]
def main() -> None:
@@ -71,7 +81,14 @@ def main() -> None:
props: Dict[str, Dict[str, str]] = {}
for path in args.dir.glob("*.md"):
text = path.read_text()
- title = stringbetween(text, "# ", "` \nAn array of integers or floats that are separated by commas\\. AWS CloudFormation validates the parameter value as numbers; however, when you use the parameter elsewhere in your template \\(for example, by using the `Ref` intrinsic function\\), the parameter value becomes a list of strings\\. \nFor example, users could specify `\"80,20\"`, and a `Ref` would result in `[\"80\",\"20\"]`\\. \n`CommaDelimitedList` \nAn array of literal strings that are separated by commas\\. The total number of strings should be one more than the total number of commas\\. Also, each member string is space trimmed\\. \nFor example, users could specify `\"test,dev,prod\"`, and a `Ref` would result in `[\"test\",\"dev\",\"prod\"]`\\. \nAWS\\-Specific Parameter Types \nAWS values such as Amazon EC2 key pair names and VPC IDs\\. For more information, see [AWS\\-specific parameter types](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/#aws-specific-parameter-types.html#aws-specific-parameter-types)\\. \n`SSM` Parameter Types \nParameters that correspond to existing parameters in Systems Manager Parameter Store\\. You specify a Systems Manager parameter key as the value of the `SSM` parameter, and AWS CloudFormation fetches the latest value from Parameter Store to use for the stack\\. For more information, see [SSM parameter types](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/#aws-ssm-parameter-types.html#aws-ssm-parameter-types)\\."
- },
- "Resource tag": {
- "Key": "The key name of the tag\\. You can specify a value that's 1 to 128 Unicode characters in length and can't be prefixed with `aws:`\\. You can use any of the following characters: the set of Unicode letters, digits, whitespace, `_`, `.`, `/`, `=`, `+`, and `-`\\. \n*Required*: Yes \n*Type*: String",
- "Value": "The value for the tag\\. You can specify a value that's 1 to 256 characters in length\\. \n*Required*: Yes \n*Type*: String"
- },
- "Specification format": {
- "Attributes": "A list of resource attributes that you can use in an [`Fn::GetAtt`](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/intrinsic-function-reference-getatt.html) function\\. For each attribute, this section provides the attribute name and the type of value that AWS CloudFormation returns\\. \n`ItemType` \nIf the value of the `Type` field is `List`, indicates the type of list that the `Fn::GetAtt` function returns for the attribute if the list contains non\\-primitive types\\. The valid type is a name of a property\\. \n`PrimitiveItemType` \nIf the value of the `Type` field is `List`, indicates the type of list that the `Fn::GetAtt` function returns for the attribute if the list contains primitive types\\. For lists that contain non\\-primitive types, the `ItemType` property indicates the valid value type\\. The valid primitive types for lists are `String`, `Long`, `Integer`, `Double`, `Boolean`, or `Timestamp`\\. \nFor example, if the type value is `List` and the primitive item type value is `String`, the `Fn::GetAtt` function returns a list of strings\\. \n`PrimitiveType` \nFor primitive return values, the type of primitive value that the `Fn::GetAtt` function returns for the attribute\\. A primitive type is a basic data type for resource property values\\. The valid primitive types are `String`, `Long`, `Integer`, `Double`, `Boolean`, `Timestamp` or `Json`\\. \n`Type` \nFor non\\-primitive return values, the type of value that the `Fn::GetAtt` function returns for the attribute\\. The valid types are a property name or `List`\\. \nA list is a comma\\-separated list of values\\. The value type for lists are indicated by the `ItemType` or `PrimitiveItemType` field\\.",
- "Documentation": "A link to the *AWS CloudFormation User Guide* that provides information about the property\\.",
- "DuplicatesAllowed": "If the value of the `Type` field is `List`, indicates whether AWS CloudFormation allows duplicate values\\. If the value is `true`, AWS CloudFormation ignores duplicate values\\. If the value is `false`, AWS CloudFormation returns an error if you submit duplicate values\\.",
- "ItemType": "If the value of the `Type` field is `List` or `Map`, indicates the type of list or map if they contain non\\-primitive types\\. Otherwise, this field is omitted\\. For lists or maps that contain primitive types, the `PrimitiveItemType` property indicates the valid value type\\. \nA subproperty name is a valid item type\\. For example, if the type value is `List` and the item type value is `PortMapping`, you can specify a list of port mapping properties\\.",
- "PrimitiveItemType": "If the value of the `Type` field is `List` or `Map`, indicates the type of list or map if they contain primitive types\\. Otherwise, this field is omitted\\. For lists or maps that contain non\\-primitive types, the `ItemType` property indicates the valid value type\\. \nThe valid primitive types for lists and maps are `String`, `Long`, `Integer`, `Double`, `Boolean`, or `Timestamp`\\. \nFor example, if the type value is `List` and the item type value is `String`, you can specify a list of strings for the property\\. If the type value is `Map` and the item type value is `Boolean`, you can specify a string to Boolean mapping for the property\\.",
- "PrimitiveType": "For primitive values, the valid primitive type for the property\\. A primitive type is a basic data type for resource property values\\. The valid primitive types are `String`, `Long`, `Integer`, `Double`, `Boolean`, `Timestamp` or `Json`\\. If valid values are a non\\-primitive type, this field is omitted and the `Type` field indicates the valid value type\\.",
- "Properties": "A list of property specifications for the resource\\. For details, see [Property specification](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/#cfn-resource-specification-format-propertytypes.html#cfn-resource-specification-format-propertytypes)\\.",
- "PropertyTypes": "For resources that have properties within a property \\(also known as subproperties\\), a list of subproperty specifications, such as which properties are required, the type of allowed value for each property, and their update behavior\\. For more information, see [Property specification](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/#cfn-resource-specification-format-propertytypes.html#cfn-resource-specification-format-propertytypes)\\. \nIf a resource doesn't have subproperties, this section is omitted\\.",
- "Required": "Indicates whether the property is required\\.",
- "ResourceSpecificationVersion": "The version of the resource specification\\. The version format is `majorVersion.minorVersion.patch`, where each release increments the version number\\. All resources have the same version number regardless of whether the resource was updated\\. \nAWS CloudFormation increments the patch number when the service makes a backwards\\-compatible bug fix, such as fixing a broken documentation link\\. When AWS CloudFormation adds resources or properties that are backwards compatible, it increments the minor version number\\. For example, later versions of a specification might add additional resource properties to support new features of an AWS service\\. \nBackwards incompatible changes increment the major version number\\. A backwards incompatible change can result from a change in the resource specification, such as a name change to a field, or a change to a resource, such as the making an optional resource property required\\.",
- "ResourceTypes": "The list of resources and information about each resource's properties, such as its property names, which properties are required, and their update behavior\\. For more information, see [Resource specification](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/#cfn-resource-specification-format-resourcetype.html#cfn-resource-specification-format-resourcetype)\\. \nIf you view a file that contains the definition of one resource type, this property name is `ResourceType` \\(singular\\)\\.",
- "Type": "For non\\-primitive types, valid values for the property\\. The valid types are a subproperty name, `List` or `Map`\\. If valid values are a primitive type, this field is omitted and the `PrimitiveType` field indicates the valid value type\\. \nA list is a comma\\-separated list of values\\. A map is a set of key\\-value pairs, where the keys are always strings\\. The value type for lists and maps are indicated by the `ItemType` or `PrimitiveItemType` field\\.",
- "UpdateType": "During a stack update, the update behavior when you add, remove, or modify the property\\. AWS CloudFormation replaces the resource when you change immutable properties\\. AWS CloudFormation doesn't replace the resource when you change mutable properties\\. Conditional updates can be mutable or immutable, depending on, for example, which other properties you updated\\. For more information, see the relevant [resource type](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-template-resource-type-ref.html) documentation\\."
- },
- "`AWS::CloudFormation::Authentication`": {
- "accessKeyId": "Specifies the access key ID for S3 authentication\\. \n*Required*: Conditional\\. Can be specified only if the `type` property is set to `\"S3\"`\\. \n*Type*: String",
- "buckets": "A comma\\-delimited list of Amazon S3 buckets to be associated with the S3 authentication credentials\\. \n*Required*: Conditional\\. Can be specified only if the `type` property is set to `\"S3\"`\\. \n*Type*: List of String values",
- "password": "Specifies the password for basic authentication\\. \n*Required*: Conditional\\. Can be specified only if the type property is set to `\"basic\"`\\. \n*Type*: String",
- "roleName": "Describes the role for role\\-based authentication\\. \nThis role must be contained within the instance profile that's attached to the EC2 instance\\. An instance profile can only contain one IAM role\\.\n*Required*: Conditional\\. Can be specified only if the `type` property is set to `\"S3\"`\\. \n*Type*: String\\.",
- "secretKey": "Specifies the secret key for S3 authentication\\. \n*Required*: Conditional\\. Can be specified only if the `type` property is set to `\"S3\"`\\. \n*Type*: String",
- "type": "Specifies whether the authentication scheme uses a user name and password \\(\"basic\"\\) or an access key ID and secret key \\(\"S3\"\\)\\. \nIf you specify `\"basic\"`, specify the `username`, `password`, and `uris` properties\\. \nIf you specify `\"S3\"`, specify the `accessKeyId`, `secretKey`, and `buckets` \\(optional\\) properties\\. \n*Required*: Yes \n*Valid values*: `basic` \\| `S3`",
- "uris": "A comma\\-delimited list of URIs to be associated with the basic authentication credentials\\. The authorization applies to the specified URIs and any more specific URI\\. For example, if you specify `http://www.example.com`, the authorization will also apply to `http://www.example.com/test`\\. \n*Required*: Conditional\\. Can be specified only if the `type` property is set to `\"basic\"`\\. \n*Type*: List of String values",
- "username": "Specifies the user name for basic authentication\\. \n*Required*: Conditional\\. Can be specified only if the type property is set to `\"basic\"`\\. \n*Type*: String"
- },
- "`AWS::CloudFormation::Interface Label`": {
- "default": "The default label that the CloudFormation console uses to name a parameter group or parameter\\. \n*Required*: No \n*Type*: String"
- },
- "`AWS::CloudFormation::Interface ParameterLabel`": {
- "ParameterLogicalID": "A label for a parameter\\. The label defines a friendly name or description that the CloudFormation console shows on the **Specify Parameters** page when a stack is created or updated\\. The `ParameterLogicalID` key must be the case\\-sensitive logical ID of a valid parameter that has been declared in the `Parameters` section of the template\\. \n*Required*: No \n*Type*: [`AWS::CloudFormation::Interface Label`](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudformation-interface-label.html)"
- },
- "`AWS::CloudFormation::Interface`": {
- "ParameterGroups": "A list of parameter group types, where you specify group names, the parameters in each group, and the order in which the parameters are shown\\. \n*Required*: No \n*Type*: [AWS::CloudFormation::Interface ParameterGroup](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudformation-interface-parametergroup.html) \n*Update requires*: [No interruption](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-no-interrupt)",
- "ParameterLabels": "A mapping of parameters and their friendly names that the CloudFormation console shows when a stack is created or updated\\. \n*Required*: No \n*Type*: [`AWS::CloudFormation::Interface ParameterLabel`](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudformation-interface-parameterlabel.html) \n*Update requires*: [No interruption](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-no-interrupt)"
- },
- "`CreationPolicy` attribute": {
- "AutoScalingCreationPolicy": "For an Auto Scaling group [replacement update](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-updatepolicy.html#cfn-attributes-updatepolicy-replacingupdate), specifies how many instances must signal success for the update to succeed\\. \n`MinSuccessfulInstancesPercent` \nSpecifies the percentage of instances in an Auto Scaling replacement update that must signal success for the update to succeed\\. You can specify a value from `0` to `100`\\. CloudFormation rounds to the nearest tenth of a percent\\. For example, if you update five instances with a minimum successful percentage of `50`, three instances must signal success\\. If an instance doesn't send a signal within the time specified by the `Timeout` property, CloudFormation assumes that the instance wasn't created\\. \n*Default*: `100` \n*Type*: Integer \n*Required*: No",
- "ResourceSignal": "When CloudFormation creates the associated resource, configures the number of required success signals and the length of time that CloudFormation waits for those signals\\. \n`Count` \nThe number of success signals CloudFormation must receive before it sets the resource status as `CREATE_COMPLETE`\\. If the resource receives a failure signal or doesn't receive the specified number of signals before the timeout period expires, the resource creation fails and CloudFormation rolls the stack back\\. \n*Default*: `1` \n*Type*: Integer \n*Required*: No \n`Timeout` \nThe length of time that CloudFormation waits for the number of signals that was specified in the `Count` property\\. The timeout period starts after CloudFormation starts creating the resource, and the timeout expires no sooner than the time you specify but can occur shortly thereafter\\. The maximum time that you can specify is 12 hours\\. \nThe value must be in [ISO8601 duration format](http://en.wikipedia.org/wiki/ISO_8601#Durations), in the form: `PT#H#M#S`, where each *\\#* is the number of hours, minutes, and seconds, respectively\\. For best results, specify a period of time that gives your instances plenty of time to get up and running\\. A shorter timeout can cause a rollback\\. \n*Default*: `PT5M` \\(5 minutes\\) \n*Type*: String \n*Required*: No",
- "StartFleet": "Starts the specified fleet\\. \n*Required*: No"
- },
- "`UpdatePolicy` attribute": {
- "AfterAllowTrafficHook": "The name of the Lambda function to run after traffic routing completes\\. \n*Required*: No \n*Type: *String",
- "ApplicationName": "The name of the CodeDeploy application\\. \n*Required: *Yes \n*Type: *String",
- "BeforeAllowTrafficHook": "The name of the Lambda function to run before traffic routing starts\\. \n*Required*: No \n*Type: *String",
- "DeploymentGroupName": "The name of the CodeDeploy deployment group\\. This is where the traffic\\-shifting policy is set\\. \n*Required*: Yes \n*Type: *String",
- "IgnoreUnmodifiedGroupSizeProperties": "If `true`, AWS CloudFormation ignores differences in group size properties between your current Auto Scaling group and the Auto Scaling group described in the `AWS::AutoScaling::AutoScalingGroup` resource of your template during a stack update\\. If you modify any of the group size property values in your template, AWS CloudFormation uses the modified values and updates your Auto Scaling group\\. \n*Default*: `false` \n*Type*: Boolean \n*Required*: No",
- "MaxBatchSize": "Specifies the maximum number of instances that CloudFormation updates\\. \n*Default*: `1` \n*Maximum*: `100` \n*Type*: Integer \n*Required*: No",
- "MinInstancesInService": "Specifies the minimum number of instances that must be in service within the Auto Scaling group while CloudFormation updates old instances\\. This value must be less than the [MaxSize](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-as-group.html#cfn-as-group-maxsize) of the Auto Scaling group\\. \n*Default*: `0` \n*Type*: Integer \n*Required*: No",
- "MinSuccessfulInstancesPercent": "Specifies the percentage of instances in an Auto Scaling rolling update that must signal success for an update to succeed\\. You can specify a value from `0` to `100`\\. CloudFormation rounds to the nearest tenth of a percent\\. For example, if you update five instances with a minimum successful percentage of `50`, three instances must signal success\\. \nIf an instance doesn't send a signal within the time specified in the `PauseTime` property, CloudFormation assumes that the instance wasn't updated\\. \nIf you specify this property, you must also enable the `WaitOnResourceSignals` and `PauseTime` properties\\. \nThe `MinSuccessfulInstancesPercent` parameter applies only to instances only for signaling purpose\\. To specify the number of instances in your autoscaling group, see the `MinSize`, `MaxSize`, and `DesiredCapacity` properties for the [AWS::AutoScaling::AutoScalingGroup](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-as-group.html) resource\\. \n*Default*: `100` \n*Type*: Integer \n*Required*: No \nWhen the `MinSuccessfulInstancesPercent` property is set to `0`, CloudFormation waits for 0% of the capacity instances to be in an `InService` state\\. `MinSuccessfulInstancesPercent` returns immediately and before considering the Auto Scaling group status as `Update Complete` to move on to the subsequent resources defined in the stack template\\. \nIf other Auto Scaling groups are defined in your CloudFormation template, they will update simultaneously\\. When all Auto Scaling groups are deployed at once with 0% of the capacity instances in an `InService` state, then you will experience availability issues, due to 0 instances serving customer traffic\\. \nCloudFormation recommends that `MinSuccessfulInstancesPercent` is set to a value greater than 0, allowing reasonable minimum instances to verify before considering an Auto Scaling groups update to be completed\\.",
- "PauseTime": "The amount of time that CloudFormation pauses after making a change to a batch of instances to give those instances time to start software applications\\. For example, you might need to specify `PauseTime` when scaling up the number of instances in an Auto Scaling group\\. \nIf you enable the `WaitOnResourceSignals` property, `PauseTime` is the amount of time that CloudFormation should wait for the Auto Scaling group to receive the required number of valid signals from added or replaced instances\\. If the `PauseTime` is exceeded before the Auto Scaling group receives the required number of signals, the update fails\\. For best results, specify a time period that gives your applications sufficient time to get started\\. If the update needs to be rolled back, a short `PauseTime` can cause the rollback to fail\\. \nSpecify `PauseTime` in the [ISO8601 duration format](http://en.wikipedia.org/wiki/ISO_8601#Durations) \\(in the format `PT#H#M#S`, where each *\\#* is the number of hours, minutes, and seconds, respectively\\)\\. The maximum `PauseTime` is one hour \\(`PT1H`\\)\\. \n*Default*: `PT0S` \\(0 seconds\\)\\. If the `WaitOnResourceSignals` property is set to `true`, the default is `PT5M`\\. \n*Type*: String \n*Required*: No",
- "StartAfterUpdate": "Starts the specified fleet after the update\\. \n*Required*: No",
- "StopBeforeUpdate": "Stops the specified fleet before the update\\. \n*Required*: No",
- "SuspendProcesses": "Specifies the Auto Scaling processes to suspend during a stack update\\. Suspending processes prevents Auto Scaling from interfering with a stack update\\. For example, you can suspend alarming so that Amazon EC2 Auto Scaling doesn't initiate scaling policies associated with an alarm\\. For valid values, see the `ScalingProcesses.member.N` parameter for the [SuspendProcesses](https://docs.aws.amazon.com/autoscaling/ec2/APIReference/API_SuspendProcesses.html) action in the *Amazon EC2 Auto Scaling API Reference*\\. \n*Default*: Not specified \n*Type*: List of Auto Scaling processes \n*Required*: No",
- "WaitOnResourceSignals": "Specifies whether the Auto Scaling group waits on signals from new instances during an update\\. Use this property to ensure that instances have completed installing and configuring applications before the Auto Scaling group update proceeds\\. AWS CloudFormation suspends the update of an Auto Scaling group after new EC2 instances are launched into the group\\. AWS CloudFormation must receive a signal from each new instance within the specified `PauseTime` before continuing the update\\. To signal the Auto Scaling group, use the [cfn\\-signal](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/cfn-signal.html) helper script or [https://docs.aws.amazon.com/AWSCloudFormation/latest/APIReference/API_SignalResource.html](https://docs.aws.amazon.com/AWSCloudFormation/latest/APIReference/API_SignalResource.html) API\\. \nTo have instances wait for an Elastic Load Balancing health check before they signal success, add a health\\-check verification by using the [cfn\\-init](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/cfn-init.html) helper script\\. For an example, see the `verify_instance_health` command in the [Auto Scaling rolling updates](https://github.com/awslabs/aws-cloudformation-templates/blob/master/aws/services/AutoScaling/AutoScalingRollingUpdates.yaml) sample template\\. \n*Default*: `false` \n*Type*: Boolean \n*Required*: Conditional\\. If you specify the `MinSuccessfulInstancesPercent` property, you must also enable the `WaitOnResourceSignals` and `PauseTime` properties\\.",
- "WillReplace": "Specifies whether an Auto Scaling group and the instances it contains are replaced during an update\\. During replacement, CloudFormation retains the old group until it finishes creating the new one\\. If the update fails, CloudFormation can roll back to the old Auto Scaling group and delete the new Auto Scaling group\\. \nWhile CloudFormation creates the new group, it doesn't detach or attach any instances\\. After successfully creating the new Auto Scaling group, CloudFormation deletes the old Auto Scaling group during the cleanup process\\. \nWhen you set the `WillReplace` parameter, remember to specify a matching [`CreationPolicy`](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-creationpolicy.html)\\. If the minimum number of instances \\(specified by the `MinSuccessfulInstancesPercent` property\\) don't signal success within the `Timeout` period \\(specified in the `CreationPolicy` policy\\), the replacement update fails and AWS CloudFormation rolls back to the old Auto Scaling group\\. \n*Type*: Boolean \n*Required*: No"
}
}
}
From a98e7a03f848757f0a1df25b3960fc6e7ef5ad04 Mon Sep 17 00:00:00 2001
From: Christoffer Rehn <1280602+hoffa@users.noreply.github.com>
Date: Thu, 2 Feb 2023 14:37:34 -0800
Subject: [PATCH 2/3] Fix lint
---
bin/parse_docs.py | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/bin/parse_docs.py b/bin/parse_docs.py
index 506e32222..8192c9bbe 100755
--- a/bin/parse_docs.py
+++ b/bin/parse_docs.py
@@ -13,9 +13,8 @@
import argparse
import json
import re
-from contextlib import suppress
from pathlib import Path
-from typing import Dict, Optional, Iterator, Tuple
+from typing import Dict, Iterator, Optional, Tuple
def parse(s: str) -> Iterator[Tuple[str, str]]:
From 4a16d9159f5c37943999851a569d6ddfbbcbd1cf Mon Sep 17 00:00:00 2001
From: Christoffer Rehn <1280602+hoffa@users.noreply.github.com>
Date: Thu, 2 Feb 2023 14:42:18 -0800
Subject: [PATCH 3/3] mypy
---
bin/parse_docs.py | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/bin/parse_docs.py b/bin/parse_docs.py
index 8192c9bbe..8621f534d 100755
--- a/bin/parse_docs.py
+++ b/bin/parse_docs.py
@@ -14,7 +14,7 @@
import json
import re
from pathlib import Path
-from typing import Dict, Iterator, Optional, Tuple
+from typing import Dict, Iterator, Tuple
def parse(s: str) -> Iterator[Tuple[str, str]]:
@@ -56,14 +56,14 @@ def convert_to_full_path(description: str, prefix: str) -> str:
return description
-def stringbetween(s: str, sep1: str, sep2: str) -> Optional[str]:
+def stringbetween(s: str, sep1: str, sep2: str) -> str:
"""
Return string between regexes. Case-insensitive. If sep2 doesn't match,
returns to end of string.
"""
start = re.search(sep1, s, re.IGNORECASE)
if not start:
- return None
+ return ""
s = s[start.end() :]
end = re.search(sep2, s, re.IGNORECASE)
if not end: