Skip to content

Commit 889e7ba

Browse files
committed
Add type hints to the init. module of the package
The module in question was missing type hinting entirely, which only contributed to the issue the parent commit fixes. This adds type hinting, which also helps validate the initialization behaviour.
1 parent 06175cf commit 889e7ba

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/csspring/__init__.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
"""Parsing of CSS text aligned with [CSS] specification(s)."""
22

3-
def _enable_selector_parsing():
3+
def _enable_selector_parsing() -> None:
44
"""Augment parsing procedures to enable parsing of CSS selectors.
55
66
This adds on-demand parsing of the prelude part of every qualified rule (see the `prelude` attribute on `QualifiedRule`), when the `selector_list` property is accessed on the latter. Because parsing is only done when the property added with this procedure, is accessed, `csspring.syntax` remains compliant with its respective specification.
77
"""
8-
from .syntax.parsing import normalize_input, QualifiedRule, tokens
8+
from .syntax.parsing import normalize_input, Product, QualifiedRule, tokens
99
from .selectors import parse_selector_list
10-
def qualified_rule_selector_list(self):
10+
def qualified_rule_selector_list(self: QualifiedRule) -> Product | None:
1111
return parse_selector_list(normalize_input(tokens(self.prelude)))
1212
setattr(QualifiedRule, "selector_list", property(qualified_rule_selector_list))
1313

0 commit comments

Comments
 (0)