Browse Source

Update soupsieve_py3 2.0.0.final (e66c311) → 2.0.2.dev (05086ef).

Update soupsieve_py2 backport.
tags/release_0.25.1
JackDandy 5 years ago
parent
commit
da341515ab
  1. 2
      CHANGES.md
  2. 16
      lib/soupsieve_py2/css_match.py
  3. 2
      lib/soupsieve_py2/css_parser.py
  4. 12
      lib/soupsieve_py2/util.py
  5. 2
      lib/soupsieve_py3/__meta__.py
  6. 16
      lib/soupsieve_py3/css_match.py
  7. 2
      lib/soupsieve_py3/css_parser.py
  8. 15
      lib/soupsieve_py3/util.py

2
CHANGES.md

@ -8,6 +8,8 @@
* Update feedparser_py2 backport * Update feedparser_py2 backport
* Update Js2Py 0.70 (f297498) to 0.70 (92250a4) * Update Js2Py 0.70 (f297498) to 0.70 (92250a4)
* Update profilehooks module 1.11.2 (d72cc2b) to 1.12.0 (3ee1f60) * Update profilehooks module 1.11.2 (d72cc2b) to 1.12.0 (3ee1f60)
* Update soupsieve_py3 2.0.0.final (e66c311) to 2.0.2.dev (05086ef)
* Update soupsieve_py2 backport
[develop changelog] [develop changelog]

16
lib/soupsieve_py2/css_match.py

@ -6,6 +6,8 @@ import re
from .import css_types as ct from .import css_types as ct
import unicodedata import unicodedata
import bs4
# Empty tag pattern (whitespace okay) # Empty tag pattern (whitespace okay)
RE_NOT_EMPTY = re.compile('[^ \t\r\n\f]') RE_NOT_EMPTY = re.compile('[^ \t\r\n\f]')
@ -88,50 +90,36 @@ class _DocumentNav(object):
@staticmethod @staticmethod
def is_doc(obj): def is_doc(obj):
"""Is `BeautifulSoup` object.""" """Is `BeautifulSoup` object."""
import bs4
return isinstance(obj, bs4.BeautifulSoup) return isinstance(obj, bs4.BeautifulSoup)
@staticmethod @staticmethod
def is_tag(obj): def is_tag(obj):
"""Is tag.""" """Is tag."""
import bs4
return isinstance(obj, bs4.Tag) return isinstance(obj, bs4.Tag)
@staticmethod @staticmethod
def is_declaration(obj): # pragma: no cover def is_declaration(obj): # pragma: no cover
"""Is declaration.""" """Is declaration."""
import bs4
return isinstance(obj, bs4.Declaration) return isinstance(obj, bs4.Declaration)
@staticmethod @staticmethod
def is_cdata(obj): def is_cdata(obj):
"""Is CDATA.""" """Is CDATA."""
import bs4
return isinstance(obj, bs4.CData) return isinstance(obj, bs4.CData)
@staticmethod @staticmethod
def is_processing_instruction(obj): # pragma: no cover def is_processing_instruction(obj): # pragma: no cover
"""Is processing instruction.""" """Is processing instruction."""
import bs4
return isinstance(obj, bs4.ProcessingInstruction) return isinstance(obj, bs4.ProcessingInstruction)
@staticmethod @staticmethod
def is_navigable_string(obj): def is_navigable_string(obj):
"""Is navigable string.""" """Is navigable string."""
import bs4
return isinstance(obj, bs4.NavigableString) return isinstance(obj, bs4.NavigableString)
@staticmethod @staticmethod
def is_special_string(obj): def is_special_string(obj):
"""Is special string.""" """Is special string."""
import bs4
return isinstance(obj, (bs4.Comment, bs4.Declaration, bs4.CData, bs4.ProcessingInstruction, bs4.Doctype)) return isinstance(obj, (bs4.Comment, bs4.Declaration, bs4.CData, bs4.ProcessingInstruction, bs4.Doctype))
@classmethod @classmethod

2
lib/soupsieve_py2/css_parser.py

@ -901,7 +901,7 @@ class CSSParser(object):
elif key == 'pseudo_class': elif key == 'pseudo_class':
has_selector, is_html = self.parse_pseudo_class(sel, m, has_selector, iselector, is_html) has_selector, is_html = self.parse_pseudo_class(sel, m, has_selector, iselector, is_html)
elif key == 'pseudo_element': elif key == 'pseudo_element':
raise NotImplementedError("Psuedo-element found at position {}".format(m.start(0))) raise NotImplementedError("Pseudo-element found at position {}".format(m.start(0)))
elif key == 'pseudo_contains': elif key == 'pseudo_contains':
has_selector = self.parse_pseudo_contains(sel, m, has_selector) has_selector = self.parse_pseudo_contains(sel, m, has_selector)
elif key in ('pseudo_nth_type', 'pseudo_nth_child'): elif key in ('pseudo_nth_type', 'pseudo_nth_child'):

12
lib/soupsieve_py2/util.py

@ -33,8 +33,6 @@ DEBUG = 0x00001
RE_PATTERN_LINE_SPLIT = re.compile(r'(?:\r\n|(?!\r\n)[\n\r])|$') RE_PATTERN_LINE_SPLIT = re.compile(r'(?:\r\n|(?!\r\n)[\n\r])|$')
LC_A = ord('a')
LC_Z = ord('z')
UC_A = ord('A') UC_A = ord('A')
UC_Z = ord('Z') UC_Z = ord('Z')
@ -49,16 +47,6 @@ def lower(string):
return ''.join(new_string) return ''.join(new_string)
def upper(string): # pragma: no cover
"""Lower."""
new_string = []
for c in string:
o = ord(c)
new_string.append(chr(o - 32) if LC_A <= o <= LC_Z else c)
return ''.join(new_string)
def uchr(i): def uchr(i):
"""Allow getting Unicode character on narrow python builds.""" """Allow getting Unicode character on narrow python builds."""

2
lib/soupsieve_py3/__meta__.py

@ -185,5 +185,5 @@ def parse_version(ver, pre=False):
return Version(major, minor, micro, release, pre, post, dev) return Version(major, minor, micro, release, pre, post, dev)
__version_info__ = Version(2, 0, 0, "final") __version_info__ = Version(2, 0, 2, ".dev")
__version__ = __version_info__._get_canonical() __version__ = __version_info__._get_canonical()

16
lib/soupsieve_py3/css_match.py

@ -5,6 +5,8 @@ import re
from .import css_types as ct from .import css_types as ct
import unicodedata import unicodedata
import bs4
# Empty tag pattern (whitespace okay) # Empty tag pattern (whitespace okay)
RE_NOT_EMPTY = re.compile('[^ \t\r\n\f]') RE_NOT_EMPTY = re.compile('[^ \t\r\n\f]')
@ -87,50 +89,36 @@ class _DocumentNav(object):
@staticmethod @staticmethod
def is_doc(obj): def is_doc(obj):
"""Is `BeautifulSoup` object.""" """Is `BeautifulSoup` object."""
import bs4
return isinstance(obj, bs4.BeautifulSoup) return isinstance(obj, bs4.BeautifulSoup)
@staticmethod @staticmethod
def is_tag(obj): def is_tag(obj):
"""Is tag.""" """Is tag."""
import bs4
return isinstance(obj, bs4.Tag) return isinstance(obj, bs4.Tag)
@staticmethod @staticmethod
def is_declaration(obj): # pragma: no cover def is_declaration(obj): # pragma: no cover
"""Is declaration.""" """Is declaration."""
import bs4
return isinstance(obj, bs4.Declaration) return isinstance(obj, bs4.Declaration)
@staticmethod @staticmethod
def is_cdata(obj): def is_cdata(obj):
"""Is CDATA.""" """Is CDATA."""
import bs4
return isinstance(obj, bs4.CData) return isinstance(obj, bs4.CData)
@staticmethod @staticmethod
def is_processing_instruction(obj): # pragma: no cover def is_processing_instruction(obj): # pragma: no cover
"""Is processing instruction.""" """Is processing instruction."""
import bs4
return isinstance(obj, bs4.ProcessingInstruction) return isinstance(obj, bs4.ProcessingInstruction)
@staticmethod @staticmethod
def is_navigable_string(obj): def is_navigable_string(obj):
"""Is navigable string.""" """Is navigable string."""
import bs4
return isinstance(obj, bs4.NavigableString) return isinstance(obj, bs4.NavigableString)
@staticmethod @staticmethod
def is_special_string(obj): def is_special_string(obj):
"""Is special string.""" """Is special string."""
import bs4
return isinstance(obj, (bs4.Comment, bs4.Declaration, bs4.CData, bs4.ProcessingInstruction, bs4.Doctype)) return isinstance(obj, (bs4.Comment, bs4.Declaration, bs4.CData, bs4.ProcessingInstruction, bs4.Doctype))
@classmethod @classmethod

2
lib/soupsieve_py3/css_parser.py

@ -901,7 +901,7 @@ class CSSParser(object):
elif key == 'pseudo_class': elif key == 'pseudo_class':
has_selector, is_html = self.parse_pseudo_class(sel, m, has_selector, iselector, is_html) has_selector, is_html = self.parse_pseudo_class(sel, m, has_selector, iselector, is_html)
elif key == 'pseudo_element': elif key == 'pseudo_element':
raise NotImplementedError("Psuedo-element found at position {}".format(m.start(0))) raise NotImplementedError("Pseudo-element found at position {}".format(m.start(0)))
elif key == 'pseudo_contains': elif key == 'pseudo_contains':
has_selector = self.parse_pseudo_contains(sel, m, has_selector) has_selector = self.parse_pseudo_contains(sel, m, has_selector)
elif key in ('pseudo_nth_type', 'pseudo_nth_child'): elif key in ('pseudo_nth_type', 'pseudo_nth_child'):

15
lib/soupsieve_py3/util.py

@ -1,5 +1,5 @@
"""Utility.""" """Utility."""
from functools import wraps from functools import wraps, lru_cache
import warnings import warnings
import re import re
@ -7,12 +7,11 @@ DEBUG = 0x00001
RE_PATTERN_LINE_SPLIT = re.compile(r'(?:\r\n|(?!\r\n)[\n\r])|$') RE_PATTERN_LINE_SPLIT = re.compile(r'(?:\r\n|(?!\r\n)[\n\r])|$')
LC_A = ord('a')
LC_Z = ord('z')
UC_A = ord('A') UC_A = ord('A')
UC_Z = ord('Z') UC_Z = ord('Z')
@lru_cache(maxsize=512)
def lower(string): def lower(string):
"""Lower.""" """Lower."""
@ -23,16 +22,6 @@ def lower(string):
return ''.join(new_string) return ''.join(new_string)
def upper(string): # pragma: no cover
"""Lower."""
new_string = []
for c in string:
o = ord(c)
new_string.append(chr(o - 32) if LC_A <= o <= LC_Z else c)
return ''.join(new_string)
class SelectorSyntaxError(Exception): class SelectorSyntaxError(Exception):
"""Syntax error in a CSS selector.""" """Syntax error in a CSS selector."""

Loading…
Cancel
Save