From ffd6d1865a4c53481562e8e6684b2acf3784282f Mon Sep 17 00:00:00 2001 From: facelessuser Date: Mon, 25 Oct 2021 17:44:02 -0600 Subject: [PATCH] Add static typing --- .pyspelling.yml | 2 +- MANIFEST.in | 2 +- .../markdown/_snippets/selector_styles.txt | 1 + docs/src/markdown/about/changelog.md | 13 +- docs/src/markdown/selectors/pseudo-classes.md | 32 +- mkdocs.yml | 14 +- requirements/docs.txt | 3 +- requirements/tests.txt | 1 + setup.py | 4 +- soupsieve/__init__.py | 87 ++++- soupsieve/__meta__.py | 22 +- soupsieve/css_match.py | 355 ++++++++++-------- soupsieve/css_parser.py | 190 ++++++---- soupsieve/css_types.py | 217 +++++++---- soupsieve/pretty.py | 3 +- soupsieve/py.typed | 0 soupsieve/util.py | 20 +- tests/test_api.py | 6 + tests/test_bs4_cases.py | 2 +- tests/test_quirks.py | 19 + tox.ini | 1 + 21 files changed, 627 insertions(+), 367 deletions(-) create mode 100644 soupsieve/py.typed create mode 100644 tests/test_quirks.py diff --git a/.pyspelling.yml b/.pyspelling.yml index 2a96e85c..753efd44 100644 --- a/.pyspelling.yml +++ b/.pyspelling.yml @@ -71,7 +71,7 @@ matrix: context_visible_first: true delimiters: # Ignore lint (noqa) and coverage (pragma) as well as shebang (#!) - - open: '^(?: *(?:noqa\b|pragma: no cover)|!)' + - open: '^(?: *(?:noqa\b|pragma: no cover|type: .*?)|!)' close: '$' # Ignore Python encoding string -*- encoding stuff -*- - open: '^ *-\*-' diff --git a/MANIFEST.in b/MANIFEST.in index 4a78648d..7c4a664b 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,4 +1,4 @@ -recursive-include soupsieve *.py +recursive-include soupsieve *.py py.typed recursive-include tests *.py recursive-include docs/src/markdown *.md *.png *.gif *.html recursive-include docs/src/dictionary *.txt diff --git a/docs/src/markdown/_snippets/selector_styles.txt b/docs/src/markdown/_snippets/selector_styles.txt index 3ffcf13d..2e4a0b3c 100644 --- a/docs/src/markdown/_snippets/selector_styles.txt +++ b/docs/src/markdown/_snippets/selector_styles.txt @@ -1,6 +1,7 @@