Skip to content

Commit fda686f

Browse files
authored
Use f-strings in the Authoring Guide (GoogleCloudPlatform#4129)
1 parent 84fc498 commit fda686f

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

AUTHORING_GUIDE.md

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -167,9 +167,7 @@ def download_encrypted_blob(
167167
blob.download_to_filename(
168168
destination_file_name, encryption_key=encryption_key)
169169

170-
print('Blob {} downloaded to {}.'.format(
171-
source_blob_name,
172-
destination_file_name))
170+
print(f'Blob {source_blob_name} downloaded to {destination_file_name}.'
173171
```
174172

175173
Note the verbose parameter names and the extended description that helps the
@@ -197,7 +195,7 @@ and increased cognitive load.
197195
Argument types should be documented using Python type annotations as
198196
introduced in [PEP 484](https://www.python.org/dev/peps/pep-0484/). For example:
199197

200-
```
198+
```py
201199
def hello_world(name: string):
202200
print(f"Hello {name}!")
203201
```
@@ -327,19 +325,19 @@ assure uniqueness. Use the Python ```uuid``` package from the standard
327325
library to generate UUIDs for resource names. For example:
328326
329327
```python
330-
glossary_id = 'test-glossary-{}'.format(uuid.uuid4())
328+
glossary_id = f'test-glossary-{uuid.uuid4()}'
331329
```
332330
333331
or:
334332
335333
```python
336334
# If full uuid4 is too long, use its hex representation.
337-
encrypted_disk_name = 'test-disk-{}'.format(uuid.uuid4().hex)
335+
encrypted_disk_name = f'test-disk-{uuid.uuid4().hex}'
338336
```
339337
340338
```python
341339
# If the hex representation is also too long, slice it.
342-
encrypted_disk_name = 'test-disk-{}'.format(uuid.uuid4().hex[:5]
340+
encrypted_disk_name = f'test-disk-{uuid.uuid4().hex[:5]}'
343341
```
344342
345343
All temporary resources should be explicitly deleted when testing is

0 commit comments

Comments
 (0)