Skip to content

Commit 127888b

Browse files
committed
Sort before looking for first
1 parent be6f4b4 commit 127888b

File tree

22 files changed

+73
-76
lines changed

22 files changed

+73
-76
lines changed

.tools/readmes/scanner.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -142,14 +142,11 @@ def snippet(self, example: Example, readme_folder, api_name: str):
142142
excerpt = first(ex_ver.excerpts)
143143
if excerpt is not None:
144144
if excerpt.snippet_tags:
145-
tags = excerpt.snippet_tags
146-
tags = [*filter(lambda t: api_name in t, tags)]
147-
148145
# This form ensures that READMEs are always consistent,
149146
# but does not always give the "best" README link.
150-
tags = [*sorted(tags)]
151-
152-
tag = first(tags) or excerpt.snippet_tags[0]
147+
tags = [*sorted(excerpt.snippet_tags)]
148+
filtered = filter(lambda t: api_name in t, tags)
149+
tag = first(filtered) or tags[0]
153150
tags = excerpt.snippet_tags
154151
elif excerpt.snippet_files:
155152
# TODO: Find the best (or all?) snippet files, not the first.

aws-cli/bash-linux/s3/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ Code excerpts that show you how to call individual service functions.
4747
- [DeleteObjects](bucket-lifecycle-operations/bucket_operations.sh#L303)
4848
- [GetObject](bucket-lifecycle-operations/bucket_operations.sh#L168)
4949
- [HeadBucket](bucket-lifecycle-operations/bucket_operations.sh#L20)
50-
- [ListObjectsV2](bucket-lifecycle-operations/awsdocs_general.sh#L94)
50+
- [ListObjectsV2](bucket-lifecycle-operations/bucket_operations.sh#L236)
5151
- [PutObject](bucket-lifecycle-operations/bucket_operations.sh#L134)
5252

5353

cpp/example_code/iam/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ Code excerpts that show you how to call individual service functions.
4949
- [AttachRolePolicy](attach_role_policy.cpp#L38)
5050
- [CreateAccessKey](create_access_key.cpp#L35)
5151
- [CreateAccountAlias](create_account_alias.cpp#L35)
52-
- [CreatePolicy](create_policy.cpp#L43)
52+
- [CreatePolicy](create_policy.cpp#L69)
5353
- [CreateRole](create_role.cpp#L35)
5454
- [CreateUser](create_user.cpp#L40)
5555
- [DeleteAccessKey](delete_access_key.cpp#L35)

cpp/example_code/s3/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ Code excerpts that show you how to call individual service functions.
7272
- [ListBuckets](list_buckets.cpp#L29)
7373
- [ListObjectsV2](list_objects.cpp#L32)
7474
- [PutBucketAcl](put_bucket_acl.cpp#L47)
75-
- [PutBucketPolicy](put_bucket_policy.cpp#L37)
75+
- [PutBucketPolicy](put_bucket_policy.cpp#L68)
7676
- [PutBucketWebsite](put_website_config.cpp#L33)
7777
- [PutObject](put_object.cpp#L33)
7878
- [PutObjectAcl](get_put_object_acl.cpp#L165)

gov2/s3/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ Code excerpts that show you how to call individual service functions.
6060
- [ListObjectsV2](actions/bucket_basics.go#L238)
6161
- [PutObject](actions/bucket_basics.go#L100)
6262
- [PutObjectLegalHold](../workflows/s3_object_lock/actions/s3_actions.go#L173)
63-
- [PutObjectLockConfiguration](../workflows/s3_object_lock/actions/s3_actions.go#L22)
63+
- [PutObjectLockConfiguration](../workflows/s3_object_lock/actions/s3_actions.go#L234)
6464
- [PutObjectRetention](../workflows/s3_object_lock/actions/s3_actions.go#L276)
6565

6666
### Scenarios

php/example_code/dynamodb/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,12 @@ Code examples that show you how to perform the essential operations within a ser
4040

4141
Code excerpts that show you how to call individual service functions.
4242

43-
- [BatchExecuteStatement](DynamoDBService.php#L273)
43+
- [BatchExecuteStatement](DynamoDBService.php#L319)
4444
- [BatchWriteItem](DynamoDBService.php#L201)
4545
- [CreateTable](dynamodb_basics/GettingStartedWithDynamoDB.php#L52)
46-
- [DeleteItem](dynamodb_basics/GettingStartedWithDynamoDB.php#L100)
46+
- [DeleteItem](dynamodb_basics/GettingStartedWithDynamoDB.php#L148)
4747
- [DeleteTable](DynamoDBService.php#L84)
48-
- [ExecuteStatement](DynamoDBService.php#L243)
48+
- [ExecuteStatement](DynamoDBService.php#L263)
4949
- [GetItem](dynamodb_basics/GettingStartedWithDynamoDB.php#L131)
5050
- [ListTables](DynamoDBService.php#L64)
5151
- [PutItem](dynamodb_basics/GettingStartedWithDynamoDB.php#L67)

php/example_code/glue/README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,19 +41,19 @@ Code examples that show you how to perform the essential operations within a ser
4141
Code excerpts that show you how to call individual service functions.
4242

4343
- [CreateCrawler](GettingStartedWithGlue.php#L47)
44-
- [CreateJob](GettingStartedWithGlue.php#L54)
44+
- [CreateJob](GettingStartedWithGlue.php#L110)
4545
- [DeleteCrawler](GettingStartedWithGlue.php#L180)
4646
- [DeleteDatabase](GettingStartedWithGlue.php#L173)
4747
- [DeleteJob](GettingStartedWithGlue.php#L159)
4848
- [DeleteTable](GettingStartedWithGlue.php#L166)
4949
- [GetCrawler](GettingStartedWithGlue.php#L69)
5050
- [GetDatabase](GettingStartedWithGlue.php#L58)
51-
- [GetJobRun](GettingStartedWithGlue.php#L107)
52-
- [GetJobRuns](GettingStartedWithGlue.php#L107)
51+
- [GetJobRun](GettingStartedWithGlue.php#L120)
52+
- [GetJobRuns](GettingStartedWithGlue.php#L130)
5353
- [GetTables](GettingStartedWithGlue.php#L58)
5454
- [ListJobs](GettingStartedWithGlue.php#L151)
5555
- [StartCrawler](GettingStartedWithGlue.php#L47)
56-
- [StartJobRun](GettingStartedWithGlue.php#L107)
56+
- [StartJobRun](GettingStartedWithGlue.php#L58)
5757

5858

5959
<!--custom.examples.start-->

php/example_code/iam/README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,11 @@ For prerequisites, see the [README](../../README.md#Prerequisites) in the `php`
3333

3434
Code excerpts that show you how to call individual service functions.
3535

36-
- [AttachRolePolicy](GettingStartedWithIAM.php#L46)
37-
- [CreatePolicy](GettingStartedWithIAM.php#L46)
38-
- [CreateRole](GettingStartedWithIAM.php#L46)
36+
- [AttachRolePolicy](GettingStartedWithIAM.php#L82)
37+
- [CreatePolicy](GettingStartedWithIAM.php#L70)
38+
- [CreateRole](GettingStartedWithIAM.php#L57)
3939
- [CreateServiceLinkedRole](GettingStartedWithIAM.php#L46)
40-
- [CreateUser](GettingStartedWithIAM.php#L46)
40+
- [CreateUser](GettingStartedWithIAM.php#L51)
4141
- [GetAccountPasswordPolicy](GettingStartedWithIAM.php#L46)
4242
- [GetPolicy](GettingStartedWithIAM.php#L46)
4343
- [GetRole](GettingStartedWithIAM.php#L46)

php/example_code/s3/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@ Code examples that show you how to perform the essential operations within a ser
4545

4646
Code excerpts that show you how to call individual service functions.
4747

48-
- [CopyObject](GettingStartedWithS3.php#L52)
49-
- [CreateBucket](GettingStartedWithS3.php#L52)
48+
- [CopyObject](GettingStartedWithS3.php#L104)
49+
- [CreateBucket](GettingStartedWithS3.php#L61)
5050
- [DeleteBucket](GettingStartedWithS3.php#L52)
5151
- [DeleteObjects](GettingStartedWithS3.php#L52)
5252
- [GetObject](GettingStartedWithS3.php#L52)

python/example_code/cognito/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ python -m pip install -r requirements.txt
4343

4444
Code excerpts that show you how to call individual service functions.
4545

46-
- [AdminGetUser](cognito_idp_actions.py#L23)
46+
- [AdminGetUser](cognito_idp_actions.py#L56)
4747
- [AdminInitiateAuth](cognito_idp_actions.py#L187)
4848
- [AdminRespondToAuthChallenge](cognito_idp_actions.py#L292)
4949
- [AssociateSoftwareToken](cognito_idp_actions.py#L241)

0 commit comments

Comments
 (0)