Skip to content

Commit 78d0e94

Browse files
authored
Merge pull request #7 from django-utils/methods
Renamed internal methods in core channel layer.
2 parents 1e49c2f + bccab6a commit 78d0e94

File tree

5 files changed

+29
-33
lines changed

5 files changed

+29
-33
lines changed

.github/workflows/tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ jobs:
5050
with:
5151
python-version: ${{ matrix.python-version }}
5252
- name: Install uv
53-
uses: astral-sh/setup-uv@v5
53+
uses: astral-sh/setup-uv@v6
5454

5555
- name: Install dependencies
5656
run: |

.pre-commit-config.yaml

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,13 @@
11
repos:
22
- repo: https://github.com/adamchainz/django-upgrade
3-
rev: 1.24.0
3+
rev: 1.25.0
44
hooks:
55
- id: django-upgrade
6-
args: [--target-version, "5.1"]
7-
8-
- repo: https://github.com/psf/black
9-
rev: 25.1.0
10-
hooks:
11-
- id: black
6+
args: [--target-version, "5.2"]
127

138
- repo: https://github.com/astral-sh/ruff-pre-commit
14-
rev: v0.11.5
9+
rev: v0.12.4
1510
hooks:
16-
- id: ruff
11+
- id: ruff-check
12+
- id: ruff-format
13+

channels_valkey/core.py

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ async def send(self, channel, message):
168168
"""
169169
# Typecheck
170170
assert isinstance(message, dict), "message is not a dict"
171-
assert self.valid_channel_name(channel), "Channel name not valid"
171+
assert self.require_valid_channel_name(channel), "Channel name not valid"
172172
# Make sure the message does not contain reserved keys
173173
assert "__asgi_channel__" not in message
174174
# If it's a process-local channel, strip off local part and stick full name in message
@@ -255,12 +255,12 @@ async def receive(self, channel):
255255
"""
256256
# Make sure the channel name is valid then get the non-local part
257257
# and thus its index
258-
assert self.valid_channel_name(channel)
258+
assert self.require_valid_channel_name(channel)
259259
if "!" in channel:
260260
real_channel = self.non_local_name(channel)
261-
assert real_channel.endswith(
262-
self.client_prefix + "!"
263-
), "Wrong client prefix"
261+
assert real_channel.endswith(self.client_prefix + "!"), (
262+
"Wrong client prefix"
263+
)
264264
# Enter receiving section
265265
loop = asyncio.get_running_loop()
266266
self.receive_count += 1
@@ -376,7 +376,9 @@ async def receive_single(self, channel):
376376
Receives a single message off of the channel and returns it.
377377
"""
378378
# Check channel name
379-
assert self.valid_channel_name(channel, receive=True), "Channel name invalid"
379+
assert self.require_valid_channel_name(channel, receive=True), (
380+
"Channel name invalid"
381+
)
380382
# Work out the connection to use
381383
if "!" in channel:
382384
assert channel.endswith("!")
@@ -481,8 +483,8 @@ async def group_add(self, group, channel):
481483
Adds the channel name to a group.
482484
"""
483485
# Check the inputs
484-
assert self.valid_group_name(group), "Group name not valid"
485-
assert self.valid_channel_name(channel), "Channel name not valid"
486+
assert self.require_valid_group_name(group), "Group name not valid"
487+
assert self.require_valid_channel_name(channel), "Channel name not valid"
486488
# Get a connection to the right shard
487489
group_key = self._group_key(group)
488490
connection = self.connection(self.consistent_hash(group))
@@ -507,7 +509,7 @@ async def group_send(self, group, message):
507509
"""
508510
Sends a message to the entire group.
509511
"""
510-
assert self.valid_group_name(group), "Group name not valid"
512+
assert self.require_valid_group_name(group), "Group name not valid"
511513
# Retrieve list of all channel names
512514
key = self._group_key(group)
513515
connection = self.connection(self.consistent_hash(group))

pyproject.toml

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ description = "Valkey-backed ASGI channel layer implementation"
1414
readme = "README.rst"
1515
requires-python = ">=3.9"
1616
dependencies = [
17-
"asgiref>=3.2.10",
18-
"channels>=4.1.0",
17+
"asgiref>=3.9.1",
18+
"channels>=4.2.2",
1919
"msgpack>=1.1.0",
2020
"valkey>=6.0.0",
2121
]
@@ -32,13 +32,12 @@ cryptography = [
3232

3333
[tool.uv]
3434
dev-dependencies = [
35-
"async-timeout>=4.0.3",
36-
"black>=24.10.0",
35+
"async-timeout>=5.0.1",
3736
"coverage>=7.6.2",
38-
"pre-commit>=4.0.1",
39-
"pytest>=8.3.3",
37+
"pre-commit>=4.2.0",
38+
"pytest>=8.4.1",
4039
"pytest-asyncio>=1.1.0",
41-
"ruff>=0.6.9",
40+
"ruff>=0.12.4",
4241
"tox>=4.21.2",
4342
]
4443

tox.ini

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[tox]
22
envlist =
3-
py{39,310,311,312,313}-ch{30,40,main}-valkey60
4-
py311-chmain-valkey{60,main}
3+
py{39,310,311,312,313}-ch{4,main}-valkey6
4+
py313-chmain-valkey{6,main}
55
qa
66

77
[testenv]
@@ -12,17 +12,15 @@ commands =
1212
uv run pytest -v {posargs}
1313

1414
deps =
15-
ch30: channels>=3.0,<3.1
16-
ch40: channels>=4.0,<4.1
15+
ch4: channels>=4.0,<5
1716
chmain: https://github.com/django/channels/archive/main.tar.gz
18-
valkey60: valkey>=6.0,<6.1
17+
valkey6: valkey>=6.0,<7
1918
valkeymain: https://github.com/valkey-io/valkey-py/archive/master.tar.gz
2019

2120
[testenv:qa]
2221
skip_install=true
2322
deps =
24-
black
2523
ruff
2624
commands =
2725
ruff check channels_valkey tests
28-
black --check channels_valkey tests
26+
ruff format channels_valkey tests

0 commit comments

Comments
 (0)