Skip to content

Commit 42e88d8

Browse files
committed
Fix docstrings
1 parent 19393f9 commit 42e88d8

5 files changed

Lines changed: 15 additions & 21 deletions

File tree

scripts/docs.py

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -99,13 +99,7 @@ def verify_readme() -> None:
9999
@app.command()
100100
def live(dirty: bool = False) -> None:
101101
"""
102-
Serve with livereload a docs site for a specific language.
103-
104-
This only shows the actual translated files, not the placeholders created with
105-
build-all.
106-
107-
Takes an optional LANG argument with the name of the language to serve, by default
108-
en.
102+
Serve the docs site with livereload, at http://127.0.0.1:8008.
109103
"""
110104
# Enable line numbers during local development to make it easier to highlight
111105
args = ["zensical", "serve", "--dev-addr", "127.0.0.1:8008"]

sqlmodel/_compat.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ def get_sa_type_from_type_annotation(annotation: Any) -> Any:
184184
bases = get_args(annotation)
185185
if len(bases) > 2:
186186
raise ValueError("Cannot have a (non-optional) union as a SQLAlchemy field")
187-
# Non optional unions are not allowed
187+
# Non-optional unions are not allowed
188188
if bases[0] is not NoneType and bases[1] is not NoneType:
189189
raise ValueError("Cannot have a (non-optional) union as a SQLAlchemy field")
190190
# Optional unions are allowed

sqlmodel/ext/asyncio/session.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ async def exec(
105105
🚨 You probably want to use `session.exec()` instead of `session.execute()`.
106106
107107
This is the original SQLAlchemy `session.execute()` method that returns objects
108-
of type `Row`, and that you have to call `scalars()` to get the model objects.
108+
of type `Row`, on which you have to call `scalars()` to get the model objects.
109109
110110
For example:
111111
@@ -114,7 +114,7 @@ async def exec(
114114
heroes = result.scalars().all()
115115
```
116116
117-
instead you could use `exec()`:
117+
Instead, you could use `exec()`:
118118
119119
```Python
120120
result = await session.exec(select(Hero))
@@ -136,7 +136,7 @@ async def execute(
136136
🚨 You probably want to use `session.exec()` instead of `session.execute()`.
137137
138138
This is the original SQLAlchemy `session.execute()` method that returns objects
139-
of type `Row`, and that you have to call `scalars()` to get the model objects.
139+
of type `Row`, on which you have to call `scalars()` to get the model objects.
140140
141141
For example:
142142
@@ -145,7 +145,7 @@ async def execute(
145145
heroes = result.scalars().all()
146146
```
147147
148-
instead you could use `exec()`:
148+
Instead, you could use `exec()`:
149149
150150
```Python
151151
result = await session.exec(select(Hero))

sqlmodel/main.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1006,6 +1006,6 @@ def sqlmodel_update(
10061006
else:
10071007
raise ValueError(
10081008
"Can't use sqlmodel_update() with something that "
1009-
f"is not a dict or SQLModel or Pydantic model: {obj}"
1009+
f"is not a dict, SQLModel, or Pydantic model: {obj}"
10101010
)
10111011
return self

sqlmodel/orm/session.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -89,15 +89,15 @@ def exec(
8989
🚨 You probably want to use `session.exec()` instead of `session.execute()`.
9090
9191
This is the original SQLAlchemy `session.execute()` method that returns objects
92-
of type `Row`, and that you have to call `scalars()` to get the model objects.
92+
of type `Row`, on which you have to call `scalars()` to get the model objects.
9393
9494
For example:
9595
9696
```Python
9797
heroes = session.execute(select(Hero)).scalars().all()
9898
```
9999
100-
instead you could use `exec()`:
100+
Instead, you could use `exec()`:
101101
102102
```Python
103103
heroes = session.exec(select(Hero)).all()
@@ -119,15 +119,15 @@ def execute(
119119
🚨 You probably want to use `session.exec()` instead of `session.execute()`.
120120
121121
This is the original SQLAlchemy `session.execute()` method that returns objects
122-
of type `Row`, and that you have to call `scalars()` to get the model objects.
122+
of type `Row`, on which you have to call `scalars()` to get the model objects.
123123
124124
For example:
125125
126126
```Python
127127
heroes = session.execute(select(Hero)).scalars().all()
128128
```
129129
130-
instead you could use `exec()`:
130+
Instead, you could use `exec()`:
131131
132132
```Python
133133
heroes = session.exec(select(Hero)).all()
@@ -146,10 +146,10 @@ def execute(
146146
"""
147147
🚨 You probably want to use `session.exec()` instead of `session.query()`.
148148
149-
`session.exec()` is SQLModel's own short version with increased type
149+
`session.exec()` is SQLModel's own short version with improved type
150150
annotations.
151151
152-
Or otherwise you might want to use `session.execute()` instead of
152+
Otherwise, you might want to use `session.execute()` instead of
153153
`session.query()`.
154154
"""
155155
)
@@ -159,10 +159,10 @@ def query( # type: ignore
159159
"""
160160
🚨 You probably want to use `session.exec()` instead of `session.query()`.
161161
162-
`session.exec()` is SQLModel's own short version with increased type
162+
`session.exec()` is SQLModel's own short version with improved type
163163
annotations.
164164
165-
Or otherwise you might want to use `session.execute()` instead of
165+
Otherwise, you might want to use `session.execute()` instead of
166166
`session.query()`.
167167
"""
168168
return super().query(*entities, **kwargs)

0 commit comments

Comments
 (0)