Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support apple cpu and upgrade driver #83

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
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
2,030 changes: 1,066 additions & 964 deletions helium/__init__.py

Large diffs are not rendered by default.

2,570 changes: 1,387 additions & 1,183 deletions helium/_impl/__init__.py

Large diffs are not rendered by default.

66 changes: 35 additions & 31 deletions helium/_impl/match_type.py
Original file line number Diff line number Diff line change
@@ -1,36 +1,40 @@
from helium._impl.util.xpath import lower, replace_nbsp


class MatchType:
def xpath(self, value, text):
raise NotImplementedError()
def text(self, value, text):
raise NotImplementedError()
def xpath(self, value, text):
raise NotImplementedError()

def text(self, value, text):
raise NotImplementedError()


class PREFIX_IGNORE_CASE(MatchType):
def xpath(self, value, text):
if not text:
return ''
# Asterisks '*' are sometimes used to mark required fields. Eg.:
# <label for="title"><span class="red-txt">*</span> Title:</label>
# The starts-with filter below would be too strict to include such
# matches. To get around this, we ignore asterisks unless the searched
# text itself contains one.
if '*' in text:
strip_asterisks = value
else:
strip_asterisks = "translate(%s, '*', '')" % value

# if text contains apostrophes (single quotes) then they need to be
# treated with care
if "'" in text:
text = "concat('%s')" % ("',\"'\",'".join(text.split("'")))
else:
text = "'%s'" % text

return "starts-with(normalize-space(%s), %s)" % (
lower(replace_nbsp(strip_asterisks)), text.lower()
)
def text(self, value, text):
if not text:
return True
return value.lower().lstrip().startswith(text.lower())
def xpath(self, value, text):
if not text:
return ''
# Asterisks '*' are sometimes used to mark required fields. Eg.:
# <label for="title"><span class="red-txt">*</span> Title:</label>
# The starts-with filter below would be too strict to include such
# matches. To get around this, we ignore asterisks unless the searched
# text itself contains one.
if '*' in text:
strip_asterisks = value
else:
strip_asterisks = "translate(%s, '*', '')" % value

# if text contains apostrophes (single quotes) then they need to be
# treated with care
if "'" in text:
text = "concat('%s')" % ("',\"'\",'".join(text.split("'")))
else:
text = "'%s'" % text

return "starts-with(normalize-space(%s), %s)" % (
lower(replace_nbsp(strip_asterisks)), text.lower()
)

def text(self, value, text):
if not text:
return True
return value.lower().lstrip().startswith(text.lower())
Loading