Search is not available for this dataset
identifier
stringlengths
1
155
parameters
stringlengths
2
6.09k
docstring
stringlengths
11
63.4k
docstring_summary
stringlengths
0
63.4k
function
stringlengths
29
99.8k
function_tokens
list
start_point
list
end_point
list
language
stringclasses
1 value
docstring_language
stringlengths
2
7
docstring_language_predictions
stringlengths
18
23
is_langid_reliable
stringclasses
2 values
BaseCase.add_text
(self, selector, text, by=By.CSS_SELECTOR, timeout=None)
The more-reliable version of driver.send_keys() Similar to update_text(), but won't clear the text field first.
The more-reliable version of driver.send_keys() Similar to update_text(), but won't clear the text field first.
def add_text(self, selector, text, by=By.CSS_SELECTOR, timeout=None): """ The more-reliable version of driver.send_keys() Similar to update_text(), but won't clear the text field first. """ if not timeout: timeout = settings.LARGE_TIMEOUT if self.timeout_multiplier and ti...
[ "def", "add_text", "(", "self", ",", "selector", ",", "text", ",", "by", "=", "By", ".", "CSS_SELECTOR", ",", "timeout", "=", "None", ")", ":", "if", "not", "timeout", ":", "timeout", "=", "settings", ".", "LARGE_TIMEOUT", "if", "self", ".", "timeout_m...
[ 330, 4 ]
[ 373, 46 ]
python
en
['en', 'en', 'en']
True
BaseCase.type
(self, selector, text, by=By.CSS_SELECTOR, timeout=None, retry=False)
Same as self.update_text() This method updates an element's text field with new text. Has multiple parts: * Waits for the element to be visible. * Waits for the element to be interactive. * Clears the text field. * Types in the new text. ...
Same as self.update_text() This method updates an element's text field with new text. Has multiple parts: * Waits for the element to be visible. * Waits for the element to be interactive. * Clears the text field. * Types in the new text. ...
def type(self, selector, text, by=By.CSS_SELECTOR, timeout=None, retry=False): """ Same as self.update_text() This method updates an element's text field with new text. Has multiple parts: * Waits for the element to be visible. * Waits for the element...
[ "def", "type", "(", "self", ",", "selector", ",", "text", ",", "by", "=", "By", ".", "CSS_SELECTOR", ",", "timeout", "=", "None", ",", "retry", "=", "False", ")", ":", "if", "not", "timeout", ":", "timeout", "=", "settings", ".", "LARGE_TIMEOUT", "if...
[ 375, 4 ]
[ 398, 77 ]
python
en
['en', 'en', 'en']
True
BaseCase.submit
(self, selector, by=By.CSS_SELECTOR)
Alternative to self.driver.find_element_by_*(SELECTOR).submit()
Alternative to self.driver.find_element_by_*(SELECTOR).submit()
def submit(self, selector, by=By.CSS_SELECTOR): """ Alternative to self.driver.find_element_by_*(SELECTOR).submit() """ selector, by = self.__recalculate_selector(selector, by) element = self.wait_for_element_visible( selector, by=by, timeout=settings.SMALL_TIMEOUT) element.s...
[ "def", "submit", "(", "self", ",", "selector", ",", "by", "=", "By", ".", "CSS_SELECTOR", ")", ":", "selector", ",", "by", "=", "self", ".", "__recalculate_selector", "(", "selector", ",", "by", ")", "element", "=", "self", ".", "wait_for_element_visible",...
[ 400, 4 ]
[ 406, 42 ]
python
en
['en', 'en', 'en']
True
BaseCase.refresh
(self)
The shorter version of self.refresh_page()
The shorter version of self.refresh_page()
def refresh(self): """ The shorter version of self.refresh_page() """ self.refresh_page()
[ "def", "refresh", "(", "self", ")", ":", "self", ".", "refresh_page", "(", ")" ]
[ 413, 4 ]
[ 415, 27 ]
python
en
['en', 'en', 'en']
True
BaseCase.get_title
(self)
The shorter version of self.get_page_title()
The shorter version of self.get_page_title()
def get_title(self): """ The shorter version of self.get_page_title() """ return self.get_page_title()
[ "def", "get_title", "(", "self", ")", ":", "return", "self", ".", "get_page_title", "(", ")" ]
[ 437, 4 ]
[ 439, 36 ]
python
en
['en', 'en', 'en']
True
BaseCase.is_link_text_present
(self, link_text)
Returns True if the link text appears in the HTML of the page. The element doesn't need to be visible, such as elements hidden inside a dropdown selection.
Returns True if the link text appears in the HTML of the page. The element doesn't need to be visible, such as elements hidden inside a dropdown selection.
def is_link_text_present(self, link_text): """ Returns True if the link text appears in the HTML of the page. The element doesn't need to be visible, such as elements hidden inside a dropdown selection. """ soup = self.get_beautiful_soup() html_links = soup.find_all('a') ...
[ "def", "is_link_text_present", "(", "self", ",", "link_text", ")", ":", "soup", "=", "self", ".", "get_beautiful_soup", "(", ")", "html_links", "=", "soup", ".", "find_all", "(", "'a'", ")", "for", "html_link", "in", "html_links", ":", "if", "html_link", "...
[ 487, 4 ]
[ 496, 20 ]
python
en
['en', 'en', 'en']
True
BaseCase.is_partial_link_text_present
(self, link_text)
Returns True if the partial link appears in the HTML of the page. The element doesn't need to be visible, such as elements hidden inside a dropdown selection.
Returns True if the partial link appears in the HTML of the page. The element doesn't need to be visible, such as elements hidden inside a dropdown selection.
def is_partial_link_text_present(self, link_text): """ Returns True if the partial link appears in the HTML of the page. The element doesn't need to be visible, such as elements hidden inside a dropdown selection. """ soup = self.get_beautiful_soup() html_links = soup.fin...
[ "def", "is_partial_link_text_present", "(", "self", ",", "link_text", ")", ":", "soup", "=", "self", ".", "get_beautiful_soup", "(", ")", "html_links", "=", "soup", ".", "find_all", "(", "'a'", ")", "for", "html_link", "in", "html_links", ":", "if", "link_te...
[ 498, 4 ]
[ 507, 20 ]
python
en
['en', 'en', 'en']
True
BaseCase.get_link_attribute
(self, link_text, attribute, hard_fail=True)
Finds a link by link text and then returns the attribute's value. If the link text or attribute cannot be found, an exception will get raised if hard_fail is True (otherwise None is returned).
Finds a link by link text and then returns the attribute's value. If the link text or attribute cannot be found, an exception will get raised if hard_fail is True (otherwise None is returned).
def get_link_attribute(self, link_text, attribute, hard_fail=True): """ Finds a link by link text and then returns the attribute's value. If the link text or attribute cannot be found, an exception will get raised if hard_fail is True (otherwise None is returned). """ soup = self...
[ "def", "get_link_attribute", "(", "self", ",", "link_text", ",", "attribute", ",", "hard_fail", "=", "True", ")", ":", "soup", "=", "self", ".", "get_beautiful_soup", "(", ")", "html_links", "=", "soup", ".", "find_all", "(", "'a'", ")", "for", "html_link"...
[ 509, 4 ]
[ 529, 23 ]
python
en
['en', 'en', 'en']
True
BaseCase.get_link_text_attribute
(self, link_text, attribute, hard_fail=True)
Same as self.get_link_attribute() Finds a link by link text and then returns the attribute's value. If the link text or attribute cannot be found, an exception will get raised if hard_fail is True (otherwise None is returned).
Same as self.get_link_attribute() Finds a link by link text and then returns the attribute's value. If the link text or attribute cannot be found, an exception will get raised if hard_fail is True (otherwise None is returned).
def get_link_text_attribute(self, link_text, attribute, hard_fail=True): """ Same as self.get_link_attribute() Finds a link by link text and then returns the attribute's value. If the link text or attribute cannot be found, an exception will get raised if hard_fail is True (o...
[ "def", "get_link_text_attribute", "(", "self", ",", "link_text", ",", "attribute", ",", "hard_fail", "=", "True", ")", ":", "return", "self", ".", "get_link_attribute", "(", "link_text", ",", "attribute", ",", "hard_fail", ")" ]
[ 531, 4 ]
[ 536, 71 ]
python
en
['en', 'af', 'en']
True
BaseCase.get_partial_link_text_attribute
(self, link_text, attribute, hard_fail=True)
Finds a link by partial link text and then returns the attribute's value. If the partial link text or attribute cannot be found, an exception will get raised if hard_fail is True (otherwise None is returned).
Finds a link by partial link text and then returns the attribute's value. If the partial link text or attribute cannot be found, an exception will get raised if hard_fail is True (otherwise None is returned).
def get_partial_link_text_attribute(self, link_text, attribute, hard_fail=True): """ Finds a link by partial link text and then returns the attribute's value. If the partial link text or attribute cannot be found, an exception will get raised if ha...
[ "def", "get_partial_link_text_attribute", "(", "self", ",", "link_text", ",", "attribute", ",", "hard_fail", "=", "True", ")", ":", "soup", "=", "self", ".", "get_beautiful_soup", "(", ")", "html_links", "=", "soup", ".", "find_all", "(", "'a'", ")", "for", ...
[ 538, 4 ]
[ 562, 23 ]
python
en
['en', 'en', 'en']
True
BaseCase.click_link_text
(self, link_text, timeout=None)
This method clicks link text on a page
This method clicks link text on a page
def click_link_text(self, link_text, timeout=None): """ This method clicks link text on a page """ # If using phantomjs, might need to extract and open the link directly if not timeout: timeout = settings.SMALL_TIMEOUT if self.timeout_multiplier and timeout == settings.SMALL_...
[ "def", "click_link_text", "(", "self", ",", "link_text", ",", "timeout", "=", "None", ")", ":", "# If using phantomjs, might need to extract and open the link directly", "if", "not", "timeout", ":", "timeout", "=", "settings", ".", "SMALL_TIMEOUT", "if", "self", ".", ...
[ 564, 4 ]
[ 646, 46 ]
python
en
['en', 'en', 'en']
True
BaseCase.click_partial_link_text
(self, partial_link_text, timeout=None)
This method clicks the partial link text on a page.
This method clicks the partial link text on a page.
def click_partial_link_text(self, partial_link_text, timeout=None): """ This method clicks the partial link text on a page. """ # If using phantomjs, might need to extract and open the link directly if not timeout: timeout = settings.SMALL_TIMEOUT if self.timeout_multiplier a...
[ "def", "click_partial_link_text", "(", "self", ",", "partial_link_text", ",", "timeout", "=", "None", ")", ":", "# If using phantomjs, might need to extract and open the link directly", "if", "not", "timeout", ":", "timeout", "=", "settings", ".", "SMALL_TIMEOUT", "if", ...
[ 648, 4 ]
[ 752, 46 ]
python
en
['en', 'en', 'en']
True
BaseCase.get_attribute
(self, selector, attribute, by=By.CSS_SELECTOR, timeout=None, hard_fail=True)
This method uses JavaScript to get the value of an attribute.
This method uses JavaScript to get the value of an attribute.
def get_attribute(self, selector, attribute, by=By.CSS_SELECTOR, timeout=None, hard_fail=True): """ This method uses JavaScript to get the value of an attribute. """ if not timeout: timeout = settings.SMALL_TIMEOUT if self.timeout_multiplier and timeout == setti...
[ "def", "get_attribute", "(", "self", ",", "selector", ",", "attribute", ",", "by", "=", "By", ".", "CSS_SELECTOR", ",", "timeout", "=", "None", ",", "hard_fail", "=", "True", ")", ":", "if", "not", "timeout", ":", "timeout", "=", "settings", ".", "SMAL...
[ 774, 4 ]
[ 801, 27 ]
python
en
['en', 'en', 'en']
True
BaseCase.set_attribute
(self, selector, attribute, value, by=By.CSS_SELECTOR, timeout=None)
This method uses JavaScript to set/update an attribute. Only the first matching selector from querySelector() is used.
This method uses JavaScript to set/update an attribute. Only the first matching selector from querySelector() is used.
def set_attribute(self, selector, attribute, value, by=By.CSS_SELECTOR, timeout=None): """ This method uses JavaScript to set/update an attribute. Only the first matching selector from querySelector() is used. """ if not timeout: timeout = settings.SMALL_TIM...
[ "def", "set_attribute", "(", "self", ",", "selector", ",", "attribute", ",", "value", ",", "by", "=", "By", ".", "CSS_SELECTOR", ",", "timeout", "=", "None", ")", ":", "if", "not", "timeout", ":", "timeout", "=", "settings", ".", "SMALL_TIMEOUT", "if", ...
[ 803, 4 ]
[ 826, 35 ]
python
en
['en', 'en', 'en']
True
BaseCase.set_attributes
(self, selector, attribute, value, by=By.CSS_SELECTOR)
This method uses JavaScript to set/update a common attribute. All matching selectors from querySelectorAll() are used. Example => (Make all links on a website redirect to Google): self.set_attributes("a", "href", "https://google.com")
This method uses JavaScript to set/update a common attribute. All matching selectors from querySelectorAll() are used. Example => (Make all links on a website redirect to Google): self.set_attributes("a", "href", "https://google.com")
def set_attributes(self, selector, attribute, value, by=By.CSS_SELECTOR): """ This method uses JavaScript to set/update a common attribute. All matching selectors from querySelectorAll() are used. Example => (Make all links on a website redirect to Google): self.set_attribute...
[ "def", "set_attributes", "(", "self", ",", "selector", ",", "attribute", ",", "value", ",", "by", "=", "By", ".", "CSS_SELECTOR", ")", ":", "selector", ",", "by", "=", "self", ".", "__recalculate_selector", "(", "selector", ",", "by", ")", "attribute", "...
[ 828, 4 ]
[ 849, 16 ]
python
en
['en', 'en', 'en']
True
BaseCase.set_attribute_all
(self, selector, attribute, value, by=By.CSS_SELECTOR)
Same as set_attributes(), but using querySelectorAll naming scheme. This method uses JavaScript to set/update a common attribute. All matching selectors from querySelectorAll() are used. Example => (Make all links on a website redirect to Google): self.set_attribute_all(...
Same as set_attributes(), but using querySelectorAll naming scheme. This method uses JavaScript to set/update a common attribute. All matching selectors from querySelectorAll() are used. Example => (Make all links on a website redirect to Google): self.set_attribute_all(...
def set_attribute_all(self, selector, attribute, value, by=By.CSS_SELECTOR): """ Same as set_attributes(), but using querySelectorAll naming scheme. This method uses JavaScript to set/update a common attribute. All matching selectors from querySelectorAll() are ...
[ "def", "set_attribute_all", "(", "self", ",", "selector", ",", "attribute", ",", "value", ",", "by", "=", "By", ".", "CSS_SELECTOR", ")", ":", "self", ".", "set_attributes", "(", "selector", ",", "attribute", ",", "value", ",", "by", "=", "by", ")" ]
[ 851, 4 ]
[ 858, 62 ]
python
en
['en', 'en', 'en']
True
BaseCase.remove_attribute
(self, selector, attribute, by=By.CSS_SELECTOR, timeout=None)
This method uses JavaScript to remove an attribute. Only the first matching selector from querySelector() is used.
This method uses JavaScript to remove an attribute. Only the first matching selector from querySelector() is used.
def remove_attribute(self, selector, attribute, by=By.CSS_SELECTOR, timeout=None): """ This method uses JavaScript to remove an attribute. Only the first matching selector from querySelector() is used. """ if not timeout: timeout = settings.SMALL_TIMEOUT ...
[ "def", "remove_attribute", "(", "self", ",", "selector", ",", "attribute", ",", "by", "=", "By", ".", "CSS_SELECTOR", ",", "timeout", "=", "None", ")", ":", "if", "not", "timeout", ":", "timeout", "=", "settings", ".", "SMALL_TIMEOUT", "if", "self", ".",...
[ 860, 4 ]
[ 881, 35 ]
python
en
['en', 'en', 'en']
True
BaseCase.remove_attributes
(self, selector, attribute, by=By.CSS_SELECTOR)
This method uses JavaScript to remove a common attribute. All matching selectors from querySelectorAll() are used.
This method uses JavaScript to remove a common attribute. All matching selectors from querySelectorAll() are used.
def remove_attributes(self, selector, attribute, by=By.CSS_SELECTOR): """ This method uses JavaScript to remove a common attribute. All matching selectors from querySelectorAll() are used. """ selector, by = self.__recalculate_selector(selector, by) attribute = re.escape(attribute) ...
[ "def", "remove_attributes", "(", "self", ",", "selector", ",", "attribute", ",", "by", "=", "By", ".", "CSS_SELECTOR", ")", ":", "selector", ",", "by", "=", "self", ".", "__recalculate_selector", "(", "selector", ",", "by", ")", "attribute", "=", "re", "...
[ 883, 4 ]
[ 900, 16 ]
python
en
['en', 'en', 'en']
True
BaseCase.get_property_value
(self, selector, property, by=By.CSS_SELECTOR, timeout=None)
Returns the property value of a page element's computed style. Example: opacity = self.get_property_value("html body a", "opacity") self.assertTrue(float(opacity) > 0, "Element not visible!")
Returns the property value of a page element's computed style. Example: opacity = self.get_property_value("html body a", "opacity") self.assertTrue(float(opacity) > 0, "Element not visible!")
def get_property_value(self, selector, property, by=By.CSS_SELECTOR, timeout=None): """ Returns the property value of a page element's computed style. Example: opacity = self.get_property_value("html body a", "opacity") self.assertTrue(float...
[ "def", "get_property_value", "(", "self", ",", "selector", ",", "property", ",", "by", "=", "By", ".", "CSS_SELECTOR", ",", "timeout", "=", "None", ")", ":", "if", "not", "timeout", ":", "timeout", "=", "settings", ".", "SMALL_TIMEOUT", "if", "self", "."...
[ 902, 4 ]
[ 933, 21 ]
python
en
['en', 'en', 'en']
True
BaseCase.get_image_url
(self, selector, by=By.CSS_SELECTOR, timeout=None)
Extracts the URL from an image element on the page.
Extracts the URL from an image element on the page.
def get_image_url(self, selector, by=By.CSS_SELECTOR, timeout=None): """ Extracts the URL from an image element on the page. """ if not timeout: timeout = settings.SMALL_TIMEOUT if self.timeout_multiplier and timeout == settings.SMALL_TIMEOUT: timeout = self.__get_new_tim...
[ "def", "get_image_url", "(", "self", ",", "selector", ",", "by", "=", "By", ".", "CSS_SELECTOR", ",", "timeout", "=", "None", ")", ":", "if", "not", "timeout", ":", "timeout", "=", "settings", ".", "SMALL_TIMEOUT", "if", "self", ".", "timeout_multiplier", ...
[ 935, 4 ]
[ 942, 74 ]
python
en
['en', 'en', 'en']
True
BaseCase.find_elements
(self, selector, by=By.CSS_SELECTOR, limit=0)
Returns a list of matching WebElements. Elements could be either hidden or visible on the page. If "limit" is set and > 0, will only return that many elements.
Returns a list of matching WebElements. Elements could be either hidden or visible on the page. If "limit" is set and > 0, will only return that many elements.
def find_elements(self, selector, by=By.CSS_SELECTOR, limit=0): """ Returns a list of matching WebElements. Elements could be either hidden or visible on the page. If "limit" is set and > 0, will only return that many elements. """ selector, by = self.__recalculate_selector(selec...
[ "def", "find_elements", "(", "self", ",", "selector", ",", "by", "=", "By", ".", "CSS_SELECTOR", ",", "limit", "=", "0", ")", ":", "selector", ",", "by", "=", "self", ".", "__recalculate_selector", "(", "selector", ",", "by", ")", "self", ".", "wait_fo...
[ 944, 4 ]
[ 954, 23 ]
python
en
['en', 'lb', 'en']
True
BaseCase.find_visible_elements
(self, selector, by=By.CSS_SELECTOR, limit=0)
Returns a list of matching WebElements that are visible. If "limit" is set and > 0, will only return that many elements.
Returns a list of matching WebElements that are visible. If "limit" is set and > 0, will only return that many elements.
def find_visible_elements(self, selector, by=By.CSS_SELECTOR, limit=0): """ Returns a list of matching WebElements that are visible. If "limit" is set and > 0, will only return that many elements. """ selector, by = self.__recalculate_selector(selector, by) self.wait_for_ready_state_...
[ "def", "find_visible_elements", "(", "self", ",", "selector", ",", "by", "=", "By", ".", "CSS_SELECTOR", ",", "limit", "=", "0", ")", ":", "selector", ",", "by", "=", "self", ".", "__recalculate_selector", "(", "selector", ",", "by", ")", "self", ".", ...
[ 956, 4 ]
[ 965, 22 ]
python
en
['en', 'en', 'en']
True
BaseCase.click_visible_elements
(self, selector, by=By.CSS_SELECTOR, limit=0)
Finds all matching page elements and clicks visible ones in order. If a click reloads or opens a new page, the clicking will stop. If no matching elements appear, an Exception will be raised. If "limit" is set and > 0, will only click that many elements. Also clicks elem...
Finds all matching page elements and clicks visible ones in order. If a click reloads or opens a new page, the clicking will stop. If no matching elements appear, an Exception will be raised. If "limit" is set and > 0, will only click that many elements. Also clicks elem...
def click_visible_elements(self, selector, by=By.CSS_SELECTOR, limit=0): """ Finds all matching page elements and clicks visible ones in order. If a click reloads or opens a new page, the clicking will stop. If no matching elements appear, an Exception will be raised. If "lim...
[ "def", "click_visible_elements", "(", "self", ",", "selector", ",", "by", "=", "By", ".", "CSS_SELECTOR", ",", "limit", "=", "0", ")", ":", "selector", ",", "by", "=", "self", ".", "__recalculate_selector", "(", "selector", ",", "by", ")", "self", ".", ...
[ 967, 4 ]
[ 1024, 26 ]
python
en
['en', 'en', 'en']
True
BaseCase.click_nth_visible_element
(self, selector, number, by=By.CSS_SELECTOR)
Finds all matching page elements and clicks the nth visible one. Example: self.click_nth_visible_element('[type="checkbox"]', 5) (Clicks the 5th visible checkbox on the page.)
Finds all matching page elements and clicks the nth visible one. Example: self.click_nth_visible_element('[type="checkbox"]', 5) (Clicks the 5th visible checkbox on the page.)
def click_nth_visible_element(self, selector, number, by=By.CSS_SELECTOR): """ Finds all matching page elements and clicks the nth visible one. Example: self.click_nth_visible_element('[type="checkbox"]', 5) (Clicks the 5th visible checkbox on the page.) """ elements...
[ "def", "click_nth_visible_element", "(", "self", ",", "selector", ",", "number", ",", "by", "=", "By", ".", "CSS_SELECTOR", ")", ":", "elements", "=", "self", ".", "find_visible_elements", "(", "selector", ",", "by", "=", "by", ")", "if", "len", "(", "el...
[ 1026, 4 ]
[ 1046, 27 ]
python
en
['en', 'en', 'en']
True
BaseCase.click_if_visible
(self, selector, by=By.CSS_SELECTOR)
If the page selector exists and is visible, clicks on the element. This method only clicks on the first matching element found. (Use click_visible_elements() to click all matching elements.)
If the page selector exists and is visible, clicks on the element. This method only clicks on the first matching element found. (Use click_visible_elements() to click all matching elements.)
def click_if_visible(self, selector, by=By.CSS_SELECTOR): """ If the page selector exists and is visible, clicks on the element. This method only clicks on the first matching element found. (Use click_visible_elements() to click all matching elements.) """ self.wait_for_ready_sta...
[ "def", "click_if_visible", "(", "self", ",", "selector", ",", "by", "=", "By", ".", "CSS_SELECTOR", ")", ":", "self", ".", "wait_for_ready_state_complete", "(", ")", "if", "self", ".", "is_element_visible", "(", "selector", ",", "by", "=", "by", ")", ":", ...
[ 1048, 4 ]
[ 1054, 39 ]
python
en
['en', 'en', 'en']
True
BaseCase.is_checked
(self, selector, by=By.CSS_SELECTOR, timeout=None)
Determines if a checkbox or a radio button element is checked. Returns True if the element is checked. Returns False if the element is not checked. If the element is not present on the page, raises an exception. If the element is not a checkbox or radio, raises an except...
Determines if a checkbox or a radio button element is checked. Returns True if the element is checked. Returns False if the element is not checked. If the element is not present on the page, raises an exception. If the element is not a checkbox or radio, raises an except...
def is_checked(self, selector, by=By.CSS_SELECTOR, timeout=None): """ Determines if a checkbox or a radio button element is checked. Returns True if the element is checked. Returns False if the element is not checked. If the element is not present on the page, raises an excep...
[ "def", "is_checked", "(", "self", ",", "selector", ",", "by", "=", "By", ".", "CSS_SELECTOR", ",", "timeout", "=", "None", ")", ":", "if", "not", "timeout", ":", "timeout", "=", "settings", ".", "SMALL_TIMEOUT", "if", "self", ".", "timeout_multiplier", "...
[ 1056, 4 ]
[ 1075, 24 ]
python
en
['en', 'en', 'en']
True
BaseCase.is_selected
(self, selector, by=By.CSS_SELECTOR, timeout=None)
Same as is_checked()
Same as is_checked()
def is_selected(self, selector, by=By.CSS_SELECTOR, timeout=None): """ Same as is_checked() """ return self.is_checked(selector, by=by, timeout=timeout)
[ "def", "is_selected", "(", "self", ",", "selector", ",", "by", "=", "By", ".", "CSS_SELECTOR", ",", "timeout", "=", "None", ")", ":", "return", "self", ".", "is_checked", "(", "selector", ",", "by", "=", "by", ",", "timeout", "=", "timeout", ")" ]
[ 1077, 4 ]
[ 1079, 64 ]
python
en
['en', 'en', 'en']
True
BaseCase.check_if_unchecked
(self, selector, by=By.CSS_SELECTOR)
If a checkbox or radio button is not checked, will check it.
If a checkbox or radio button is not checked, will check it.
def check_if_unchecked(self, selector, by=By.CSS_SELECTOR): """ If a checkbox or radio button is not checked, will check it. """ selector, by = self.__recalculate_selector(selector, by) if not self.is_checked(selector, by=by): if self.is_element_visible(selector, by=by): ...
[ "def", "check_if_unchecked", "(", "self", ",", "selector", ",", "by", "=", "By", ".", "CSS_SELECTOR", ")", ":", "selector", ",", "by", "=", "self", ".", "__recalculate_selector", "(", "selector", ",", "by", ")", "if", "not", "self", ".", "is_checked", "(...
[ 1081, 4 ]
[ 1089, 59 ]
python
en
['en', 'en', 'en']
True
BaseCase.select_if_unselected
(self, selector, by=By.CSS_SELECTOR)
Same as check_if_unchecked()
Same as check_if_unchecked()
def select_if_unselected(self, selector, by=By.CSS_SELECTOR): """ Same as check_if_unchecked() """ self.check_if_unchecked(selector, by=by)
[ "def", "select_if_unselected", "(", "self", ",", "selector", ",", "by", "=", "By", ".", "CSS_SELECTOR", ")", ":", "self", ".", "check_if_unchecked", "(", "selector", ",", "by", "=", "by", ")" ]
[ 1091, 4 ]
[ 1093, 48 ]
python
en
['en', 'en', 'en']
True
BaseCase.uncheck_if_checked
(self, selector, by=By.CSS_SELECTOR)
If a checkbox is checked, will uncheck it.
If a checkbox is checked, will uncheck it.
def uncheck_if_checked(self, selector, by=By.CSS_SELECTOR): """ If a checkbox is checked, will uncheck it. """ selector, by = self.__recalculate_selector(selector, by) if self.is_checked(selector, by=by): if self.is_element_visible(selector, by=by): self.click(selecto...
[ "def", "uncheck_if_checked", "(", "self", ",", "selector", ",", "by", "=", "By", ".", "CSS_SELECTOR", ")", ":", "selector", ",", "by", "=", "self", ".", "__recalculate_selector", "(", "selector", ",", "by", ")", "if", "self", ".", "is_checked", "(", "sel...
[ 1095, 4 ]
[ 1103, 59 ]
python
en
['en', 'en', 'en']
True
BaseCase.unselect_if_selected
(self, selector, by=By.CSS_SELECTOR)
Same as uncheck_if_checked()
Same as uncheck_if_checked()
def unselect_if_selected(self, selector, by=By.CSS_SELECTOR): """ Same as uncheck_if_checked() """ self.uncheck_if_checked(selector, by=by)
[ "def", "unselect_if_selected", "(", "self", ",", "selector", ",", "by", "=", "By", ".", "CSS_SELECTOR", ")", ":", "self", ".", "uncheck_if_checked", "(", "selector", ",", "by", "=", "by", ")" ]
[ 1105, 4 ]
[ 1107, 48 ]
python
en
['en', 'en', 'en']
True
BaseCase.is_element_in_an_iframe
(self, selector, by=By.CSS_SELECTOR)
Returns True if the selector's element is located in an iframe. Otherwise returns False.
Returns True if the selector's element is located in an iframe. Otherwise returns False.
def is_element_in_an_iframe(self, selector, by=By.CSS_SELECTOR): """ Returns True if the selector's element is located in an iframe. Otherwise returns False. """ selector, by = self.__recalculate_selector(selector, by) if self.is_element_present(selector, by=by): return F...
[ "def", "is_element_in_an_iframe", "(", "self", ",", "selector", ",", "by", "=", "By", ".", "CSS_SELECTOR", ")", ":", "selector", ",", "by", "=", "self", ".", "__recalculate_selector", "(", "selector", ",", "by", ")", "if", "self", ".", "is_element_present", ...
[ 1109, 4 ]
[ 1133, 20 ]
python
en
['en', 'en', 'en']
True
BaseCase.switch_to_frame_of_element
(self, selector, by=By.CSS_SELECTOR)
Set driver control to the iframe containing element (assuming the element is in a single-nested iframe) and returns the iframe name. If element is not in an iframe, returns None, and nothing happens. May not work if multiple iframes are nested within each other.
Set driver control to the iframe containing element (assuming the element is in a single-nested iframe) and returns the iframe name. If element is not in an iframe, returns None, and nothing happens. May not work if multiple iframes are nested within each other.
def switch_to_frame_of_element(self, selector, by=By.CSS_SELECTOR): """ Set driver control to the iframe containing element (assuming the element is in a single-nested iframe) and returns the iframe name. If element is not in an iframe, returns None, and nothing happens. May ...
[ "def", "switch_to_frame_of_element", "(", "self", ",", "selector", ",", "by", "=", "By", ".", "CSS_SELECTOR", ")", ":", "selector", ",", "by", "=", "self", ".", "__recalculate_selector", "(", "selector", ",", "by", ")", "if", "self", ".", "is_element_present...
[ 1135, 4 ]
[ 1170, 55 ]
python
en
['en', 'en', 'en']
True
BaseCase.hover_and_click
(self, hover_selector, click_selector, hover_by=By.CSS_SELECTOR, click_by=By.CSS_SELECTOR, timeout=None)
When you want to hover over an element or dropdown menu, and then click an element that appears after that.
When you want to hover over an element or dropdown menu, and then click an element that appears after that.
def hover_and_click(self, hover_selector, click_selector, hover_by=By.CSS_SELECTOR, click_by=By.CSS_SELECTOR, timeout=None): """ When you want to hover over an element or dropdown menu, and then click an element that appears after that. """ if ...
[ "def", "hover_and_click", "(", "self", ",", "hover_selector", ",", "click_selector", ",", "hover_by", "=", "By", ".", "CSS_SELECTOR", ",", "click_by", "=", "By", ".", "CSS_SELECTOR", ",", "timeout", "=", "None", ")", ":", "if", "not", "timeout", ":", "time...
[ 1184, 4 ]
[ 1242, 22 ]
python
en
['en', 'en', 'en']
True
BaseCase.hover_and_double_click
(self, hover_selector, click_selector, hover_by=By.CSS_SELECTOR, click_by=By.CSS_SELECTOR, timeout=None)
When you want to hover over an element or dropdown menu, and then double-click an element that appears after that.
When you want to hover over an element or dropdown menu, and then double-click an element that appears after that.
def hover_and_double_click(self, hover_selector, click_selector, hover_by=By.CSS_SELECTOR, click_by=By.CSS_SELECTOR, timeout=None): """ When you want to hover over an element or dropdown menu, and then doubl...
[ "def", "hover_and_double_click", "(", "self", ",", "hover_selector", ",", "click_selector", ",", "hover_by", "=", "By", ".", "CSS_SELECTOR", ",", "click_by", "=", "By", ".", "CSS_SELECTOR", ",", "timeout", "=", "None", ")", ":", "if", "not", "timeout", ":", ...
[ 1244, 4 ]
[ 1291, 22 ]
python
en
['en', 'en', 'en']
True
BaseCase.__select_option
(self, dropdown_selector, option, dropdown_by=By.CSS_SELECTOR, option_by="text", timeout=None)
Selects an HTML <select> option by specification. Option specifications are by "text", "index", or "value". Defaults to "text" if option_by is unspecified or unknown.
Selects an HTML <select> option by specification. Option specifications are by "text", "index", or "value". Defaults to "text" if option_by is unspecified or unknown.
def __select_option(self, dropdown_selector, option, dropdown_by=By.CSS_SELECTOR, option_by="text", timeout=None): """ Selects an HTML <select> option by specification. Option specifications are by "text", "index", or "value". Defaults to "...
[ "def", "__select_option", "(", "self", ",", "dropdown_selector", ",", "option", ",", "dropdown_by", "=", "By", ".", "CSS_SELECTOR", ",", "option_by", "=", "\"text\"", ",", "timeout", "=", "None", ")", ":", "from", "selenium", ".", "webdriver", ".", "support"...
[ 1293, 4 ]
[ 1339, 46 ]
python
en
['en', 'en', 'en']
True
BaseCase.select_option_by_text
(self, dropdown_selector, option, dropdown_by=By.CSS_SELECTOR, timeout=None)
Selects an HTML <select> option by option text. @Params dropdown_selector - the <select> selector option - the text of the option
Selects an HTML <select> option by option text.
def select_option_by_text(self, dropdown_selector, option, dropdown_by=By.CSS_SELECTOR, timeout=None): """ Selects an HTML <select> option by option text. @Params dropdown_selector - the <select> selector option - th...
[ "def", "select_option_by_text", "(", "self", ",", "dropdown_selector", ",", "option", ",", "dropdown_by", "=", "By", ".", "CSS_SELECTOR", ",", "timeout", "=", "None", ")", ":", "if", "not", "timeout", ":", "timeout", "=", "settings", ".", "SMALL_TIMEOUT", "i...
[ 1341, 4 ]
[ 1354, 45 ]
python
en
['en', 'en', 'en']
True
BaseCase.select_option_by_index
(self, dropdown_selector, option, dropdown_by=By.CSS_SELECTOR, timeout=None)
Selects an HTML <select> option by option index. @Params dropdown_selector - the <select> selector option - the index number of the option
Selects an HTML <select> option by option index.
def select_option_by_index(self, dropdown_selector, option, dropdown_by=By.CSS_SELECTOR, timeout=None): """ Selects an HTML <select> option by option index. @Params dropdown_selector - the <select> selector option ...
[ "def", "select_option_by_index", "(", "self", ",", "dropdown_selector", ",", "option", ",", "dropdown_by", "=", "By", ".", "CSS_SELECTOR", ",", "timeout", "=", "None", ")", ":", "if", "not", "timeout", ":", "timeout", "=", "settings", ".", "SMALL_TIMEOUT", "...
[ 1356, 4 ]
[ 1369, 45 ]
python
en
['en', 'en', 'en']
True
BaseCase.select_option_by_value
(self, dropdown_selector, option, dropdown_by=By.CSS_SELECTOR, timeout=None)
Selects an HTML <select> option by option value. @Params dropdown_selector - the <select> selector option - the value property of the option
Selects an HTML <select> option by option value.
def select_option_by_value(self, dropdown_selector, option, dropdown_by=By.CSS_SELECTOR, timeout=None): """ Selects an HTML <select> option by option value. @Params dropdown_selector - the <select> selector option ...
[ "def", "select_option_by_value", "(", "self", ",", "dropdown_selector", ",", "option", ",", "dropdown_by", "=", "By", ".", "CSS_SELECTOR", ",", "timeout", "=", "None", ")", ":", "if", "not", "timeout", ":", "timeout", "=", "settings", ".", "SMALL_TIMEOUT", "...
[ 1371, 4 ]
[ 1384, 45 ]
python
en
['en', 'en', 'en']
True
BaseCase.load_html_string
(self, html_string, new_page=True)
Loads an HTML string into the web browser. If new_page==True, the page will switch to: "data:text/html," If new_page==False, will load HTML into the current page.
Loads an HTML string into the web browser. If new_page==True, the page will switch to: "data:text/html," If new_page==False, will load HTML into the current page.
def load_html_string(self, html_string, new_page=True): """ Loads an HTML string into the web browser. If new_page==True, the page will switch to: "data:text/html," If new_page==False, will load HTML into the current page. """ soup = self.get_beautiful_soup(html_string) ...
[ "def", "load_html_string", "(", "self", ",", "html_string", ",", "new_page", "=", "True", ")", ":", "soup", "=", "self", ".", "get_beautiful_soup", "(", "html_string", ")", "found_base", "=", "False", "links", "=", "soup", ".", "findAll", "(", "\"link\"", ...
[ 1386, 4 ]
[ 1480, 20 ]
python
en
['en', 'en', 'en']
True
BaseCase.load_html_file
(self, html_file, new_page=True)
Loads a local html file into the browser from a relative file path. If new_page==True, the page will switch to: "data:text/html," If new_page==False, will load HTML into the current page. Local images and other local src content WILL BE IGNORED.
Loads a local html file into the browser from a relative file path. If new_page==True, the page will switch to: "data:text/html," If new_page==False, will load HTML into the current page. Local images and other local src content WILL BE IGNORED.
def load_html_file(self, html_file, new_page=True): """ Loads a local html file into the browser from a relative file path. If new_page==True, the page will switch to: "data:text/html," If new_page==False, will load HTML into the current page. Local images and other local src...
[ "def", "load_html_file", "(", "self", ",", "html_file", ",", "new_page", "=", "True", ")", ":", "if", "self", ".", "__looks_like_a_page_url", "(", "html_file", ")", ":", "self", ".", "open", "(", "html_file", ")", "return", "if", "len", "(", "html_file", ...
[ 1482, 4 ]
[ 1501, 52 ]
python
en
['en', 'en', 'en']
True
BaseCase.open_html_file
(self, html_file)
Opens a local html file into the browser from a relative file path. The URL displayed in the web browser will start with "file://".
Opens a local html file into the browser from a relative file path. The URL displayed in the web browser will start with "file://".
def open_html_file(self, html_file): """ Opens a local html file into the browser from a relative file path. The URL displayed in the web browser will start with "file://". """ if self.__looks_like_a_page_url(html_file): self.open(html_file) return if len(html...
[ "def", "open_html_file", "(", "self", ",", "html_file", ")", ":", "if", "self", ".", "__looks_like_a_page_url", "(", "html_file", ")", ":", "self", ".", "open", "(", "html_file", ")", "return", "if", "len", "(", "html_file", ")", "<", "6", "or", "not", ...
[ 1503, 4 ]
[ 1517, 40 ]
python
en
['en', 'en', 'en']
True
BaseCase.safe_execute_script
(self, script)
When executing a script that contains a jQuery command, it's important that the jQuery library has been loaded first. This method will load jQuery if it wasn't already loaded.
When executing a script that contains a jQuery command, it's important that the jQuery library has been loaded first. This method will load jQuery if it wasn't already loaded.
def safe_execute_script(self, script): """ When executing a script that contains a jQuery command, it's important that the jQuery library has been loaded first. This method will load jQuery if it wasn't already loaded. """ try: self.execute_script(script) exce...
[ "def", "safe_execute_script", "(", "self", ",", "script", ")", ":", "try", ":", "self", ".", "execute_script", "(", "script", ")", "except", "Exception", ":", "# The likely reason this fails is because: \"jQuery is not defined\"", "self", ".", "activate_jquery", "(", ...
[ 1527, 4 ]
[ 1536, 39 ]
python
en
['en', 'en', 'en']
True
BaseCase.switch_to_frame
(self, frame, timeout=None)
Wait for an iframe to appear, and switch to it. This should be usable as a drop-in replacement for driver.switch_to.frame(). @Params frame - the frame element, name, id, index, or selector timeout - the time to wait for the alert in seconds
Wait for an iframe to appear, and switch to it. This should be usable as a drop-in replacement for driver.switch_to.frame().
def switch_to_frame(self, frame, timeout=None): """ Wait for an iframe to appear, and switch to it. This should be usable as a drop-in replacement for driver.switch_to.frame(). @Params frame - the frame element, name, id, index, or selector timeout - the time to wait for ...
[ "def", "switch_to_frame", "(", "self", ",", "frame", ",", "timeout", "=", "None", ")", ":", "if", "not", "timeout", ":", "timeout", "=", "settings", ".", "SMALL_TIMEOUT", "if", "self", ".", "timeout_multiplier", "and", "timeout", "==", "settings", ".", "SM...
[ 1550, 4 ]
[ 1562, 65 ]
python
en
['en', 'error', 'th']
False
BaseCase.switch_to_default_content
(self)
Brings driver control outside the current iframe. (If driver control is inside an iframe, the driver control will be set to one level above the current frame. If the driver control is not currenly in an iframe, nothing will happen.)
Brings driver control outside the current iframe. (If driver control is inside an iframe, the driver control will be set to one level above the current frame. If the driver control is not currenly in an iframe, nothing will happen.)
def switch_to_default_content(self): """ Brings driver control outside the current iframe. (If driver control is inside an iframe, the driver control will be set to one level above the current frame. If the driver control is not currenly in an iframe, nothing will happen.) ""...
[ "def", "switch_to_default_content", "(", "self", ")", ":", "self", ".", "driver", ".", "switch_to", ".", "default_content", "(", ")" ]
[ 1564, 4 ]
[ 1569, 47 ]
python
en
['en', 'en', 'en']
True
BaseCase.open_new_window
(self, switch_to=True)
Opens a new browser tab/window and switches to it by default.
Opens a new browser tab/window and switches to it by default.
def open_new_window(self, switch_to=True): """ Opens a new browser tab/window and switches to it by default. """ self.driver.execute_script("window.open('');") time.sleep(0.01) if switch_to: self.switch_to_window(len(self.driver.window_handles) - 1)
[ "def", "open_new_window", "(", "self", ",", "switch_to", "=", "True", ")", ":", "self", ".", "driver", ".", "execute_script", "(", "\"window.open('');\"", ")", "time", ".", "sleep", "(", "0.01", ")", "if", "switch_to", ":", "self", ".", "switch_to_window", ...
[ 1571, 4 ]
[ 1576, 70 ]
python
en
['en', 'en', 'en']
True
BaseCase.get_new_driver
(self, browser=None, headless=None, servername=None, port=None, proxy=None, agent=None, switch_to=True, cap_file=None, cap_string=None, disable_csp=None, enable_sync=None, use_auto_ext=None, no_sandbox=None, disable_gpu=None, ...
This method spins up an extra browser for tests that require more than one. The first browser is already provided by tests that import base_case.BaseCase from seleniumbase. If parameters aren't specified, the method uses the same as the default driver. @Params ...
This method spins up an extra browser for tests that require more than one. The first browser is already provided by tests that import base_case.BaseCase from seleniumbase. If parameters aren't specified, the method uses the same as the default driver.
def get_new_driver(self, browser=None, headless=None, servername=None, port=None, proxy=None, agent=None, switch_to=True, cap_file=None, cap_string=None, disable_csp=None, enable_sync=None, use_auto_ext=None, no_sandbox=None, di...
[ "def", "get_new_driver", "(", "self", ",", "browser", "=", "None", ",", "headless", "=", "None", ",", "servername", "=", "None", ",", "port", "=", "None", ",", "proxy", "=", "None", ",", "agent", "=", "None", ",", "switch_to", "=", "True", ",", "cap_...
[ 1588, 4 ]
[ 1783, 25 ]
python
en
['en', 'en', 'en']
True
BaseCase.switch_to_driver
(self, driver)
Sets self.driver to the specified driver. You may need this if using self.get_new_driver() in your code.
Sets self.driver to the specified driver. You may need this if using self.get_new_driver() in your code.
def switch_to_driver(self, driver): """ Sets self.driver to the specified driver. You may need this if using self.get_new_driver() in your code. """ self.driver = driver
[ "def", "switch_to_driver", "(", "self", ",", "driver", ")", ":", "self", ".", "driver", "=", "driver" ]
[ 1785, 4 ]
[ 1788, 28 ]
python
en
['en', 'en', 'en']
True
BaseCase.switch_to_default_driver
(self)
Sets self.driver to the default/original driver.
Sets self.driver to the default/original driver.
def switch_to_default_driver(self): """ Sets self.driver to the default/original driver. """ self.driver = self._default_driver
[ "def", "switch_to_default_driver", "(", "self", ")", ":", "self", ".", "driver", "=", "self", ".", "_default_driver" ]
[ 1790, 4 ]
[ 1792, 42 ]
python
en
['en', 'pt', 'en']
True
BaseCase.save_screenshot
(self, name, folder=None)
The screenshot will be in PNG format.
The screenshot will be in PNG format.
def save_screenshot(self, name, folder=None): """ The screenshot will be in PNG format. """ return page_actions.save_screenshot(self.driver, name, folder)
[ "def", "save_screenshot", "(", "self", ",", "name", ",", "folder", "=", "None", ")", ":", "return", "page_actions", ".", "save_screenshot", "(", "self", ".", "driver", ",", "name", ",", "folder", ")" ]
[ 1794, 4 ]
[ 1796, 70 ]
python
en
['en', 'en', 'en']
True
BaseCase.save_page_source
(self, name, folder=None)
Saves the page HTML to the current directory (or given subfolder). If the folder specified doesn't exist, it will get created. @Params name - The file name to save the current page's HTML to. folder - The folder to save the file to. (Default = current folder)
Saves the page HTML to the current directory (or given subfolder). If the folder specified doesn't exist, it will get created.
def save_page_source(self, name, folder=None): """ Saves the page HTML to the current directory (or given subfolder). If the folder specified doesn't exist, it will get created. @Params name - The file name to save the current page's HTML to. folder - The folder t...
[ "def", "save_page_source", "(", "self", ",", "name", ",", "folder", "=", "None", ")", ":", "return", "page_actions", ".", "save_page_source", "(", "self", ".", "driver", ",", "name", ",", "folder", ")" ]
[ 1798, 4 ]
[ 1805, 71 ]
python
en
['en', 'en', 'en']
True
BaseCase.save_cookies
(self, name="cookies.txt")
Saves the page cookies to the "saved_cookies" folder.
Saves the page cookies to the "saved_cookies" folder.
def save_cookies(self, name="cookies.txt"): """ Saves the page cookies to the "saved_cookies" folder. """ cookies = self.driver.get_cookies() json_cookies = json.dumps(cookies) if name.endswith('/'): raise Exception("Invalid filename for Cookies!") if '/' in name: ...
[ "def", "save_cookies", "(", "self", ",", "name", "=", "\"cookies.txt\"", ")", ":", "cookies", "=", "self", ".", "driver", ".", "get_cookies", "(", ")", "json_cookies", "=", "json", ".", "dumps", "(", "cookies", ")", "if", "name", ".", "endswith", "(", ...
[ 1807, 4 ]
[ 1827, 28 ]
python
en
['en', 'en', 'en']
True
BaseCase.load_cookies
(self, name="cookies.txt")
Loads the page cookies from the "saved_cookies" folder.
Loads the page cookies from the "saved_cookies" folder.
def load_cookies(self, name="cookies.txt"): """ Loads the page cookies from the "saved_cookies" folder. """ if name.endswith('/'): raise Exception("Invalid filename for Cookies!") if '/' in name: name = name.split('/')[-1] if len(name) < 1: raise Excep...
[ "def", "load_cookies", "(", "self", ",", "name", "=", "\"cookies.txt\"", ")", ":", "if", "name", ".", "endswith", "(", "'/'", ")", ":", "raise", "Exception", "(", "\"Invalid filename for Cookies!\"", ")", "if", "'/'", "in", "name", ":", "name", "=", "name"...
[ 1829, 4 ]
[ 1850, 42 ]
python
en
['en', 'en', 'en']
True
BaseCase.delete_all_cookies
(self)
Deletes all cookies in the web browser. Does NOT delete the saved cookies file.
Deletes all cookies in the web browser. Does NOT delete the saved cookies file.
def delete_all_cookies(self): """ Deletes all cookies in the web browser. Does NOT delete the saved cookies file. """ self.driver.delete_all_cookies()
[ "def", "delete_all_cookies", "(", "self", ")", ":", "self", ".", "driver", ".", "delete_all_cookies", "(", ")" ]
[ 1852, 4 ]
[ 1855, 40 ]
python
en
['en', 'en', 'en']
True
BaseCase.delete_saved_cookies
(self, name="cookies.txt")
Deletes the cookies file from the "saved_cookies" folder. Does NOT delete the cookies from the web browser.
Deletes the cookies file from the "saved_cookies" folder. Does NOT delete the cookies from the web browser.
def delete_saved_cookies(self, name="cookies.txt"): """ Deletes the cookies file from the "saved_cookies" folder. Does NOT delete the cookies from the web browser. """ if name.endswith('/'): raise Exception("Invalid filename for Cookies!") if '/' in name: name...
[ "def", "delete_saved_cookies", "(", "self", ",", "name", "=", "\"cookies.txt\"", ")", ":", "if", "name", ".", "endswith", "(", "'/'", ")", ":", "raise", "Exception", "(", "\"Invalid filename for Cookies!\"", ")", "if", "'/'", "in", "name", ":", "name", "=", ...
[ 1857, 4 ]
[ 1874, 44 ]
python
en
['en', 'en', 'en']
True
BaseCase.activate_jquery
(self)
If "jQuery is not defined", use this method to activate it for use. This happens because jQuery is not always defined on web sites.
If "jQuery is not defined", use this method to activate it for use. This happens because jQuery is not always defined on web sites.
def activate_jquery(self): """ If "jQuery is not defined", use this method to activate it for use. This happens because jQuery is not always defined on web sites. """ js_utils.activate_jquery(self.driver) self.wait_for_ready_state_complete()
[ "def", "activate_jquery", "(", "self", ")", ":", "js_utils", ".", "activate_jquery", "(", "self", ".", "driver", ")", "self", ".", "wait_for_ready_state_complete", "(", ")" ]
[ 1929, 4 ]
[ 1933, 44 ]
python
en
['en', 'en', 'en']
True
BaseCase.bring_to_front
(self, selector, by=By.CSS_SELECTOR)
Updates the Z-index of a page element to bring it into view. Useful when getting a WebDriverException, such as the one below: { Element is not clickable at point (#, #). Other element would receive the click: ... }
Updates the Z-index of a page element to bring it into view. Useful when getting a WebDriverException, such as the one below: { Element is not clickable at point (#, #). Other element would receive the click: ... }
def bring_to_front(self, selector, by=By.CSS_SELECTOR): """ Updates the Z-index of a page element to bring it into view. Useful when getting a WebDriverException, such as the one below: { Element is not clickable at point (#, #). Other element would receive the clic...
[ "def", "bring_to_front", "(", "self", ",", "selector", ",", "by", "=", "By", ".", "CSS_SELECTOR", ")", ":", "selector", ",", "by", "=", "self", ".", "__recalculate_selector", "(", "selector", ",", "by", ")", "self", ".", "wait_for_element_visible", "(", "s...
[ 1941, 4 ]
[ 1958, 35 ]
python
en
['en', 'en', 'en']
True
BaseCase.highlight
(self, selector, by=By.CSS_SELECTOR, loops=None, scroll=True)
This method uses fancy JavaScript to highlight an element. Used during demo_mode. @Params selector - the selector of the element to find by - the type of selector to search by (Default: CSS) loops - # of times to repeat the highlight animation ...
This method uses fancy JavaScript to highlight an element. Used during demo_mode.
def highlight(self, selector, by=By.CSS_SELECTOR, loops=None, scroll=True): """ This method uses fancy JavaScript to highlight an element. Used during demo_mode. @Params selector - the selector of the element to find by - the type of selector to ...
[ "def", "highlight", "(", "self", ",", "selector", ",", "by", "=", "By", ".", "CSS_SELECTOR", ",", "loops", "=", "None", ",", "scroll", "=", "True", ")", ":", "selector", ",", "by", "=", "self", ".", "__recalculate_selector", "(", "selector", ",", "by",...
[ 1972, 4 ]
[ 2037, 25 ]
python
en
['en', 'en', 'en']
True
BaseCase.press_up_arrow
(self, selector="html", times=1, by=By.CSS_SELECTOR)
Simulates pressing the UP Arrow on the keyboard. By default, "html" will be used as the CSS Selector target. You can specify how many times in-a-row the action happens.
Simulates pressing the UP Arrow on the keyboard. By default, "html" will be used as the CSS Selector target. You can specify how many times in-a-row the action happens.
def press_up_arrow(self, selector="html", times=1, by=By.CSS_SELECTOR): """ Simulates pressing the UP Arrow on the keyboard. By default, "html" will be used as the CSS Selector target. You can specify how many times in-a-row the action happens. """ if times < 1: retur...
[ "def", "press_up_arrow", "(", "self", ",", "selector", "=", "\"html\"", ",", "times", "=", "1", ",", "by", "=", "By", ".", "CSS_SELECTOR", ")", ":", "if", "times", "<", "1", ":", "return", "element", "=", "self", ".", "wait_for_element_present", "(", "...
[ 2045, 4 ]
[ 2064, 31 ]
python
en
['en', 'en', 'en']
True
BaseCase.press_down_arrow
(self, selector="html", times=1, by=By.CSS_SELECTOR)
Simulates pressing the DOWN Arrow on the keyboard. By default, "html" will be used as the CSS Selector target. You can specify how many times in-a-row the action happens.
Simulates pressing the DOWN Arrow on the keyboard. By default, "html" will be used as the CSS Selector target. You can specify how many times in-a-row the action happens.
def press_down_arrow(self, selector="html", times=1, by=By.CSS_SELECTOR): """ Simulates pressing the DOWN Arrow on the keyboard. By default, "html" will be used as the CSS Selector target. You can specify how many times in-a-row the action happens. """ if times < 1: r...
[ "def", "press_down_arrow", "(", "self", ",", "selector", "=", "\"html\"", ",", "times", "=", "1", ",", "by", "=", "By", ".", "CSS_SELECTOR", ")", ":", "if", "times", "<", "1", ":", "return", "element", "=", "self", ".", "wait_for_element_present", "(", ...
[ 2066, 4 ]
[ 2085, 31 ]
python
en
['en', 'en', 'en']
True
BaseCase.press_left_arrow
(self, selector="html", times=1, by=By.CSS_SELECTOR)
Simulates pressing the LEFT Arrow on the keyboard. By default, "html" will be used as the CSS Selector target. You can specify how many times in-a-row the action happens.
Simulates pressing the LEFT Arrow on the keyboard. By default, "html" will be used as the CSS Selector target. You can specify how many times in-a-row the action happens.
def press_left_arrow(self, selector="html", times=1, by=By.CSS_SELECTOR): """ Simulates pressing the LEFT Arrow on the keyboard. By default, "html" will be used as the CSS Selector target. You can specify how many times in-a-row the action happens. """ if times < 1: r...
[ "def", "press_left_arrow", "(", "self", ",", "selector", "=", "\"html\"", ",", "times", "=", "1", ",", "by", "=", "By", ".", "CSS_SELECTOR", ")", ":", "if", "times", "<", "1", ":", "return", "element", "=", "self", ".", "wait_for_element_present", "(", ...
[ 2087, 4 ]
[ 2106, 31 ]
python
en
['en', 'en', 'en']
True
BaseCase.press_right_arrow
(self, selector="html", times=1, by=By.CSS_SELECTOR)
Simulates pressing the RIGHT Arrow on the keyboard. By default, "html" will be used as the CSS Selector target. You can specify how many times in-a-row the action happens.
Simulates pressing the RIGHT Arrow on the keyboard. By default, "html" will be used as the CSS Selector target. You can specify how many times in-a-row the action happens.
def press_right_arrow(self, selector="html", times=1, by=By.CSS_SELECTOR): """ Simulates pressing the RIGHT Arrow on the keyboard. By default, "html" will be used as the CSS Selector target. You can specify how many times in-a-row the action happens. """ if times < 1: ...
[ "def", "press_right_arrow", "(", "self", ",", "selector", "=", "\"html\"", ",", "times", "=", "1", ",", "by", "=", "By", ".", "CSS_SELECTOR", ")", ":", "if", "times", "<", "1", ":", "return", "element", "=", "self", ".", "wait_for_element_present", "(", ...
[ 2108, 4 ]
[ 2127, 31 ]
python
en
['en', 'en', 'en']
True
BaseCase.scroll_to
(self, selector, by=By.CSS_SELECTOR, timeout=None)
Fast scroll to destination
Fast scroll to destination
def scroll_to(self, selector, by=By.CSS_SELECTOR, timeout=None): ''' Fast scroll to destination ''' if not timeout: timeout = settings.SMALL_TIMEOUT if self.timeout_multiplier and timeout == settings.SMALL_TIMEOUT: timeout = self.__get_new_timeout(timeout) if self...
[ "def", "scroll_to", "(", "self", ",", "selector", ",", "by", "=", "By", ".", "CSS_SELECTOR", ",", "timeout", "=", "None", ")", ":", "if", "not", "timeout", ":", "timeout", "=", "settings", ".", "SMALL_TIMEOUT", "if", "self", ".", "timeout_multiplier", "a...
[ 2129, 4 ]
[ 2147, 59 ]
python
en
['en', 'en', 'en']
True
BaseCase.slow_scroll_to
(self, selector, by=By.CSS_SELECTOR, timeout=None)
Slow motion scroll to destination
Slow motion scroll to destination
def slow_scroll_to(self, selector, by=By.CSS_SELECTOR, timeout=None): ''' Slow motion scroll to destination ''' if not timeout: timeout = settings.SMALL_TIMEOUT if self.timeout_multiplier and timeout == settings.SMALL_TIMEOUT: timeout = self.__get_new_timeout(timeout) ...
[ "def", "slow_scroll_to", "(", "self", ",", "selector", ",", "by", "=", "By", ".", "CSS_SELECTOR", ",", "timeout", "=", "None", ")", ":", "if", "not", "timeout", ":", "timeout", "=", "settings", ".", "SMALL_TIMEOUT", "if", "self", ".", "timeout_multiplier",...
[ 2149, 4 ]
[ 2165, 50 ]
python
en
['en', 'en', 'en']
True
SimpleCheckpointConfigurator.__init__
( self, name: str, data_context, site_names: Optional[Union[str, List[str]]] = "all", slack_webhook: Optional[str] = None, notify_on: Optional[str] = "all", notify_with: Optional[Union[str, List[str]]] = "all", **kwargs, )
After instantiation, call the .build() method to get a new Checkpoint. By default, the Checkpoint created will: 1. store the validation result 2. store evaluation parameters 3. update all data docs sites When configured, this builds a Checkpoint that sends a slack mess...
After instantiation, call the .build() method to get a new Checkpoint.
def __init__( self, name: str, data_context, site_names: Optional[Union[str, List[str]]] = "all", slack_webhook: Optional[str] = None, notify_on: Optional[str] = "all", notify_with: Optional[Union[str, List[str]]] = "all", **kwargs, ): """ ...
[ "def", "__init__", "(", "self", ",", "name", ":", "str", ",", "data_context", ",", "site_names", ":", "Optional", "[", "Union", "[", "str", ",", "List", "[", "str", "]", "]", "]", "=", "\"all\"", ",", "slack_webhook", ":", "Optional", "[", "str", "]"...
[ 48, 4 ]
[ 103, 34 ]
python
en
['en', 'error', 'th']
False
SimpleCheckpointConfigurator.build
(self)
Build a Checkpoint.
Build a Checkpoint.
def build(self) -> CheckpointConfig: """Build a Checkpoint.""" self._validate_site_names(self.data_context) self._validate_notify_on() self._validate_notify_with() self._validate_slack_webhook() self._validate_slack_configuration() return self._build_checkpoint_c...
[ "def", "build", "(", "self", ")", "->", "CheckpointConfig", ":", "self", ".", "_validate_site_names", "(", "self", ".", "data_context", ")", "self", ".", "_validate_notify_on", "(", ")", "self", ".", "_validate_notify_with", "(", ")", "self", ".", "_validate_s...
[ 105, 4 ]
[ 113, 46 ]
python
en
['en', 'en', 'en']
True
SimpleCheckpointConfigurator._add_slack_action
(self, action_list: List[Dict])
The underlying SlackNotificationAction and SlackRenderer default to including links to all sites if the key notify_with is not present. We are intentionally hiding this from users of SimpleCheckpoint by having a default of "all" that sets the configuration appropriately.
The underlying SlackNotificationAction and SlackRenderer default to including links to all sites if the key notify_with is not present. We are intentionally hiding this from users of SimpleCheckpoint by having a default of "all" that sets the configuration appropriately.
def _add_slack_action(self, action_list: List[Dict]) -> List[Dict]: """ The underlying SlackNotificationAction and SlackRenderer default to including links to all sites if the key notify_with is not present. We are intentionally hiding this from users of SimpleCheckpoint by having a ...
[ "def", "_add_slack_action", "(", "self", ",", "action_list", ":", "List", "[", "Dict", "]", ")", "->", "List", "[", "Dict", "]", ":", "_notify_with", "=", "self", ".", "notify_with", "if", "self", ".", "notify_with", "==", "\"all\"", ":", "_notify_with", ...
[ 160, 4 ]
[ 175, 26 ]
python
en
['en', 'error', 'th']
False
SimpleCheckpointConfigurator._validate_slack_configuration
(self)
Guide the user toward correct configuration.
Guide the user toward correct configuration.
def _validate_slack_configuration(self): """Guide the user toward correct configuration.""" if isinstance(self.notify_with, list) and self.slack_webhook is None: raise ValueError( "It appears you wish to send a slack message because you " "specified a list of ...
[ "def", "_validate_slack_configuration", "(", "self", ")", ":", "if", "isinstance", "(", "self", ".", "notify_with", ",", "list", ")", "and", "self", ".", "slack_webhook", "is", "None", ":", "raise", "ValueError", "(", "\"It appears you wish to send a slack message b...
[ 206, 4 ]
[ 221, 13 ]
python
en
['en', 'gl', 'en']
True
rgb
(dataset, at_index=0, x_coord='longitude', y_coord='latitude', bands=['red', 'green', 'blue'], paint_on_mask = [], min_possible=0, max_possible=10000, use_data_min=False, use_data_max=False, min_inten=0.15, max_inten=1.0, width=10, fig=None, ax=None)
Creates a figure showing an area, using three specified bands as the rgb componenets. Parameters ---------- dataset: xarray.Dataset A Dataset containing at least latitude and longitude coordinates and optionally time. The coordinate order should be time, latitude, and finally longi...
Creates a figure showing an area, using three specified bands as the rgb componenets. Parameters ---------- dataset: xarray.Dataset A Dataset containing at least latitude and longitude coordinates and optionally time. The coordinate order should be time, latitude, and finally longi...
def rgb(dataset, at_index=0, x_coord='longitude', y_coord='latitude', bands=['red', 'green', 'blue'], paint_on_mask = [], min_possible=0, max_possible=10000, use_data_min=False, use_data_max=False, min_inten=0.15, max_inten=1.0, width=10, fig=None, ax=None): """ Creates a figure ...
[ "def", "rgb", "(", "dataset", ",", "at_index", "=", "0", ",", "x_coord", "=", "'longitude'", ",", "y_coord", "=", "'latitude'", ",", "bands", "=", "[", "'red'", ",", "'green'", ",", "'blue'", "]", ",", "paint_on_mask", "=", "[", "]", ",", "min_possible...
[ 10, 0 ]
[ 82, 18 ]
python
en
['en', 'error', 'th']
False
find_filter_class
(filtername)
Lookup a filter by name. Return None if not found.
Lookup a filter by name. Return None if not found.
def find_filter_class(filtername): """Lookup a filter by name. Return None if not found.""" if filtername in FILTERS: return FILTERS[filtername] for name, cls in find_plugin_filters(): if name == filtername: return cls return None
[ "def", "find_filter_class", "(", "filtername", ")", ":", "if", "filtername", "in", "FILTERS", ":", "return", "FILTERS", "[", "filtername", "]", "for", "name", ",", "cls", "in", "find_plugin_filters", "(", ")", ":", "if", "name", "==", "filtername", ":", "r...
[ 22, 0 ]
[ 29, 15 ]
python
en
['en', 'en', 'en']
True
get_filter_by_name
(filtername, **options)
Return an instantiated filter. Options are passed to the filter initializer if wanted. Raise a ClassNotFound if not found.
Return an instantiated filter.
def get_filter_by_name(filtername, **options): """Return an instantiated filter. Options are passed to the filter initializer if wanted. Raise a ClassNotFound if not found. """ cls = find_filter_class(filtername) if cls: return cls(**options) else: raise ClassNotFound('filte...
[ "def", "get_filter_by_name", "(", "filtername", ",", "*", "*", "options", ")", ":", "cls", "=", "find_filter_class", "(", "filtername", ")", "if", "cls", ":", "return", "cls", "(", "*", "*", "options", ")", "else", ":", "raise", "ClassNotFound", "(", "'f...
[ 32, 0 ]
[ 42, 63 ]
python
en
['en', 'lb', 'en']
True
get_all_filters
()
Return a generator of all filter names.
Return a generator of all filter names.
def get_all_filters(): """Return a generator of all filter names.""" for name in FILTERS: yield name for name, _ in find_plugin_filters(): yield name
[ "def", "get_all_filters", "(", ")", ":", "for", "name", "in", "FILTERS", ":", "yield", "name", "for", "name", ",", "_", "in", "find_plugin_filters", "(", ")", ":", "yield", "name" ]
[ 45, 0 ]
[ 50, 18 ]
python
en
['en', 'en', 'en']
True
Scout.__init__
(self, app, version, install_id=None, id_plugin=None, id_plugin_args={}, scout_host="kubernaut.io", **kwargs)
Create a new Scout instance for later reports. :param app: The application name. Required. :param version: The application version. Required. :param install_id: Optional install_id. If set, Scout will believe it. :param id_plugin: Optional plugin function for obtaining an insta...
Create a new Scout instance for later reports.
def __init__(self, app, version, install_id=None, id_plugin=None, id_plugin_args={}, scout_host="kubernaut.io", **kwargs): """ Create a new Scout instance for later reports. :param app: The application name. Required. :param version: The application version. Required. ...
[ "def", "__init__", "(", "self", ",", "app", ",", "version", ",", "install_id", "=", "None", ",", "id_plugin", "=", "None", ",", "id_plugin_args", "=", "{", "}", ",", "scout_host", "=", "\"kubernaut.io\"", ",", "*", "*", "kwargs", ")", ":", "self", ".",...
[ 16, 4 ]
[ 87, 45 ]
python
en
['en', 'error', 'th']
False
Scout.configmap_install_id_plugin
(scout, app, map_name=None, namespace="default")
Scout id_plugin that uses a Kubernetes configmap to store the install ID. :param scout: Scout instance that's calling the plugin :param app: Name of the application that's using Scout :param map_name: Optional ConfigMap name to use; defaults to "scout.config.$app" :param namesp...
Scout id_plugin that uses a Kubernetes configmap to store the install ID.
def configmap_install_id_plugin(scout, app, map_name=None, namespace="default"): """ Scout id_plugin that uses a Kubernetes configmap to store the install ID. :param scout: Scout instance that's calling the plugin :param app: Name of the application that's using Scout :param map...
[ "def", "configmap_install_id_plugin", "(", "scout", ",", "app", ",", "map_name", "=", "None", ",", "namespace", "=", "\"default\"", ")", ":", "plugin_response", "=", "None", "if", "not", "map_name", ":", "map_name", "=", "\"scout.config.{0}\"", ".", "format", ...
[ 189, 4 ]
[ 313, 30 ]
python
en
['en', 'error', 'th']
False
clean_wiki_text
(text: str)
Clean wikipedia text by removing multiple new lines, removing extremely short lines, adding paragraph breaks and removing empty paragraphs
Clean wikipedia text by removing multiple new lines, removing extremely short lines, adding paragraph breaks and removing empty paragraphs
def clean_wiki_text(text: str) -> str: """ Clean wikipedia text by removing multiple new lines, removing extremely short lines, adding paragraph breaks and removing empty paragraphs """ # get rid of multiple new lines while "\n\n" in text: text = text.replace("\n\n", "\n") # remove ...
[ "def", "clean_wiki_text", "(", "text", ":", "str", ")", "->", "str", ":", "# get rid of multiple new lines", "while", "\"\\n\\n\"", "in", "text", ":", "text", "=", "text", ".", "replace", "(", "\"\\n\\n\"", ",", "\"\\n\"", ")", "# remove extremely short lines", ...
[ 3, 0 ]
[ 28, 15 ]
python
en
['en', 'error', 'th']
False
xr_scale
(data, data_vars=None, min_max=None, scaling='norm', copy=False)
Scales an xarray Dataset or DataArray with standard scaling or norm scaling. Parameters ---------- data: xarray.Dataset or xarray.DataArray The NumPy array to scale. data_vars: list The names of the data variables to scale. min_max: tuple A 2-tuple which s...
Scales an xarray Dataset or DataArray with standard scaling or norm scaling. Parameters ---------- data: xarray.Dataset or xarray.DataArray The NumPy array to scale. data_vars: list The names of the data variables to scale. min_max: tuple A 2-tuple which s...
def xr_scale(data, data_vars=None, min_max=None, scaling='norm', copy=False): """ Scales an xarray Dataset or DataArray with standard scaling or norm scaling. Parameters ---------- data: xarray.Dataset or xarray.DataArray The NumPy array to scale. data_vars: list Th...
[ "def", "xr_scale", "(", "data", ",", "data_vars", "=", "None", ",", "min_max", "=", "None", ",", "scaling", "=", "'norm'", ",", "copy", "=", "False", ")", ":", "data", "=", "data", ".", "copy", "(", ")", "if", "copy", "else", "data", "if", "isinsta...
[ 3, 0 ]
[ 30, 15 ]
python
en
['en', 'ja', 'th']
False
np_scale
(arr, pop_arr=None, pop_min_max=None, pop_mean_std=None, min_max=None, scaling='norm')
Scales a NumPy array with standard scaling or norm scaling, default to norm scaling. Parameters ---------- arr: numpy.ndarray The NumPy array to scale. pop_arr: numpy.ndarray, optional The NumPy array to treat as the population. If specified, all members of `arr` m...
Scales a NumPy array with standard scaling or norm scaling, default to norm scaling. Parameters ---------- arr: numpy.ndarray The NumPy array to scale. pop_arr: numpy.ndarray, optional The NumPy array to treat as the population. If specified, all members of `arr` m...
def np_scale(arr, pop_arr=None, pop_min_max=None, pop_mean_std=None, min_max=None, scaling='norm'): """ Scales a NumPy array with standard scaling or norm scaling, default to norm scaling. Parameters ---------- arr: numpy.ndarray The NumPy array to scale. pop_arr: numpy.ndarray,...
[ "def", "np_scale", "(", "arr", ",", "pop_arr", "=", "None", ",", "pop_min_max", "=", "None", ",", "pop_mean_std", "=", "None", ",", "min_max", "=", "None", ",", "scaling", "=", "'norm'", ")", ":", "if", "len", "(", "arr", ")", "==", "0", ":", "retu...
[ 33, 0 ]
[ 78, 18 ]
python
en
['en', 'ja', 'th']
False
auto_not_in_place
(v=True)
Force it to not run in place
Force it to not run in place
def auto_not_in_place(v=True): """Force it to not run in place """ import itkConfig itkConfig.NotInPlace = v
[ "def", "auto_not_in_place", "(", "v", "=", "True", ")", ":", "import", "itkConfig", "itkConfig", ".", "NotInPlace", "=", "v" ]
[ 30, 0 ]
[ 34, 28 ]
python
en
['en', 'en', 'en']
True
auto_progress
(progressType=1)
Set up auto progress report progressType: 1 or True -> auto progress be used in a terminal 2 -> simple auto progress (without special characters) 0 or False -> disable auto progress
Set up auto progress report
def auto_progress(progressType=1): """Set up auto progress report progressType: 1 or True -> auto progress be used in a terminal 2 -> simple auto progress (without special characters) 0 or False -> disable auto progress """ import itkConfig if progressType is True or progre...
[ "def", "auto_progress", "(", "progressType", "=", "1", ")", ":", "import", "itkConfig", "if", "progressType", "is", "True", "or", "progressType", "==", "1", ":", "itkConfig", ".", "ImportCallback", "=", "terminal_import_callback", "itkConfig", ".", "ProgressCallba...
[ 37, 0 ]
[ 60, 77 ]
python
en
['en', 'lv', 'en']
True
terminal_progress_callback
(name, p)
Display the progress of an object and clean the display once complete This function can be used with itkConfig.ProgressCallback
Display the progress of an object and clean the display once complete
def terminal_progress_callback(name, p): """Display the progress of an object and clean the display once complete This function can be used with itkConfig.ProgressCallback """ import sys print(clrLine + "%s: %f" % (name, p), file=sys.stderr, end="") if p == 1: print(clrLine, file=sys.st...
[ "def", "terminal_progress_callback", "(", "name", ",", "p", ")", ":", "import", "sys", "print", "(", "clrLine", "+", "\"%s: %f\"", "%", "(", "name", ",", "p", ")", ",", "file", "=", "sys", ".", "stderr", ",", "end", "=", "\"\"", ")", "if", "p", "==...
[ 63, 0 ]
[ 71, 47 ]
python
en
['en', 'en', 'en']
True
terminal_import_callback
(name, p)
Display the loading of a module and clean the display once complete This function can be used with itkConfig.ImportCallback
Display the loading of a module and clean the display once complete
def terminal_import_callback(name, p): """Display the loading of a module and clean the display once complete This function can be used with itkConfig.ImportCallback """ import sys print(clrLine + "Loading %s... " % name, file=sys.stderr, end="") if p == 1: print(clrLine, file=sys.stder...
[ "def", "terminal_import_callback", "(", "name", ",", "p", ")", ":", "import", "sys", "print", "(", "clrLine", "+", "\"Loading %s... \"", "%", "name", ",", "file", "=", "sys", ".", "stderr", ",", "end", "=", "\"\"", ")", "if", "p", "==", "1", ":", "pr...
[ 74, 0 ]
[ 82, 47 ]
python
en
['en', 'en', 'en']
True
simple_import_callback
(name, p)
Print a message when a module is loading This function can be used with itkConfig.ImportCallback
Print a message when a module is loading
def simple_import_callback(name, p): """Print a message when a module is loading This function can be used with itkConfig.ImportCallback """ import sys if p == 0: print("Loading %s... " % name, file=sys.stderr, end="") elif p == 1: print("done", file=sys.stderr)
[ "def", "simple_import_callback", "(", "name", ",", "p", ")", ":", "import", "sys", "if", "p", "==", "0", ":", "print", "(", "\"Loading %s... \"", "%", "name", ",", "file", "=", "sys", ".", "stderr", ",", "end", "=", "\"\"", ")", "elif", "p", "==", ...
[ 85, 0 ]
[ 94, 38 ]
python
en
['en', 'en', 'en']
True
simple_progress_callback
(name, p)
Print a message when an object is running This function can be used with itkConfig.ProgressCallback
Print a message when an object is running
def simple_progress_callback(name, p): """Print a message when an object is running This function can be used with itkConfig.ProgressCallback """ import sys if p == 0: print("Running %s... " % name, file=sys.stderr, end="") elif p == 1: print("done", file=sys.stderr)
[ "def", "simple_progress_callback", "(", "name", ",", "p", ")", ":", "import", "sys", "if", "p", "==", "0", ":", "print", "(", "\"Running %s... \"", "%", "name", ",", "file", "=", "sys", ".", "stderr", ",", "end", "=", "\"\"", ")", "elif", "p", "==", ...
[ 97, 0 ]
[ 106, 38 ]
python
en
['en', 'en', 'en']
True
force_load
()
force itk to load all the submodules
force itk to load all the submodules
def force_load(): """force itk to load all the submodules""" import itk for k in dir(itk): getattr(itk, k)
[ "def", "force_load", "(", ")", ":", "import", "itk", "for", "k", "in", "dir", "(", "itk", ")", ":", "getattr", "(", "itk", ",", "k", ")" ]
[ 109, 0 ]
[ 113, 23 ]
python
en
['en', 'en', 'en']
True
echo
(object, f=sys.stderr)
Print an object is f If the object has a method Print(), this method is used. repr(object) is used otherwise
Print an object is f
def echo(object, f=sys.stderr): """Print an object is f If the object has a method Print(), this method is used. repr(object) is used otherwise """ print(f, object)
[ "def", "echo", "(", "object", ",", "f", "=", "sys", ".", "stderr", ")", ":", "print", "(", "f", ",", "object", ")" ]
[ 119, 0 ]
[ 125, 20 ]
python
en
['en', 'en', 'en']
True
size
(imageOrFilter)
Return the size of an image, or of the output image of a filter This method take care of updating the needed informations
Return the size of an image, or of the output image of a filter
def size(imageOrFilter): """Return the size of an image, or of the output image of a filter This method take care of updating the needed informations """ # we don't need the entire output, only its size imageOrFilter.UpdateOutputInformation() img = output(imageOrFilter) return img.GetLarges...
[ "def", "size", "(", "imageOrFilter", ")", ":", "# we don't need the entire output, only its size", "imageOrFilter", ".", "UpdateOutputInformation", "(", ")", "img", "=", "output", "(", "imageOrFilter", ")", "return", "img", ".", "GetLargestPossibleRegion", "(", ")", "...
[ 129, 0 ]
[ 137, 51 ]
python
en
['en', 'en', 'en']
True
physical_size
(imageOrFilter)
Return the physical size of an image, or of the output image of a filter This method take care of updating the needed informations
Return the physical size of an image, or of the output image of a filter
def physical_size(imageOrFilter): """Return the physical size of an image, or of the output image of a filter This method take care of updating the needed informations """ # required because range is overloaded in this module import sys if sys.version_info >= (3, 0): from builtins import ...
[ "def", "physical_size", "(", "imageOrFilter", ")", ":", "# required because range is overloaded in this module", "import", "sys", "if", "sys", ".", "version_info", ">=", "(", "3", ",", "0", ")", ":", "from", "builtins", "import", "range", "else", ":", "from", "_...
[ 140, 0 ]
[ 156, 17 ]
python
en
['en', 'en', 'en']
True
spacing
(imageOrFilter)
Return the spacing of an image, or of the output image of a filter This method take care of updating the needed informations
Return the spacing of an image, or of the output image of a filter
def spacing(imageOrFilter): """Return the spacing of an image, or of the output image of a filter This method take care of updating the needed informations """ # we don't need the entire output, only its size imageOrFilter.UpdateOutputInformation() img = output(imageOrFilter) return img.Get...
[ "def", "spacing", "(", "imageOrFilter", ")", ":", "# we don't need the entire output, only its size", "imageOrFilter", ".", "UpdateOutputInformation", "(", ")", "img", "=", "output", "(", "imageOrFilter", ")", "return", "img", ".", "GetSpacing", "(", ")" ]
[ 159, 0 ]
[ 167, 27 ]
python
en
['en', 'en', 'en']
True
origin
(imageOrFilter)
Return the origin of an image, or of the output image of a filter This method take care of updating the needed informations
Return the origin of an image, or of the output image of a filter
def origin(imageOrFilter): """Return the origin of an image, or of the output image of a filter This method take care of updating the needed informations """ # we don't need the entire output, only its size imageOrFilter.UpdateOutputInformation() img = output(imageOrFilter) return img.GetOr...
[ "def", "origin", "(", "imageOrFilter", ")", ":", "# we don't need the entire output, only its size", "imageOrFilter", ".", "UpdateOutputInformation", "(", ")", "img", "=", "output", "(", "imageOrFilter", ")", "return", "img", ".", "GetOrigin", "(", ")" ]
[ 170, 0 ]
[ 178, 26 ]
python
en
['en', 'en', 'en']
True
index
(imageOrFilter)
Return the index of an image, or of the output image of a filter This method take care of updating the needed informations
Return the index of an image, or of the output image of a filter
def index(imageOrFilter): """Return the index of an image, or of the output image of a filter This method take care of updating the needed informations """ # we don't need the entire output, only its size imageOrFilter.UpdateOutputInformation() img = output(imageOrFilter) return img.GetLarg...
[ "def", "index", "(", "imageOrFilter", ")", ":", "# we don't need the entire output, only its size", "imageOrFilter", ".", "UpdateOutputInformation", "(", ")", "img", "=", "output", "(", "imageOrFilter", ")", "return", "img", ".", "GetLargestPossibleRegion", "(", ")", ...
[ 181, 0 ]
[ 189, 52 ]
python
en
['en', 'en', 'en']
True
region
(imageOrFilter)
Return the region of an image, or of the output image of a filter This method take care of updating the needed informations
Return the region of an image, or of the output image of a filter
def region(imageOrFilter): """Return the region of an image, or of the output image of a filter This method take care of updating the needed informations """ # we don't need the entire output, only its size imageOrFilter.UpdateOutputInformation() img = output(imageOrFilter) return img.GetLa...
[ "def", "region", "(", "imageOrFilter", ")", ":", "# we don't need the entire output, only its size", "imageOrFilter", ".", "UpdateOutputInformation", "(", ")", "img", "=", "output", "(", "imageOrFilter", ")", "return", "img", ".", "GetLargestPossibleRegion", "(", ")" ]
[ 192, 0 ]
[ 200, 41 ]
python
en
['en', 'en', 'en']
True
_get_itk_pixelid
(numpy_array_type)
Returns a ITK PixelID given a numpy array.
Returns a ITK PixelID given a numpy array.
def _get_itk_pixelid(numpy_array_type): """Returns a ITK PixelID given a numpy array.""" if not HAVE_NUMPY: raise ImportError('Numpy not available.') import itk # This is a Mapping from numpy array types to itk pixel types. _np_itk = {numpy.uint8:itk.UC, numpy.uint16:itk.US,...
[ "def", "_get_itk_pixelid", "(", "numpy_array_type", ")", ":", "if", "not", "HAVE_NUMPY", ":", "raise", "ImportError", "(", "'Numpy not available.'", ")", "import", "itk", "# This is a Mapping from numpy array types to itk pixel types.", "_np_itk", "=", "{", "numpy", ".", ...
[ 208, 0 ]
[ 234, 19 ]
python
en
['en', 'ca', 'en']
True
_GetArrayFromImage
(imageOrFilter, function)
Get an Array with the content of the image buffer
Get an Array with the content of the image buffer
def _GetArrayFromImage(imageOrFilter, function): """Get an Array with the content of the image buffer """ # Check for numpy if not HAVE_NUMPY: raise ImportError('Numpy not available.') # Finds the image type import itk keys = [k for k in itk.PyBuffer.keys() if k[0] == output(imageOrF...
[ "def", "_GetArrayFromImage", "(", "imageOrFilter", ",", "function", ")", ":", "# Check for numpy", "if", "not", "HAVE_NUMPY", ":", "raise", "ImportError", "(", "'Numpy not available.'", ")", "# Finds the image type", "import", "itk", "keys", "=", "[", "k", "for", ...
[ 236, 0 ]
[ 250, 51 ]
python
en
['en', 'en', 'en']
True
GetArrayFromImage
(imageOrFilter)
Get an array with the content of the image buffer
Get an array with the content of the image buffer
def GetArrayFromImage(imageOrFilter): """Get an array with the content of the image buffer """ return _GetArrayFromImage(imageOrFilter, "GetArrayFromImage")
[ "def", "GetArrayFromImage", "(", "imageOrFilter", ")", ":", "return", "_GetArrayFromImage", "(", "imageOrFilter", ",", "\"GetArrayFromImage\"", ")" ]
[ 252, 0 ]
[ 255, 65 ]
python
en
['en', 'en', 'en']
True
GetArrayViewFromImage
(imageOrFilter)
Get an array view with the content of the image buffer
Get an array view with the content of the image buffer
def GetArrayViewFromImage(imageOrFilter): """Get an array view with the content of the image buffer """ return _GetArrayFromImage(imageOrFilter, "GetArrayViewFromImage")
[ "def", "GetArrayViewFromImage", "(", "imageOrFilter", ")", ":", "return", "_GetArrayFromImage", "(", "imageOrFilter", ",", "\"GetArrayViewFromImage\"", ")" ]
[ 257, 0 ]
[ 260, 69 ]
python
en
['en', 'en', 'en']
True
_GetImageFromArray
(arr, function)
Get an ITK image from a Python array.
Get an ITK image from a Python array.
def _GetImageFromArray(arr, function): """Get an ITK image from a Python array. """ if not HAVE_NUMPY: raise ImportError('Numpy not available.') import itk PixelType = _get_itk_pixelid(arr) ImageType = itk.Image[PixelType,arr.ndim] templatedFunction = getattr(itk.PyBuffer[ImageType],...
[ "def", "_GetImageFromArray", "(", "arr", ",", "function", ")", ":", "if", "not", "HAVE_NUMPY", ":", "raise", "ImportError", "(", "'Numpy not available.'", ")", "import", "itk", "PixelType", "=", "_get_itk_pixelid", "(", "arr", ")", "ImageType", "=", "itk", "."...
[ 262, 0 ]
[ 271, 33 ]
python
en
['en', 'en', 'en']
True
GetImageFromArray
(arr)
Get an ITK image from a Python array.
Get an ITK image from a Python array.
def GetImageFromArray(arr): """Get an ITK image from a Python array. """ return _GetImageFromArray(arr, "GetImageFromArray")
[ "def", "GetImageFromArray", "(", "arr", ")", ":", "return", "_GetImageFromArray", "(", "arr", ",", "\"GetImageFromArray\"", ")" ]
[ 273, 0 ]
[ 276, 55 ]
python
en
['en', 'en', 'en']
True
GetImageViewFromArray
(arr)
Get an ITK image view from a Python array.
Get an ITK image view from a Python array.
def GetImageViewFromArray(arr): """Get an ITK image view from a Python array. """ return _GetImageFromArray(arr, "GetImageViewFromArray")
[ "def", "GetImageViewFromArray", "(", "arr", ")", ":", "return", "_GetImageFromArray", "(", "arr", ",", "\"GetImageViewFromArray\"", ")" ]
[ 278, 0 ]
[ 281, 59 ]
python
en
['en', 'en', 'en']
True
_GetArrayFromVnlObject
(vnlObject, function)
Get an array with the content of vnlObject
Get an array with the content of vnlObject
def _GetArrayFromVnlObject(vnlObject, function): """Get an array with the content of vnlObject """ # Check for numpy if not HAVE_NUMPY: raise ImportError('Numpy not available.') # Finds the vnl object type import itk PixelType = itk.template(vnlObject)[1][0] keys = [k for k in it...
[ "def", "_GetArrayFromVnlObject", "(", "vnlObject", ",", "function", ")", ":", "# Check for numpy", "if", "not", "HAVE_NUMPY", ":", "raise", "ImportError", "(", "'Numpy not available.'", ")", "# Finds the vnl object type", "import", "itk", "PixelType", "=", "itk", ".",...
[ 283, 0 ]
[ 297, 39 ]
python
en
['en', 'en', 'en']
True
GetArrayFromVnlVector
(vnlVector)
Get an array with the content of vnlVector
Get an array with the content of vnlVector
def GetArrayFromVnlVector(vnlVector): """Get an array with the content of vnlVector """ return _GetArrayFromVnlObject(vnlVector, "GetArrayFromVnlVector")
[ "def", "GetArrayFromVnlVector", "(", "vnlVector", ")", ":", "return", "_GetArrayFromVnlObject", "(", "vnlVector", ",", "\"GetArrayFromVnlVector\"", ")" ]
[ 299, 0 ]
[ 302, 69 ]
python
en
['en', 'en', 'en']
True