Skip to content
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

[pre-commit.ci] pre-commit autoupdate #3015

Merged
merged 4 commits into from
Oct 23, 2023
Merged
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
10 changes: 5 additions & 5 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
repos:
- repo: https://github.com/psf/black
rev: 23.7.0
rev: 23.10.0
hooks:
- id: black
exclude: ^(tests/\w+/snapshots/|tests/python_312/)

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.0.280
rev: v0.1.1
hooks:
- id: ruff
exclude: ^tests/\w+/snapshots/
Expand All @@ -18,13 +18,13 @@ repos:
exclude: (CHANGELOG|TWEET).md

- repo: https://github.com/pre-commit/mirrors-prettier
rev: v3.0.0
rev: v3.0.3
hooks:
- id: prettier
files: '^docs/.*\.mdx?$'

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
rev: v4.5.0
hooks:
- id: trailing-whitespace
- id: check-merge-conflict
Expand All @@ -35,7 +35,7 @@ repos:
args: ['--branch', 'main']

- repo: https://github.com/adamchainz/blacken-docs
rev: 1.15.0
rev: 1.16.0
hooks:
- id: blacken-docs
args: [--skip-errors]
36 changes: 20 additions & 16 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -774,31 +774,34 @@ An example of migrating existing code is given below:
# Existing code
@strawberry.type
class MyDataType:
name: str
name: str


@strawberry.type
class Subscription:
@strawberry.subscription
async def my_data_subscription(
self, info: Info, groups: list[str]
) -> AsyncGenerator[MyDataType | None, None]:
yield None
async for message in info.context["ws"].channel_listen("my_data", groups=groups):
yield MyDataType(name=message["payload"])
@strawberry.subscription
async def my_data_subscription(
self, info: Info, groups: list[str]
) -> AsyncGenerator[MyDataType | None, None]:
yield None
async for message in info.context["ws"].channel_listen(
"my_data", groups=groups
):
yield MyDataType(name=message["payload"])
```

```py
# New code
@strawberry.type
class Subscription:
@strawberry.subscription
async def my_data_subscription(
self, info: Info, groups: list[str]
) -> AsyncGenerator[MyDataType | None, None]:
async with info.context["ws"].listen_to_channel("my_data", groups=groups) as cm:
yield None
async for message in cm:
yield MyDataType(name=message["payload"])
@strawberry.subscription
async def my_data_subscription(
self, info: Info, groups: list[str]
) -> AsyncGenerator[MyDataType | None, None]:
async with info.context["ws"].listen_to_channel("my_data", groups=groups) as cm:
yield None
async for message in cm:
yield MyDataType(name=message["payload"])
```

Contributed by [Moritz Ulmer](https://github.com/moritz89) via [PR #2856](https://github.com/strawberry-graphql/strawberry/pull/2856/)
Expand Down Expand Up @@ -1417,6 +1420,7 @@ class Point:
x: float
y: float


class GetPointsResult:
circle_points: List[Point]
square_points: List[Point]
Expand Down
2 changes: 2 additions & 0 deletions docs/_test.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ Code blocks now support:
```python highlight=strawberry,str
import strawberry


@strawberry.type
class X:
name: str
Expand All @@ -26,6 +27,7 @@ class X:
```python lines=1-4
import strawberry


@strawberry.type
class X:
name: str
Expand Down
Loading
Loading