Skip to content
Draft
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
12 changes: 12 additions & 0 deletions fixtures/stubs-for-mypy/cssselect/__init__.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
from cssselect.parser import (
Attrib as Attrib,
Class as Class,
CombinedSelector as CombinedSelector,
Element as Element,
Hash as Hash,
Selector as Selector,
)

class SelectorSyntaxError(Exception): ...

def parse(css: str) -> list[Selector]: ...
29 changes: 29 additions & 0 deletions fixtures/stubs-for-mypy/cssselect/parser.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
from __future__ import annotations

from typing import TypeAlias

SelectorNode: TypeAlias = Attrib | Class | Element | Hash

class Selector:
pseudo_element: str | None
parsed_tree: SelectorNode | CombinedSelector

class Attrib:
operator: str | None
attrib: str
value: str
selector: SelectorNode

class Class:
class_name: str
selector: SelectorNode

class Element:
element: str

class Hash:
id: str
selector: SelectorNode

class CombinedSelector:
pass
1 change: 0 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,6 @@ module = [
"boto3.*",
"botocore.client.*",
"botocore.exceptions.*",
"cssselect.*",
"django_zero_downtime_migrations.backends.postgres.schema.*",
"emmett55.*",
"emmett_prometheus.*",
Expand Down
2 changes: 1 addition & 1 deletion src/sentry/replays/lib/selector/parse.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from cssselect.parser import Attrib, Class, CombinedSelector, Element, Hash
from rest_framework.exceptions import ParseError

SelectorType = Union[Attrib, Class, Element, Hash]
SelectorType = Union[Attrib, Class, Element, Hash, CombinedSelector]


class QueryType:
Expand Down
Loading