Skip to content

Commit

Permalink
馃摑 Add extra missing exclamation points for MkDocs Material annotations
Browse files Browse the repository at this point in the history
  • Loading branch information
tiangolo committed Oct 29, 2023
1 parent ab08cbd commit 37db3c3
Show file tree
Hide file tree
Showing 5 changed files with 60 additions and 60 deletions.
78 changes: 39 additions & 39 deletions docs_src/tutorial/automatic_id_none_refresh/tutorial002.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,45 +32,45 @@ def create_heroes():

with Session(engine) as session: # (8)!
session.add(hero_1) # (9)!
session.add(hero_2) # (10)
session.add(hero_3) # (11)

print("After adding to the session") # (12)
print("Hero 1:", hero_1) # (13)
print("Hero 2:", hero_2) # (14)
print("Hero 3:", hero_3) # (15)

session.commit() # (16)

print("After committing the session") # (17)
print("Hero 1:", hero_1) # (18)
print("Hero 2:", hero_2) # (19)
print("Hero 3:", hero_3) # (20)

print("After committing the session, show IDs") # (21)
print("Hero 1 ID:", hero_1.id) # (22)
print("Hero 2 ID:", hero_2.id) # (23)
print("Hero 3 ID:", hero_3.id) # (24)

print("After committing the session, show names") # (25)
print("Hero 1 name:", hero_1.name) # (26)
print("Hero 2 name:", hero_2.name) # (27)
print("Hero 3 name:", hero_3.name) # (28)

session.refresh(hero_1) # (29)
session.refresh(hero_2) # (30)
session.refresh(hero_3) # (31)

print("After refreshing the heroes") # (32)
print("Hero 1:", hero_1) # (33)
print("Hero 2:", hero_2) # (34)
print("Hero 3:", hero_3) # (35)
# (36)

print("After the session closes") # (37)
print("Hero 1:", hero_1) # (38)
print("Hero 2:", hero_2) # (39)
print("Hero 3:", hero_3) # (40)
session.add(hero_2) # (10)!
session.add(hero_3) # (11)!

print("After adding to the session") # (12)!
print("Hero 1:", hero_1) # (13)!
print("Hero 2:", hero_2) # (14)!
print("Hero 3:", hero_3) # (15)!

session.commit() # (16)!

print("After committing the session") # (17)!
print("Hero 1:", hero_1) # (18)!
print("Hero 2:", hero_2) # (19)!
print("Hero 3:", hero_3) # (20)!

print("After committing the session, show IDs") # (21)!
print("Hero 1 ID:", hero_1.id) # (22)!
print("Hero 2 ID:", hero_2.id) # (23)!
print("Hero 3 ID:", hero_3.id) # (24)!

print("After committing the session, show names") # (25)!
print("Hero 1 name:", hero_1.name) # (26)!
print("Hero 2 name:", hero_2.name) # (27)!
print("Hero 3 name:", hero_3.name) # (28)!

session.refresh(hero_1) # (29)!
session.refresh(hero_2) # (30)!
session.refresh(hero_3) # (31)!

print("After refreshing the heroes") # (32)!
print("Hero 1:", hero_1) # (33)!
print("Hero 2:", hero_2) # (34)!
print("Hero 3:", hero_3) # (35)!
# (36)!

print("After the session closes") # (37)!
print("Hero 1:", hero_1) # (38)!
print("Hero 2:", hero_2) # (39)!
print("Hero 3:", hero_3) # (40)!


def main():
Expand Down
8 changes: 4 additions & 4 deletions docs_src/tutorial/delete/tutorial002.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,11 @@ def delete_heroes():

statement = select(Hero).where(Hero.name == "Spider-Youngster") # (8)!
results = session.exec(statement) # (9)!
hero = results.first() # (10)
hero = results.first() # (10)!

if hero is None: # (11)
print("There's no hero named Spider-Youngster") # (12)
# (13)
if hero is None: # (11)!
print("There's no hero named Spider-Youngster") # (12)!
# (13)!


def main():
Expand Down
4 changes: 2 additions & 2 deletions docs_src/tutorial/insert/tutorial003.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,5 +39,5 @@ def main(): # (7)!
create_heroes() # (9)!


if __name__ == "__main__": # (10)
main() # (11)
if __name__ == "__main__": # (10)!
main() # (11)!
8 changes: 4 additions & 4 deletions docs_src/tutorial/select/tutorial002.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,15 @@ def select_heroes():
with Session(engine) as session: # (7)!
statement = select(Hero) # (8)!
results = session.exec(statement) # (9)!
for hero in results: # (10)
print(hero) # (11)
# (12)
for hero in results: # (10)!
print(hero) # (11)!
# (12)!


def main():
create_db_and_tables()
create_heroes()
select_heroes() # (13)
select_heroes() # (13)!


if __name__ == "__main__":
Expand Down
22 changes: 11 additions & 11 deletions docs_src/tutorial/update/tutorial004.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,20 +54,20 @@ def update_heroes():
print("Hero 2:", hero_2) # (8)!

hero_1.age = 16 # (9)!
hero_1.name = "Spider-Youngster" # (10)
session.add(hero_1) # (11)
hero_1.name = "Spider-Youngster" # (10)!
session.add(hero_1) # (11)!

hero_2.name = "Captain North America Except Canada" # (12)
hero_2.age = 110 # (13)
session.add(hero_2) # (14)
hero_2.name = "Captain North America Except Canada" # (12)!
hero_2.age = 110 # (13)!
session.add(hero_2) # (14)!

session.commit() # (15)
session.refresh(hero_1) # (16)
session.refresh(hero_2) # (17)
session.commit() # (15)!
session.refresh(hero_1) # (16)!
session.refresh(hero_2) # (17)!

print("Updated hero 1:", hero_1) # (18)
print("Updated hero 2:", hero_2) # (19)
# (20)
print("Updated hero 1:", hero_1) # (18)!
print("Updated hero 2:", hero_2) # (19)!
# (20)!


def main():
Expand Down

0 comments on commit 37db3c3

Please sign in to comment.