Skip to content

Update black to put ellipses on same line #15

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ repos:
- id: ruff
args: [--fix, --exit-non-zero-on-fix]
- repo: https://github.com/psf/black
rev: 23.7.0
rev: 23.9.1
hooks:
- id: black
- repo: https://github.com/adamchainz/blacken-docs
Expand Down
21 changes: 7 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,7 @@ from magentic import prompt


@prompt('Add more "dude"ness to: {phrase}')
def dudeify(phrase: str) -> str:
... # No function body as this is never executed
def dudeify(phrase: str) -> str: ... # No function body as this is never executed


dudeify("Hello, how are you?")
Expand All @@ -58,8 +57,7 @@ class Superhero(BaseModel):


@prompt("Create a Superhero named {name}.")
def create_superhero(name: str) -> Superhero:
...
def create_superhero(name: str) -> Superhero: ...


create_superhero("Garden Man")
Expand All @@ -83,8 +81,7 @@ def activate_oven(temperature: int, mode: Literal["broil", "bake", "roast"]) ->
"Prepare the oven so I can make {food}",
functions=[activate_oven],
)
def configure_oven(food: str) -> FunctionCall[str]:
...
def configure_oven(food: str) -> FunctionCall[str]: ...


output = configure_oven("cookies!")
Expand Down Expand Up @@ -116,8 +113,7 @@ def get_current_weather(location, unit="fahrenheit"):
"What's the weather like in {city}?",
functions=[get_current_weather],
)
def describe_weather(city: str) -> str:
...
def describe_weather(city: str) -> str: ...


describe_weather("Boston")
Expand All @@ -137,8 +133,7 @@ from magentic import prompt, StreamedStr


@prompt("Tell me about {country}")
def describe_country(country: str) -> StreamedStr:
...
def describe_country(country: str) -> StreamedStr: ...


# Print the chunks while they are being received
Expand Down Expand Up @@ -199,8 +194,7 @@ class Superhero(BaseModel):


@prompt("Create a Superhero team named {name}.")
def create_superhero_team(name: str) -> Iterable[Superhero]:
...
def create_superhero_team(name: str) -> Iterable[Superhero]: ...


start_time = time()
Expand Down Expand Up @@ -246,8 +240,7 @@ Many type checkers will raise warnings or errors for functions with the `@prompt
1. Make the function body `...` (this does not satisfy mypy) or `raise`.
```python
@prompt("Choose a color")
def random_color() -> str:
...
def random_color() -> str: ...
```
1. Use comment `# type: ignore[empty-body]` on each function. In this case you can add a docstring instead of `...`.
```python
Expand Down
47 changes: 24 additions & 23 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.