Skip to content

Commit

Permalink
[Cosmos] Fix example formatting (#7171)
Browse files Browse the repository at this point in the history
* Bumped dependency

* Update reqs

* Fixed dependency, replaced changelog

* Updated readme and examples

* Updated docs URLs

* Fixed f-strings

* Another f-string
  • Loading branch information
annatisch authored Sep 10, 2019
1 parent abed370 commit e5bd6dd
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions sdk/cosmos/azure-cosmos/samples/examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,15 +62,15 @@
# [START list_containers]
database = client.get_database_client(database_name)
for container in database.list_containers():
print(f"Container ID: {container.id}")
print("Container ID: {}".format(container.id))
# [END list_containers]

# Insert new items by defining a dict and calling Container.upsert_item
# [START upsert_items]
container = database.get_container_client(container_name)
for i in range(1, 10):
container.upsert_item(
dict(id=f"item{i}", productName="Widget", productModel=f"Model {i}")
dict(id="item{}".format(i), productName="Widget", productModel="Model {}".format(i))
)
# [END upsert_items]

Expand Down Expand Up @@ -131,7 +131,7 @@

# Display the new TTL setting for the container
container_props = database.get_container_client(container_name).read()
print(f"New container TTL: {json.dumps(container_props['defaultTtl'])}")
print("New container TTL: {}".format(json.dumps(container_props['defaultTtl'])))
# [END reset_container_properties]

# Create a user in the database.
Expand All @@ -141,5 +141,5 @@
except errors.CosmosResourceExistsError:
print("A user with that ID already exists.")
except errors.CosmosHttpResponseError as failure:
print(f"Failed to create user. Status code:{failure.status_code}")
print("Failed to create user. Status code:{}".format(failure.status_code))
# [END create_user]

0 comments on commit e5bd6dd

Please sign in to comment.