Add stubs for libsass (#10638)

This commit is contained in:
David Salvisberg
2023-09-01 13:53:05 +02:00
committed by GitHub
parent 75da5de5c2
commit 9552ec7f72
7 changed files with 255 additions and 0 deletions

View File

View File

@@ -0,0 +1,34 @@
from collections.abc import Mapping
from re import Pattern
from typing import Any
from sass import _OutputStyle
SUFFIXES: frozenset[str]
SUFFIX_PATTERN: Pattern[str]
def build_directory(
sass_path: str,
css_path: str,
output_style: _OutputStyle = "nested",
_root_sass: None = None, # internal arguments for recursion
_root_css: None = None, # internal arguments for recursion
strip_extension: bool = False,
) -> dict[str, str]: ...
class Manifest:
@classmethod
def normalize_manifests(
cls, manifests: Mapping[str, Manifest | tuple[Any, ...] | Mapping[str, Any] | str] | None
) -> dict[str, Manifest]: ...
sass_path: str
css_path: str
wsgi_path: str
strip_extension: bool
def __init__(
self, sass_path: str, css_path: str | None = None, wsgi_path: str | None = None, strip_extension: bool | None = None
) -> None: ...
def resolve_filename(self, package_dir: str, filename: str) -> tuple[str, str]: ...
def unresolve_filename(self, package_dir: str, filename: str) -> str: ...
def build(self, package_dir: str, output_style: _OutputStyle = "nested") -> frozenset[str]: ...
def build_one(self, package_dir: str, filename: str, source_map: bool = False) -> str: ...

View File

@@ -0,0 +1,14 @@
from sassutils.builder import Manifest as Manifest
from setuptools import Command, Distribution
def validate_manifests(dist: Distribution, attr: str, value: object) -> None: ...
class build_sass(Command):
description: str
user_options: list[tuple[str, str, str]]
package_dir: dict[str, str] | None
output_style: str
def initialize_options(self) -> None: ...
def finalize_options(self) -> None: ...
def run(self) -> None: ...
def get_package_dir(self, package: str) -> str: ...

View File

@@ -0,0 +1,22 @@
from _typeshed.wsgi import StartResponse, WSGIApplication, WSGIEnvironment
from collections.abc import Iterable, Mapping
from typing import Any
from sassutils.builder import Manifest
class SassMiddleware:
app: WSGIApplication
manifests: dict[str, Manifest]
error_status: str
package_dir: Mapping[str, str]
paths: list[tuple[str, str, Manifest]]
def __init__(
self,
app: WSGIApplication,
manifests: Mapping[str, Manifest | tuple[Any, ...] | Mapping[str, Any] | str] | None,
package_dir: Mapping[str, str] = {},
error_status: str = "200 OK",
) -> None: ...
def __call__(self, environ: WSGIEnvironment, start_response: StartResponse) -> Iterable[bytes]: ...
@staticmethod
def quote_css_string(s: str) -> str: ...