Skip to content

Commit

Permalink
[pre-commit.ci] pre-commit autoupdate (#3015)
Browse files Browse the repository at this point in the history
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Patrick Arminio <[email protected]>
  • Loading branch information
pre-commit-ci[bot] and patrick91 authored Oct 23, 2023
1 parent 78b7260 commit 4e65ab3
Show file tree
Hide file tree
Showing 22 changed files with 383 additions and 459 deletions.
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

0 comments on commit 4e65ab3

Please sign in to comment.