Skip to content

Type stubs (mypy) support? #1160

Answered by mdmintz
feslima asked this question in Q&A
Jan 6, 2022 · 1 comments · 2 replies
Discussion options

You must be logged in to vote

Hello @feslima! Thank you, and welcome to SeleniumBase discussions!
SeleniumBase has its own system of type verification, such as demonstrated in the below code snippet, which processes all inputs of selectors for SeleniumBase methods:

...
_type = type(selector)  # First make sure the selector is a string
not_string = False
if not python3:
    if _type is not str and _type is not unicode:  # noqa: F821
        not_string = True
else:
    if _type is not str:
        not_string = True
if not_string:
    msg = "Expecting a selector of type: \"<class 'str'>\" (string)!"
    raise Exception('Invalid selector type: "%s"\n%s' % (_type, msg))
...

With all these in place, it's not necessary to ad…

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@feslima
Comment options

@mdmintz
Comment options

Answer selected by mdmintz
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants