Skip to content
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
3 changes: 1 addition & 2 deletions examples/django/datastar/asgi.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
"""
ASGI config for datastar project.
"""ASGI config for datastar project.

It exposes the ASGI callable as a module-level variable named ``application``.

Expand Down
3 changes: 1 addition & 2 deletions examples/django/datastar/settings.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
"""
Django settings for datastar project.
"""Django settings for datastar project.

Generated by 'django-admin startproject' using Django 4.2.16.

Expand Down
5 changes: 3 additions & 2 deletions examples/django/datastar/urls.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
"""
URL configuration for datastar project.
"""URL configuration for datastar project.

The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/4.2/topics/http/urls/

Examples:
Function views
1. Add an import: from my_app import views
Expand All @@ -13,6 +13,7 @@
Including another URLconf
1. Import the include() function: from django.urls import include, path
2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))

"""

from django.contrib import admin
Expand Down
5 changes: 2 additions & 3 deletions examples/django/datastar/wsgi.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
"""
WSGI config for datastar project.
"""WSGI config for datastar project.

It exposes the WSGI callable as a module-level variable named ``application``.

Expand All @@ -20,7 +19,7 @@
original_is_hop_by_hop = wsgiref.handlers.is_hop_by_hop

def custom_is_hop_by_hop(header_name):
"""Permit the "connection" header over WSGI
"""Permit the "connection" header over WSGI.

Datastar by default, sets the connection header to "keep-alive".
Per the WSGI spec (see below), wsgiref does not permit setting
Expand Down
15 changes: 14 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ lint.select = [
"ANN",
# flake8-bugbear
"B",
"D",
# pycodestyle
"E",
# Pyflakes
Expand All @@ -70,7 +71,19 @@ lint.select = [
# pyupgrade
"UP",
]
lint.ignore = [ "E501" ]
lint.ignore = [
"D100", # undocumented-public-module
"D101", # undocumented-public-class
"D102", # undocumented-public-method
"D103", # undocumented-public-function
"D104", # undocumented-public-package
"D107", # undocumented-public-init
"D203", # Conflicting with other rules
"D213", # Conflicting with other rules
"D401", # non-imperative-mood
"D415", # Duplicate of D400
"E501",
]
lint.fixable = [ "ALL" ]

per-file-ignores."examples/**/*.py" = [ "ANN" ]
4 changes: 2 additions & 2 deletions sdk-test.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
# datastar-py = { path = "." }
# ///

"""
Runs a test server that the SDK tests can be run against.
"""Runs a test server that the SDK tests can be run against.

1. Start this server with `uv run sdk-test.py`
2. Move to the sdk/tests folder.
3. Run `test-all.sh http://127.0.0.1:8000` to run the tests.
Expand Down
2 changes: 1 addition & 1 deletion src/datastar_py/attributes.py
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ def show(self, expression: str) -> BaseAttr:
return BaseAttr("show", value=expression, alias=self._alias)

def style(self, style_dict: Mapping | None = None, /, **styles: str) -> BaseAttr:
"""Sets the value of inline CSS styles on an element based on an expression, and keeps them in sync."""
"""Set the value of inline CSS styles on an element based on an expression, and keeps them in sync."""
styles = {**(style_dict if style_dict else {}), **styles}
return BaseAttr("style", value=_js_object(styles), alias=self._alias)

Expand Down
2 changes: 1 addition & 1 deletion src/datastar_py/django.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@


class DatastarResponse(_StreamingHttpResponse):
"""Respond with 0..N `DatastarEvent`s"""
"""Respond with 0..N `DatastarEvent`s."""

default_headers: dict[str, str] = SSE_HEADERS.copy()

Expand Down
2 changes: 1 addition & 1 deletion src/datastar_py/litestar.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@


class DatastarResponse(Stream):
"""Respond with 0..N `DatastarEvent`s"""
"""Respond with 0..N `DatastarEvent`s."""

default_headers: dict[str, str] = SSE_HEADERS.copy()

Expand Down
2 changes: 1 addition & 1 deletion src/datastar_py/quart.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@


class DatastarResponse(Response):
"""Respond with 0..N `DatastarEvent`s"""
"""Respond with 0..N `DatastarEvent`s."""

default_headers: dict[str, str] = SSE_HEADERS.copy()

Expand Down
3 changes: 2 additions & 1 deletion src/datastar_py/sse.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ class _HtmlProvider(Protocol):

This is a convention used by html producing/consuming libraries. This lets
e.g. fasthtml fasttags, or htpy elements, be passed straight in to
merge_fragments."""
merge_fragments.
"""

def __html__(self) -> str: ...

Expand Down
2 changes: 1 addition & 1 deletion src/datastar_py/starlette.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@


class DatastarResponse(_StreamingResponse):
"""Respond with 0..N `DatastarEvent`s"""
"""Respond with 0..N `DatastarEvent`s."""

default_headers: dict[str, str] = SSE_HEADERS.copy()

Expand Down
Loading