Skip to content

Commit

Permalink
chore: update dependencies (#3669)
Browse files Browse the repository at this point in the history
  • Loading branch information
provinzkraut authored Aug 18, 2024
1 parent 912a5fa commit 238d26b
Show file tree
Hide file tree
Showing 21 changed files with 1,326 additions and 1,178 deletions.
8 changes: 4 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ default_language_version:
python: "3.8"
repos:
- repo: https://github.com/compilerla/conventional-pre-commit
rev: v3.2.0
rev: v3.4.0
hooks:
- id: conventional-pre-commit
stages: [commit-msg]
Expand All @@ -19,18 +19,18 @@ repos:
- id: trailing-whitespace
exclude: "tests/unit/test_openapi/test_typescript_converter/test_converter.py"
- repo: https://github.com/provinzkraut/unasyncd
rev: "v0.7.1"
rev: "v0.7.3"
hooks:
- id: unasyncd
additional_dependencies: ["ruff"]
- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: "v0.4.4"
rev: "v0.6.1"
hooks:
- id: ruff
args: ["--fix"]
- id: ruff-format
- repo: https://github.com/codespell-project/codespell
rev: v2.2.6
rev: v2.3.0
hooks:
- id: codespell
exclude: "tests/openapi/typescript_converter/test_converter|README.md"
Expand Down
2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@
re.compile(r"litestar\.template\.(config|TemplateConfig).*"): re.compile(".*EngineType"),
"litestar.concurrency.set_asyncio_executor": {"ThreadPoolExecutor"},
"litestar.concurrency.get_asyncio_executor": {"ThreadPoolExecutor"},
re.compile(r"litestar\.channels\.backends\.asyncpg.*"): {"asyncpg.Connection"},
re.compile(r"litestar\.channels\.backends\.asyncpg.*"): {"asyncpg.connection.Connection", "asyncpg.Connection"},
}

# Do not warn about broken links to the following:
Expand Down
2 changes: 1 addition & 1 deletion docs/usage/responses.rst
Original file line number Diff line number Diff line change
Expand Up @@ -497,7 +497,7 @@ in:
Set-Cookie: router-cookie=router value; Path=/; SameSite=lax
Set-Cookie: app-cookie=app value; Path=/; SameSite=lax
You can easily override cookies declared in higher levels by re-declaring a cookie with the same key in a lower level,
You can easily override cookies declared in higher levels by redeclaring a cookie with the same key in a lower level,
e.g.:

.. literalinclude:: /examples/responses/response_cookies_2.py
Expand Down
2 changes: 1 addition & 1 deletion docs/usage/routing/parameters.rst
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ declared in the route handler. Now, examine these more closely.
* ``controller_param`` is a query param with the key ``controller_param``. It has an :paramref:`~.params.Parameter.lt`
set to ``100`` defined on the controller, which means the provided value must be less than 100.

Yet the route handler re-declares it with an :paramref:`~.params.Parameter.lt` set to ``50``,
Yet the route handler redeclares it with an :paramref:`~.params.Parameter.lt` set to ``50``,
which means for the route handler this value must be less than 50.
* ``local_param`` is a route handler local :ref:`query parameter <usage/routing/parameters:query parameters>`, and
``path_param`` is a :ref:`path parameter <usage/routing/parameters:path parameters>`.
Expand Down
4 changes: 2 additions & 2 deletions litestar/_openapi/schema_generation/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -526,7 +526,7 @@ def for_constrained_field(self, field: FieldDefinition) -> Schema:
kwarg_definition = cast(Union[ParameterKwarg, BodyKwarg], field.kwarg_definition)
if any(is_class_and_subclass(field.annotation, t) for t in (int, float, Decimal)):
return create_numerical_constrained_field_schema(field.annotation, kwarg_definition)
if any(is_class_and_subclass(field.annotation, t) for t in (str, bytes)): # type: ignore[arg-type]
if any(is_class_and_subclass(field.annotation, t) for t in (str, bytes)):
return create_string_constrained_field_schema(field.annotation, kwarg_definition)
if any(is_class_and_subclass(field.annotation, t) for t in (date, datetime)):
return create_date_constrained_field_schema(field.annotation, kwarg_definition)
Expand All @@ -547,7 +547,7 @@ def for_collection_constrained_field(self, field_definition: FieldDefinition) ->
schema.min_items = kwarg_definition.min_items
if kwarg_definition.max_items:
schema.max_items = kwarg_definition.max_items
if any(is_class_and_subclass(field_definition.annotation, t) for t in (set, frozenset)): # type: ignore[arg-type]
if any(is_class_and_subclass(field_definition.annotation, t) for t in (set, frozenset)):
schema.unique_items = True

item_creator = self.not_generating_examples
Expand Down
2 changes: 1 addition & 1 deletion litestar/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -821,7 +821,7 @@ def url_for_static_asset(self, name: str, file_path: str) -> str:
if not isinstance(handler_fn, StaticFiles):
raise NoRouteMatchFoundException(f"Handler with name {name} is not a static files handler")

return join_paths([handler_index["paths"][0], file_path]) # type: ignore[unreachable]
return join_paths([handler_index["paths"][0], file_path])

@property
def route_handler_method_view(self) -> dict[str, list[str]]:
Expand Down
4 changes: 2 additions & 2 deletions litestar/channels/backends/redis.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,8 +143,8 @@ async def stream_events(self) -> AsyncGenerator[tuple[str, Any], None]:

channel: str = message["channel"].decode()
data: bytes = message["data"]
# redis handles the unsubscibes with a queue; Unsubscribing doesn't mean the
# unsubscribe will happen immediately after requesting it, so we could
# redis handles the unsubscribing with a queue; Unsubscribing doesn't mean
# the unsubscribe will happen immediately after requesting it, so we could
# receive a message on a channel that, from a client's perspective, it's not
# subscribed to anymore
if channel.encode() in self._pub_sub.channels.keys() - self._pub_sub.pending_unsubscribe_channels:
Expand Down
4 changes: 2 additions & 2 deletions litestar/cli/commands/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,8 @@ def _run_uvicorn_in_subprocess(
process_args["ssl-certfile"] = certfile_path
if keyfile_path is not None:
process_args["ssl-keyfile"] = keyfile_path
subprocess.run(
[sys.executable, "-m", "uvicorn", env.app_path, *_convert_uvicorn_args(process_args)], # noqa: S603
subprocess.run( # noqa: S603
[sys.executable, "-m", "uvicorn", env.app_path, *_convert_uvicorn_args(process_args)],
check=True,
)

Expand Down
4 changes: 2 additions & 2 deletions litestar/contrib/opentelemetry/middleware.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ def __init__(self, app: ASGIApp, config: OpenTelemetryConfig) -> None:
super().__init__(app=app, scopes=config.scopes, exclude=config.exclude, exclude_opt_key=config.exclude_opt_key)
self.open_telemetry_middleware = OpenTelemetryMiddleware(
app=app,
client_request_hook=config.client_request_hook_handler,
client_response_hook=config.client_response_hook_handler,
client_request_hook=config.client_request_hook_handler, # type: ignore[arg-type]
client_response_hook=config.client_response_hook_handler, # type: ignore[arg-type]
default_span_details=config.scope_span_details_extractor,
excluded_urls=get_excluded_urls(config.exclude_urls_env_key),
meter=config.meter,
Expand Down
6 changes: 5 additions & 1 deletion litestar/openapi/spec/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,11 @@ def _normalize_value(value: Any) -> Any:
if isinstance(value, BaseSchemaObject):
return value.to_schema()
if is_dataclass(value):
return {_normalize_value(k): _normalize_value(v) for k, v in asdict(value).items() if v is not None}
return {
_normalize_value(k): _normalize_value(v)
for k, v in asdict(value).items() # type: ignore[call-overload]
if v is not None
}
if isinstance(value, dict):
return {_normalize_value(k): _normalize_value(v) for k, v in value.items() if v is not None}
if isinstance(value, list):
Expand Down
2 changes: 1 addition & 1 deletion litestar/plugins/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

class MsgspecDIPlugin(DIPlugin):
def has_typed_init(self, type_: Any) -> bool:
return type(type_) is type(msgspec.Struct) # noqa: E721
return type(type_) is type(msgspec.Struct)

def get_typed_init(self, type_: Any) -> tuple[Signature, dict[str, Any]]:
parameters = []
Expand Down
2 changes: 1 addition & 1 deletion litestar/utils/sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def __init__(self, fn: Callable[P, T]) -> None: # pyright: ignore
self.func = fn

def __call__(self, *args: P.args, **kwargs: P.kwargs) -> Awaitable[T]: # pyright: ignore
return sync_to_thread(self.func, *args, **kwargs) # pyright: ignore
return sync_to_thread(self.func, *args, **kwargs) # type: ignore[arg-type]


class AsyncIteratorWrapper(Generic[T]):
Expand Down
Loading

0 comments on commit 238d26b

Please sign in to comment.