partition stringclasses 3
values | func_name stringlengths 1 134 | docstring stringlengths 1 46.9k | path stringlengths 4 223 | original_string stringlengths 75 104k | code stringlengths 75 104k | docstring_tokens listlengths 1 1.97k | repo stringlengths 7 55 | language stringclasses 1
value | url stringlengths 87 315 | code_tokens listlengths 19 28.4k | sha stringlengths 40 40 |
|---|---|---|---|---|---|---|---|---|---|---|---|
train | ConfigBase._readall | Read configs from all available configs. It will read files in the following order:
1.) Read all default settings:
These are located under: `<project_root>/config/*/default.cfg`
2.) Read the user's config settings:
This is located on the path: `~/.aftrc`
... | coyote_framework/config/abstract_config.py | def _readall(self):
"""Read configs from all available configs. It will read files in the following order:
1.) Read all default settings:
These are located under: `<project_root>/config/*/default.cfg`
2.) Read the user's config settings:
This is locate... | def _readall(self):
"""Read configs from all available configs. It will read files in the following order:
1.) Read all default settings:
These are located under: `<project_root>/config/*/default.cfg`
2.) Read the user's config settings:
This is locate... | [
"Read",
"configs",
"from",
"all",
"available",
"configs",
".",
"It",
"will",
"read",
"files",
"in",
"the",
"following",
"order",
":"
] | Shapeways/coyote_framework | python | https://github.com/Shapeways/coyote_framework/blob/cb29899b984a21d56bf65d0b1d907073948fe16c/coyote_framework/config/abstract_config.py#L52-L97 | [
"def",
"_readall",
"(",
"self",
")",
":",
"# First priority -- read all default configs",
"config_path",
"=",
"os",
".",
"path",
".",
"dirname",
"(",
"__file__",
")",
"config_defaults",
"=",
"[",
"os",
".",
"path",
".",
"join",
"(",
"dirpath",
",",
"f",
")",... | cb29899b984a21d56bf65d0b1d907073948fe16c |
train | run_parallel | Runs a series of functions in parallel. Return values are ordered by the order in which their functions
were passed.
>>> val1, val2 = run_parallel(
>>> lambda: 1 + 1
>>> lambda: 0
>>> )
If an exception is raised within one of the processes, that exception will be caught... | coyote_framework/util/apps/parallel.py | def run_parallel(*functions):
"""Runs a series of functions in parallel. Return values are ordered by the order in which their functions
were passed.
>>> val1, val2 = run_parallel(
>>> lambda: 1 + 1
>>> lambda: 0
>>> )
If an exception is raised within one of the pro... | def run_parallel(*functions):
"""Runs a series of functions in parallel. Return values are ordered by the order in which their functions
were passed.
>>> val1, val2 = run_parallel(
>>> lambda: 1 + 1
>>> lambda: 0
>>> )
If an exception is raised within one of the pro... | [
"Runs",
"a",
"series",
"of",
"functions",
"in",
"parallel",
".",
"Return",
"values",
"are",
"ordered",
"by",
"the",
"order",
"in",
"which",
"their",
"functions",
"were",
"passed",
"."
] | Shapeways/coyote_framework | python | https://github.com/Shapeways/coyote_framework/blob/cb29899b984a21d56bf65d0b1d907073948fe16c/coyote_framework/util/apps/parallel.py#L17-L76 | [
"def",
"run_parallel",
"(",
"*",
"functions",
")",
":",
"def",
"target",
"(",
"fn",
")",
":",
"def",
"wrapped",
"(",
"results_queue",
",",
"error_queue",
",",
"index",
")",
":",
"result",
"=",
"None",
"try",
":",
"result",
"=",
"fn",
"(",
")",
"excep... | cb29899b984a21d56bf65d0b1d907073948fe16c |
train | copy_and_update | Returns an updated copy of the dictionary without modifying the original | coyote_framework/webdriver/webdriver/browsercapabilities.py | def copy_and_update(dictionary, update):
"""Returns an updated copy of the dictionary without modifying the original"""
newdict = dictionary.copy()
newdict.update(update)
return newdict | def copy_and_update(dictionary, update):
"""Returns an updated copy of the dictionary without modifying the original"""
newdict = dictionary.copy()
newdict.update(update)
return newdict | [
"Returns",
"an",
"updated",
"copy",
"of",
"the",
"dictionary",
"without",
"modifying",
"the",
"original"
] | Shapeways/coyote_framework | python | https://github.com/Shapeways/coyote_framework/blob/cb29899b984a21d56bf65d0b1d907073948fe16c/coyote_framework/webdriver/webdriver/browsercapabilities.py#L4-L8 | [
"def",
"copy_and_update",
"(",
"dictionary",
",",
"update",
")",
":",
"newdict",
"=",
"dictionary",
".",
"copy",
"(",
")",
"newdict",
".",
"update",
"(",
"update",
")",
"return",
"newdict"
] | cb29899b984a21d56bf65d0b1d907073948fe16c |
train | get_static_directory | Retrieves the full path of the static directory
@return: Full path of the static directory | coyote_framework/webdriver/webdriverwrapper/support/staticreader.py | def get_static_directory():
"""Retrieves the full path of the static directory
@return: Full path of the static directory
"""
directory = templates_dir = os.path.join(os.path.dirname(__file__), 'static')
return directory | def get_static_directory():
"""Retrieves the full path of the static directory
@return: Full path of the static directory
"""
directory = templates_dir = os.path.join(os.path.dirname(__file__), 'static')
return directory | [
"Retrieves",
"the",
"full",
"path",
"of",
"the",
"static",
"directory"
] | Shapeways/coyote_framework | python | https://github.com/Shapeways/coyote_framework/blob/cb29899b984a21d56bf65d0b1d907073948fe16c/coyote_framework/webdriver/webdriverwrapper/support/staticreader.py#L10-L16 | [
"def",
"get_static_directory",
"(",
")",
":",
"directory",
"=",
"templates_dir",
"=",
"os",
".",
"path",
".",
"join",
"(",
"os",
".",
"path",
".",
"dirname",
"(",
"__file__",
")",
",",
"'static'",
")",
"return",
"directory"
] | cb29899b984a21d56bf65d0b1d907073948fe16c |
train | read_html_file | Reads the contents of an html file in the css directory
@return: Contents of the specified file | coyote_framework/webdriver/webdriverwrapper/support/staticreader.py | def read_html_file(filename):
"""Reads the contents of an html file in the css directory
@return: Contents of the specified file
"""
with open(os.path.join(get_static_directory(), 'html/{filename}'.format(filename=filename))) as f:
contents = f.read()
return contents | def read_html_file(filename):
"""Reads the contents of an html file in the css directory
@return: Contents of the specified file
"""
with open(os.path.join(get_static_directory(), 'html/{filename}'.format(filename=filename))) as f:
contents = f.read()
return contents | [
"Reads",
"the",
"contents",
"of",
"an",
"html",
"file",
"in",
"the",
"css",
"directory"
] | Shapeways/coyote_framework | python | https://github.com/Shapeways/coyote_framework/blob/cb29899b984a21d56bf65d0b1d907073948fe16c/coyote_framework/webdriver/webdriverwrapper/support/staticreader.py#L29-L36 | [
"def",
"read_html_file",
"(",
"filename",
")",
":",
"with",
"open",
"(",
"os",
".",
"path",
".",
"join",
"(",
"get_static_directory",
"(",
")",
",",
"'html/{filename}'",
".",
"format",
"(",
"filename",
"=",
"filename",
")",
")",
")",
"as",
"f",
":",
"c... | cb29899b984a21d56bf65d0b1d907073948fe16c |
train | LocatorHandler.parse_locator | Parses a valid selenium By and value from a locator;
returns as a named tuple with properties 'By' and 'value'
locator -- a valid element locator or css string | coyote_framework/webdriver/webdriverwrapper/support/LocatorHandler.py | def parse_locator(locator):
"""
Parses a valid selenium By and value from a locator;
returns as a named tuple with properties 'By' and 'value'
locator -- a valid element locator or css string
"""
# handle backwards compatibility to support new Locator class
if i... | def parse_locator(locator):
"""
Parses a valid selenium By and value from a locator;
returns as a named tuple with properties 'By' and 'value'
locator -- a valid element locator or css string
"""
# handle backwards compatibility to support new Locator class
if i... | [
"Parses",
"a",
"valid",
"selenium",
"By",
"and",
"value",
"from",
"a",
"locator",
";",
"returns",
"as",
"a",
"named",
"tuple",
"with",
"properties",
"By",
"and",
"value"
] | Shapeways/coyote_framework | python | https://github.com/Shapeways/coyote_framework/blob/cb29899b984a21d56bf65d0b1d907073948fe16c/coyote_framework/webdriver/webdriverwrapper/support/LocatorHandler.py#L16-L36 | [
"def",
"parse_locator",
"(",
"locator",
")",
":",
"# handle backwards compatibility to support new Locator class",
"if",
"isinstance",
"(",
"locator",
",",
"loc",
".",
"Locator",
")",
":",
"locator",
"=",
"'{by}={locator}'",
".",
"format",
"(",
"by",
"=",
"locator",... | cb29899b984a21d56bf65d0b1d907073948fe16c |
train | LocatorHandler.find_by_locator | Locate an element using either a webdriver or webelement
@param webdriver_or_element: Webdriver or Webelement object used for search
@type locator: webdriver.webdriverwrapper.support.locator.Locator
@param locator: locator used in search
@type find_al... | coyote_framework/webdriver/webdriverwrapper/support/LocatorHandler.py | def find_by_locator(webdriver_or_element, locator, find_all_elements=False):
"""
Locate an element using either a webdriver or webelement
@param webdriver_or_element: Webdriver or Webelement object used for search
@type locator: webdriver.webdriverwrapper.support.loc... | def find_by_locator(webdriver_or_element, locator, find_all_elements=False):
"""
Locate an element using either a webdriver or webelement
@param webdriver_or_element: Webdriver or Webelement object used for search
@type locator: webdriver.webdriverwrapper.support.loc... | [
"Locate",
"an",
"element",
"using",
"either",
"a",
"webdriver",
"or",
"webelement"
] | Shapeways/coyote_framework | python | https://github.com/Shapeways/coyote_framework/blob/cb29899b984a21d56bf65d0b1d907073948fe16c/coyote_framework/webdriver/webdriverwrapper/support/LocatorHandler.py#L39-L111 | [
"def",
"find_by_locator",
"(",
"webdriver_or_element",
",",
"locator",
",",
"find_all_elements",
"=",
"False",
")",
":",
"# handle backwards compatibility to support new Locator class",
"if",
"isinstance",
"(",
"locator",
",",
"loc",
".",
"Locator",
")",
":",
"locator",... | cb29899b984a21d56bf65d0b1d907073948fe16c |
train | WebDriverWrapperAssertion.spin_assert | Asserts that assertion function passed to it will return True,
trying every 'step' seconds until 'timeout' seconds have passed. | coyote_framework/webdriver/webdriverwrapper/support/WebDriverWrapperAssertion.py | def spin_assert(self, assertion, failure_message='Failed Assertion', timeout=None):
"""
Asserts that assertion function passed to it will return True,
trying every 'step' seconds until 'timeout' seconds have passed.
"""
timeout = self.timeout if timeout is None else timeout
... | def spin_assert(self, assertion, failure_message='Failed Assertion', timeout=None):
"""
Asserts that assertion function passed to it will return True,
trying every 'step' seconds until 'timeout' seconds have passed.
"""
timeout = self.timeout if timeout is None else timeout
... | [
"Asserts",
"that",
"assertion",
"function",
"passed",
"to",
"it",
"will",
"return",
"True",
"trying",
"every",
"step",
"seconds",
"until",
"timeout",
"seconds",
"have",
"passed",
"."
] | Shapeways/coyote_framework | python | https://github.com/Shapeways/coyote_framework/blob/cb29899b984a21d56bf65d0b1d907073948fe16c/coyote_framework/webdriver/webdriverwrapper/support/WebDriverWrapperAssertion.py#L29-L44 | [
"def",
"spin_assert",
"(",
"self",
",",
"assertion",
",",
"failure_message",
"=",
"'Failed Assertion'",
",",
"timeout",
"=",
"None",
")",
":",
"timeout",
"=",
"self",
".",
"timeout",
"if",
"timeout",
"is",
"None",
"else",
"timeout",
"time_spent",
"=",
"0",
... | cb29899b984a21d56bf65d0b1d907073948fe16c |
train | WebDriverWrapperAssertion.webdriver_assert | Assert the assertion, but throw a WebDriverAssertionException if assertion fails | coyote_framework/webdriver/webdriverwrapper/support/WebDriverWrapperAssertion.py | def webdriver_assert(self, assertion, failure_message='Failed Assertion'):
"""
Assert the assertion, but throw a WebDriverAssertionException if assertion fails
"""
try:
assert assertion() is True
except AssertionError:
raise WebDriverAssertionException.Web... | def webdriver_assert(self, assertion, failure_message='Failed Assertion'):
"""
Assert the assertion, but throw a WebDriverAssertionException if assertion fails
"""
try:
assert assertion() is True
except AssertionError:
raise WebDriverAssertionException.Web... | [
"Assert",
"the",
"assertion",
"but",
"throw",
"a",
"WebDriverAssertionException",
"if",
"assertion",
"fails"
] | Shapeways/coyote_framework | python | https://github.com/Shapeways/coyote_framework/blob/cb29899b984a21d56bf65d0b1d907073948fe16c/coyote_framework/webdriver/webdriverwrapper/support/WebDriverWrapperAssertion.py#L46-L55 | [
"def",
"webdriver_assert",
"(",
"self",
",",
"assertion",
",",
"failure_message",
"=",
"'Failed Assertion'",
")",
":",
"try",
":",
"assert",
"assertion",
"(",
")",
"is",
"True",
"except",
"AssertionError",
":",
"raise",
"WebDriverAssertionException",
".",
"WebDriv... | cb29899b984a21d56bf65d0b1d907073948fe16c |
train | WebDriverWrapperAssertion.assert_true | Asserts that a value is true
@type value: bool
@param value: value to test for True | coyote_framework/webdriver/webdriverwrapper/support/WebDriverWrapperAssertion.py | def assert_true(self, value, failure_message='Expected value to be True, was: {}'):
"""
Asserts that a value is true
@type value: bool
@param value: value to test for True
"""
assertion = lambda: bool(value)
self.webdriver_assert(assertion, unicode(failure_m... | def assert_true(self, value, failure_message='Expected value to be True, was: {}'):
"""
Asserts that a value is true
@type value: bool
@param value: value to test for True
"""
assertion = lambda: bool(value)
self.webdriver_assert(assertion, unicode(failure_m... | [
"Asserts",
"that",
"a",
"value",
"is",
"true"
] | Shapeways/coyote_framework | python | https://github.com/Shapeways/coyote_framework/blob/cb29899b984a21d56bf65d0b1d907073948fe16c/coyote_framework/webdriver/webdriverwrapper/support/WebDriverWrapperAssertion.py#L63-L71 | [
"def",
"assert_true",
"(",
"self",
",",
"value",
",",
"failure_message",
"=",
"'Expected value to be True, was: {}'",
")",
":",
"assertion",
"=",
"lambda",
":",
"bool",
"(",
"value",
")",
"self",
".",
"webdriver_assert",
"(",
"assertion",
",",
"unicode",
"(",
... | cb29899b984a21d56bf65d0b1d907073948fe16c |
train | WebDriverWrapperAssertion.assert_equals | Calls smart_assert, but creates its own assertion closure using
the expected and provided values with the '==' operator | coyote_framework/webdriver/webdriverwrapper/support/WebDriverWrapperAssertion.py | def assert_equals(self, actual_val, expected_val, failure_message='Expected values to be equal: "{}" and "{}"'):
"""
Calls smart_assert, but creates its own assertion closure using
the expected and provided values with the '==' operator
"""
assertion = lambda: expected_val == act... | def assert_equals(self, actual_val, expected_val, failure_message='Expected values to be equal: "{}" and "{}"'):
"""
Calls smart_assert, but creates its own assertion closure using
the expected and provided values with the '==' operator
"""
assertion = lambda: expected_val == act... | [
"Calls",
"smart_assert",
"but",
"creates",
"its",
"own",
"assertion",
"closure",
"using",
"the",
"expected",
"and",
"provided",
"values",
"with",
"the",
"==",
"operator"
] | Shapeways/coyote_framework | python | https://github.com/Shapeways/coyote_framework/blob/cb29899b984a21d56bf65d0b1d907073948fe16c/coyote_framework/webdriver/webdriverwrapper/support/WebDriverWrapperAssertion.py#L83-L89 | [
"def",
"assert_equals",
"(",
"self",
",",
"actual_val",
",",
"expected_val",
",",
"failure_message",
"=",
"'Expected values to be equal: \"{}\" and \"{}\"'",
")",
":",
"assertion",
"=",
"lambda",
":",
"expected_val",
"==",
"actual_val",
"self",
".",
"webdriver_assert",
... | cb29899b984a21d56bf65d0b1d907073948fe16c |
train | WebDriverWrapperAssertion.assert_numbers_almost_equal | Asserts that two numbers are within an allowed delta of each other | coyote_framework/webdriver/webdriverwrapper/support/WebDriverWrapperAssertion.py | def assert_numbers_almost_equal(self, actual_val, expected_val, allowed_delta=0.0001,
failure_message='Expected numbers to be within {} of each other: "{}" and "{}"'):
"""
Asserts that two numbers are within an allowed delta of each other
"""
assertion... | def assert_numbers_almost_equal(self, actual_val, expected_val, allowed_delta=0.0001,
failure_message='Expected numbers to be within {} of each other: "{}" and "{}"'):
"""
Asserts that two numbers are within an allowed delta of each other
"""
assertion... | [
"Asserts",
"that",
"two",
"numbers",
"are",
"within",
"an",
"allowed",
"delta",
"of",
"each",
"other"
] | Shapeways/coyote_framework | python | https://github.com/Shapeways/coyote_framework/blob/cb29899b984a21d56bf65d0b1d907073948fe16c/coyote_framework/webdriver/webdriverwrapper/support/WebDriverWrapperAssertion.py#L91-L97 | [
"def",
"assert_numbers_almost_equal",
"(",
"self",
",",
"actual_val",
",",
"expected_val",
",",
"allowed_delta",
"=",
"0.0001",
",",
"failure_message",
"=",
"'Expected numbers to be within {} of each other: \"{}\" and \"{}\"'",
")",
":",
"assertion",
"=",
"lambda",
":",
"... | cb29899b984a21d56bf65d0b1d907073948fe16c |
train | WebDriverWrapperAssertion.assert_not_equal | Calls smart_assert, but creates its own assertion closure using
the expected and provided values with the '!=' operator | coyote_framework/webdriver/webdriverwrapper/support/WebDriverWrapperAssertion.py | def assert_not_equal(self, actual_val, unexpected_val, failure_message='Expected values to differ: "{}" and "{}"'):
"""
Calls smart_assert, but creates its own assertion closure using
the expected and provided values with the '!=' operator
"""
assertion = lambda: unexpected_val !... | def assert_not_equal(self, actual_val, unexpected_val, failure_message='Expected values to differ: "{}" and "{}"'):
"""
Calls smart_assert, but creates its own assertion closure using
the expected and provided values with the '!=' operator
"""
assertion = lambda: unexpected_val !... | [
"Calls",
"smart_assert",
"but",
"creates",
"its",
"own",
"assertion",
"closure",
"using",
"the",
"expected",
"and",
"provided",
"values",
"with",
"the",
"!",
"=",
"operator"
] | Shapeways/coyote_framework | python | https://github.com/Shapeways/coyote_framework/blob/cb29899b984a21d56bf65d0b1d907073948fe16c/coyote_framework/webdriver/webdriverwrapper/support/WebDriverWrapperAssertion.py#L99-L105 | [
"def",
"assert_not_equal",
"(",
"self",
",",
"actual_val",
",",
"unexpected_val",
",",
"failure_message",
"=",
"'Expected values to differ: \"{}\" and \"{}\"'",
")",
":",
"assertion",
"=",
"lambda",
":",
"unexpected_val",
"!=",
"actual_val",
"self",
".",
"webdriver_asse... | cb29899b984a21d56bf65d0b1d907073948fe16c |
train | WebDriverWrapperAssertion.assert_is | Calls smart_assert, but creates its own assertion closure using
the expected and provided values with the 'is' operator | coyote_framework/webdriver/webdriverwrapper/support/WebDriverWrapperAssertion.py | def assert_is(self, actual_val, expected_type, failure_message='Expected type to be "{1}," but was "{0}"'):
"""
Calls smart_assert, but creates its own assertion closure using
the expected and provided values with the 'is' operator
"""
assertion = lambda: expected_type is actual_... | def assert_is(self, actual_val, expected_type, failure_message='Expected type to be "{1}," but was "{0}"'):
"""
Calls smart_assert, but creates its own assertion closure using
the expected and provided values with the 'is' operator
"""
assertion = lambda: expected_type is actual_... | [
"Calls",
"smart_assert",
"but",
"creates",
"its",
"own",
"assertion",
"closure",
"using",
"the",
"expected",
"and",
"provided",
"values",
"with",
"the",
"is",
"operator"
] | Shapeways/coyote_framework | python | https://github.com/Shapeways/coyote_framework/blob/cb29899b984a21d56bf65d0b1d907073948fe16c/coyote_framework/webdriver/webdriverwrapper/support/WebDriverWrapperAssertion.py#L107-L113 | [
"def",
"assert_is",
"(",
"self",
",",
"actual_val",
",",
"expected_type",
",",
"failure_message",
"=",
"'Expected type to be \"{1},\" but was \"{0}\"'",
")",
":",
"assertion",
"=",
"lambda",
":",
"expected_type",
"is",
"actual_val",
"self",
".",
"webdriver_assert",
"(... | cb29899b984a21d56bf65d0b1d907073948fe16c |
train | WebDriverWrapperAssertion.assert_is_not | Calls smart_assert, but creates its own assertion closure using
the expected and provided values with the 'is not' operator | coyote_framework/webdriver/webdriverwrapper/support/WebDriverWrapperAssertion.py | def assert_is_not(self, actual_val, unexpected_type,
failure_message='Expected type not to be "{1}," but was "{0}"'):
"""
Calls smart_assert, but creates its own assertion closure using
the expected and provided values with the 'is not' operator
"""
assertio... | def assert_is_not(self, actual_val, unexpected_type,
failure_message='Expected type not to be "{1}," but was "{0}"'):
"""
Calls smart_assert, but creates its own assertion closure using
the expected and provided values with the 'is not' operator
"""
assertio... | [
"Calls",
"smart_assert",
"but",
"creates",
"its",
"own",
"assertion",
"closure",
"using",
"the",
"expected",
"and",
"provided",
"values",
"with",
"the",
"is",
"not",
"operator"
] | Shapeways/coyote_framework | python | https://github.com/Shapeways/coyote_framework/blob/cb29899b984a21d56bf65d0b1d907073948fe16c/coyote_framework/webdriver/webdriverwrapper/support/WebDriverWrapperAssertion.py#L115-L122 | [
"def",
"assert_is_not",
"(",
"self",
",",
"actual_val",
",",
"unexpected_type",
",",
"failure_message",
"=",
"'Expected type not to be \"{1},\" but was \"{0}\"'",
")",
":",
"assertion",
"=",
"lambda",
":",
"unexpected_type",
"is",
"not",
"actual_val",
"self",
".",
"we... | cb29899b984a21d56bf65d0b1d907073948fe16c |
train | WebDriverWrapperAssertion.assert_in | Calls smart_assert, but creates its own assertion closure using
the expected and provided values with the 'in' operator | coyote_framework/webdriver/webdriverwrapper/support/WebDriverWrapperAssertion.py | def assert_in(self, actual_collection_or_string, expected_value, failure_message='Expected "{1}" to be in "{0}"'):
"""
Calls smart_assert, but creates its own assertion closure using
the expected and provided values with the 'in' operator
"""
assertion = lambda: expected_value in... | def assert_in(self, actual_collection_or_string, expected_value, failure_message='Expected "{1}" to be in "{0}"'):
"""
Calls smart_assert, but creates its own assertion closure using
the expected and provided values with the 'in' operator
"""
assertion = lambda: expected_value in... | [
"Calls",
"smart_assert",
"but",
"creates",
"its",
"own",
"assertion",
"closure",
"using",
"the",
"expected",
"and",
"provided",
"values",
"with",
"the",
"in",
"operator"
] | Shapeways/coyote_framework | python | https://github.com/Shapeways/coyote_framework/blob/cb29899b984a21d56bf65d0b1d907073948fe16c/coyote_framework/webdriver/webdriverwrapper/support/WebDriverWrapperAssertion.py#L124-L130 | [
"def",
"assert_in",
"(",
"self",
",",
"actual_collection_or_string",
",",
"expected_value",
",",
"failure_message",
"=",
"'Expected \"{1}\" to be in \"{0}\"'",
")",
":",
"assertion",
"=",
"lambda",
":",
"expected_value",
"in",
"actual_collection_or_string",
"self",
".",
... | cb29899b984a21d56bf65d0b1d907073948fe16c |
train | WebDriverWrapperAssertion.assert_not_in | Calls smart_assert, but creates its own assertion closure using
the expected and provided values with the 'not in' operator | coyote_framework/webdriver/webdriverwrapper/support/WebDriverWrapperAssertion.py | def assert_not_in(self, actual_collection_or_string, unexpected_value,
failure_message='Expected "{1}" not to be in "{0}"'):
"""
Calls smart_assert, but creates its own assertion closure using
the expected and provided values with the 'not in' operator
"""
a... | def assert_not_in(self, actual_collection_or_string, unexpected_value,
failure_message='Expected "{1}" not to be in "{0}"'):
"""
Calls smart_assert, but creates its own assertion closure using
the expected and provided values with the 'not in' operator
"""
a... | [
"Calls",
"smart_assert",
"but",
"creates",
"its",
"own",
"assertion",
"closure",
"using",
"the",
"expected",
"and",
"provided",
"values",
"with",
"the",
"not",
"in",
"operator"
] | Shapeways/coyote_framework | python | https://github.com/Shapeways/coyote_framework/blob/cb29899b984a21d56bf65d0b1d907073948fe16c/coyote_framework/webdriver/webdriverwrapper/support/WebDriverWrapperAssertion.py#L132-L139 | [
"def",
"assert_not_in",
"(",
"self",
",",
"actual_collection_or_string",
",",
"unexpected_value",
",",
"failure_message",
"=",
"'Expected \"{1}\" not to be in \"{0}\"'",
")",
":",
"assertion",
"=",
"lambda",
":",
"unexpected_value",
"not",
"in",
"actual_collection_or_string... | cb29899b984a21d56bf65d0b1d907073948fe16c |
train | WebDriverWrapperAssertion.assert_page_source_contains | Asserts that the page source contains the string passed in expected_value | coyote_framework/webdriver/webdriverwrapper/support/WebDriverWrapperAssertion.py | def assert_page_source_contains(self, expected_value, failure_message='Expected page source to contain: "{}"'):
"""
Asserts that the page source contains the string passed in expected_value
"""
assertion = lambda: expected_value in self.driver_wrapper.page_source()
self.webdriver... | def assert_page_source_contains(self, expected_value, failure_message='Expected page source to contain: "{}"'):
"""
Asserts that the page source contains the string passed in expected_value
"""
assertion = lambda: expected_value in self.driver_wrapper.page_source()
self.webdriver... | [
"Asserts",
"that",
"the",
"page",
"source",
"contains",
"the",
"string",
"passed",
"in",
"expected_value"
] | Shapeways/coyote_framework | python | https://github.com/Shapeways/coyote_framework/blob/cb29899b984a21d56bf65d0b1d907073948fe16c/coyote_framework/webdriver/webdriverwrapper/support/WebDriverWrapperAssertion.py#L141-L146 | [
"def",
"assert_page_source_contains",
"(",
"self",
",",
"expected_value",
",",
"failure_message",
"=",
"'Expected page source to contain: \"{}\"'",
")",
":",
"assertion",
"=",
"lambda",
":",
"expected_value",
"in",
"self",
".",
"driver_wrapper",
".",
"page_source",
"(",... | cb29899b984a21d56bf65d0b1d907073948fe16c |
train | WebDriverWrapperAssertion.assert_union | Asserts that the union of two sets has at least one member (collections share at least one member) | coyote_framework/webdriver/webdriverwrapper/support/WebDriverWrapperAssertion.py | def assert_union(self, collection1, collection2,
failure_message='Expected overlap between collections: "{}" and "{}"'):
"""
Asserts that the union of two sets has at least one member (collections share at least one member)
"""
assertion = lambda: len(collection1 or ... | def assert_union(self, collection1, collection2,
failure_message='Expected overlap between collections: "{}" and "{}"'):
"""
Asserts that the union of two sets has at least one member (collections share at least one member)
"""
assertion = lambda: len(collection1 or ... | [
"Asserts",
"that",
"the",
"union",
"of",
"two",
"sets",
"has",
"at",
"least",
"one",
"member",
"(",
"collections",
"share",
"at",
"least",
"one",
"member",
")"
] | Shapeways/coyote_framework | python | https://github.com/Shapeways/coyote_framework/blob/cb29899b984a21d56bf65d0b1d907073948fe16c/coyote_framework/webdriver/webdriverwrapper/support/WebDriverWrapperAssertion.py#L148-L155 | [
"def",
"assert_union",
"(",
"self",
",",
"collection1",
",",
"collection2",
",",
"failure_message",
"=",
"'Expected overlap between collections: \"{}\" and \"{}\"'",
")",
":",
"assertion",
"=",
"lambda",
":",
"len",
"(",
"collection1",
"or",
"collection2",
")",
">",
... | cb29899b984a21d56bf65d0b1d907073948fe16c |
train | WebDriverWrapperAssertion.assert_no_union | Asserts that the union of two sets is empty (collections are unique) | coyote_framework/webdriver/webdriverwrapper/support/WebDriverWrapperAssertion.py | def assert_no_union(self, collection1, collection2,
failure_message='Expected no overlap between collections: "{}" and "{}"'):
"""
Asserts that the union of two sets is empty (collections are unique)
"""
assertion = lambda: len(set(collection1).intersection(set(co... | def assert_no_union(self, collection1, collection2,
failure_message='Expected no overlap between collections: "{}" and "{}"'):
"""
Asserts that the union of two sets is empty (collections are unique)
"""
assertion = lambda: len(set(collection1).intersection(set(co... | [
"Asserts",
"that",
"the",
"union",
"of",
"two",
"sets",
"is",
"empty",
"(",
"collections",
"are",
"unique",
")"
] | Shapeways/coyote_framework | python | https://github.com/Shapeways/coyote_framework/blob/cb29899b984a21d56bf65d0b1d907073948fe16c/coyote_framework/webdriver/webdriverwrapper/support/WebDriverWrapperAssertion.py#L157-L164 | [
"def",
"assert_no_union",
"(",
"self",
",",
"collection1",
",",
"collection2",
",",
"failure_message",
"=",
"'Expected no overlap between collections: \"{}\" and \"{}\"'",
")",
":",
"assertion",
"=",
"lambda",
":",
"len",
"(",
"set",
"(",
"collection1",
")",
".",
"i... | cb29899b984a21d56bf65d0b1d907073948fe16c |
train | WebDriverWrapperAssertion.assert_subset | Asserts that a superset contains all elements of a subset | coyote_framework/webdriver/webdriverwrapper/support/WebDriverWrapperAssertion.py | def assert_subset(self, subset, superset, failure_message='Expected collection "{}" to be a subset of "{}'):
"""
Asserts that a superset contains all elements of a subset
"""
assertion = lambda: set(subset).issubset(set(superset))
failure_message = unicode(failure_message).format... | def assert_subset(self, subset, superset, failure_message='Expected collection "{}" to be a subset of "{}'):
"""
Asserts that a superset contains all elements of a subset
"""
assertion = lambda: set(subset).issubset(set(superset))
failure_message = unicode(failure_message).format... | [
"Asserts",
"that",
"a",
"superset",
"contains",
"all",
"elements",
"of",
"a",
"subset"
] | Shapeways/coyote_framework | python | https://github.com/Shapeways/coyote_framework/blob/cb29899b984a21d56bf65d0b1d907073948fe16c/coyote_framework/webdriver/webdriverwrapper/support/WebDriverWrapperAssertion.py#L166-L172 | [
"def",
"assert_subset",
"(",
"self",
",",
"subset",
",",
"superset",
",",
"failure_message",
"=",
"'Expected collection \"{}\" to be a subset of \"{}'",
")",
":",
"assertion",
"=",
"lambda",
":",
"set",
"(",
"subset",
")",
".",
"issubset",
"(",
"set",
"(",
"supe... | cb29899b984a21d56bf65d0b1d907073948fe16c |
train | WebElementWrapper.clear | Clears the field represented by this element
@rtype: WebElementWrapper
@return: Returns itself | coyote_framework/webdriver/webdriverwrapper/WebElementWrapper.py | def clear(self):
"""
Clears the field represented by this element
@rtype: WebElementWrapper
@return: Returns itself
"""
def clear_element():
"""
Wrapper to clear element
"""
return self.element.clear()
self.e... | def clear(self):
"""
Clears the field represented by this element
@rtype: WebElementWrapper
@return: Returns itself
"""
def clear_element():
"""
Wrapper to clear element
"""
return self.element.clear()
self.e... | [
"Clears",
"the",
"field",
"represented",
"by",
"this",
"element"
] | Shapeways/coyote_framework | python | https://github.com/Shapeways/coyote_framework/blob/cb29899b984a21d56bf65d0b1d907073948fe16c/coyote_framework/webdriver/webdriverwrapper/WebElementWrapper.py#L94-L107 | [
"def",
"clear",
"(",
"self",
")",
":",
"def",
"clear_element",
"(",
")",
":",
"\"\"\"\n Wrapper to clear element\n \"\"\"",
"return",
"self",
".",
"element",
".",
"clear",
"(",
")",
"self",
".",
"execute_and_handle_webelement_exceptions",
"(",
"c... | cb29899b984a21d56bf65d0b1d907073948fe16c |
train | WebElementWrapper.delete_content | Deletes content in the input field by repeatedly typing HOME, then DELETE
@rtype: WebElementWrapper
@return: Returns itself | coyote_framework/webdriver/webdriverwrapper/WebElementWrapper.py | def delete_content(self, max_chars=100):
"""
Deletes content in the input field by repeatedly typing HOME, then DELETE
@rtype: WebElementWrapper
@return: Returns itself
"""
def delete_content_element():
chars_deleted = 0
while len(self.get_... | def delete_content(self, max_chars=100):
"""
Deletes content in the input field by repeatedly typing HOME, then DELETE
@rtype: WebElementWrapper
@return: Returns itself
"""
def delete_content_element():
chars_deleted = 0
while len(self.get_... | [
"Deletes",
"content",
"in",
"the",
"input",
"field",
"by",
"repeatedly",
"typing",
"HOME",
"then",
"DELETE"
] | Shapeways/coyote_framework | python | https://github.com/Shapeways/coyote_framework/blob/cb29899b984a21d56bf65d0b1d907073948fe16c/coyote_framework/webdriver/webdriverwrapper/WebElementWrapper.py#L109-L125 | [
"def",
"delete_content",
"(",
"self",
",",
"max_chars",
"=",
"100",
")",
":",
"def",
"delete_content_element",
"(",
")",
":",
"chars_deleted",
"=",
"0",
"while",
"len",
"(",
"self",
".",
"get_attribute",
"(",
"'value'",
")",
")",
">",
"0",
"and",
"chars_... | cb29899b984a21d56bf65d0b1d907073948fe16c |
train | WebElementWrapper.click | Clicks the element
@type force_click: bool
@param force_click: force a click on the element using javascript, skipping webdriver
@rtype: WebElementWrapper
@return: Returns itself | coyote_framework/webdriver/webdriverwrapper/WebElementWrapper.py | def click(self, force_click=False):
"""
Clicks the element
@type force_click: bool
@param force_click: force a click on the element using javascript, skipping webdriver
@rtype: WebElementWrapper
@return: Returns itself
"""
js_exec... | def click(self, force_click=False):
"""
Clicks the element
@type force_click: bool
@param force_click: force a click on the element using javascript, skipping webdriver
@rtype: WebElementWrapper
@return: Returns itself
"""
js_exec... | [
"Clicks",
"the",
"element"
] | Shapeways/coyote_framework | python | https://github.com/Shapeways/coyote_framework/blob/cb29899b984a21d56bf65d0b1d907073948fe16c/coyote_framework/webdriver/webdriverwrapper/WebElementWrapper.py#L127-L157 | [
"def",
"click",
"(",
"self",
",",
"force_click",
"=",
"False",
")",
":",
"js_executor",
"=",
"self",
".",
"driver_wrapper",
".",
"js_executor",
"def",
"click_element",
"(",
")",
":",
"\"\"\"\n Wrapper to call click\n \"\"\"",
"return",
"self",
... | cb29899b984a21d56bf65d0b1d907073948fe16c |
train | WebElementWrapper.get_value | Gets the value of a select or input element
@rtype: str
@return: The value of the element
@raise: ValueError if element is not of type input or select, or has multiple selected options | coyote_framework/webdriver/webdriverwrapper/WebElementWrapper.py | def get_value(self):
"""Gets the value of a select or input element
@rtype: str
@return: The value of the element
@raise: ValueError if element is not of type input or select, or has multiple selected options
"""
def get_element_value():
if self.tag_name() ==... | def get_value(self):
"""Gets the value of a select or input element
@rtype: str
@return: The value of the element
@raise: ValueError if element is not of type input or select, or has multiple selected options
"""
def get_element_value():
if self.tag_name() ==... | [
"Gets",
"the",
"value",
"of",
"a",
"select",
"or",
"input",
"element"
] | Shapeways/coyote_framework | python | https://github.com/Shapeways/coyote_framework/blob/cb29899b984a21d56bf65d0b1d907073948fe16c/coyote_framework/webdriver/webdriverwrapper/WebElementWrapper.py#L159-L180 | [
"def",
"get_value",
"(",
"self",
")",
":",
"def",
"get_element_value",
"(",
")",
":",
"if",
"self",
".",
"tag_name",
"(",
")",
"==",
"'input'",
":",
"return",
"self",
".",
"get_attribute",
"(",
"'value'",
")",
"elif",
"self",
".",
"tag_name",
"(",
")",... | cb29899b984a21d56bf65d0b1d907073948fe16c |
train | WebElementWrapper.get_attribute | Retrieves specified attribute from WebElement
@type name: str
@param name: Attribute to retrieve
@rtype: str
@return: String representation of the attribute | coyote_framework/webdriver/webdriverwrapper/WebElementWrapper.py | def get_attribute(self, name):
"""
Retrieves specified attribute from WebElement
@type name: str
@param name: Attribute to retrieve
@rtype: str
@return: String representation of the attribute
"""
def get_attribute_element():
... | def get_attribute(self, name):
"""
Retrieves specified attribute from WebElement
@type name: str
@param name: Attribute to retrieve
@rtype: str
@return: String representation of the attribute
"""
def get_attribute_element():
... | [
"Retrieves",
"specified",
"attribute",
"from",
"WebElement"
] | Shapeways/coyote_framework | python | https://github.com/Shapeways/coyote_framework/blob/cb29899b984a21d56bf65d0b1d907073948fe16c/coyote_framework/webdriver/webdriverwrapper/WebElementWrapper.py#L182-L197 | [
"def",
"get_attribute",
"(",
"self",
",",
"name",
")",
":",
"def",
"get_attribute_element",
"(",
")",
":",
"\"\"\"\n Wrapper to retrieve element\n \"\"\"",
"return",
"self",
".",
"element",
".",
"get_attribute",
"(",
"name",
")",
"return",
"self"... | cb29899b984a21d56bf65d0b1d907073948fe16c |
train | WebElementWrapper.is_on_screen | Tests if the element is within the viewport of the screen (partially hidden by overflow will return true)
@return: True if on screen, False otherwise | coyote_framework/webdriver/webdriverwrapper/WebElementWrapper.py | def is_on_screen(self):
"""Tests if the element is within the viewport of the screen (partially hidden by overflow will return true)
@return: True if on screen, False otherwise
"""
width = self.get_width()
height = self.get_height()
loc = self.location()
el_x_lef... | def is_on_screen(self):
"""Tests if the element is within the viewport of the screen (partially hidden by overflow will return true)
@return: True if on screen, False otherwise
"""
width = self.get_width()
height = self.get_height()
loc = self.location()
el_x_lef... | [
"Tests",
"if",
"the",
"element",
"is",
"within",
"the",
"viewport",
"of",
"the",
"screen",
"(",
"partially",
"hidden",
"by",
"overflow",
"will",
"return",
"true",
")"
] | Shapeways/coyote_framework | python | https://github.com/Shapeways/coyote_framework/blob/cb29899b984a21d56bf65d0b1d907073948fe16c/coyote_framework/webdriver/webdriverwrapper/WebElementWrapper.py#L230-L251 | [
"def",
"is_on_screen",
"(",
"self",
")",
":",
"width",
"=",
"self",
".",
"get_width",
"(",
")",
"height",
"=",
"self",
".",
"get_height",
"(",
")",
"loc",
"=",
"self",
".",
"location",
"(",
")",
"el_x_left",
"=",
"loc",
"[",
"'x'",
"]",
"el_x_right",... | cb29899b984a21d56bf65d0b1d907073948fe16c |
train | WebElementWrapper.send_special_keys | Send special keys such as <enter> or <delete>
@rtype: WebElementWrapper
@return: Self | coyote_framework/webdriver/webdriverwrapper/WebElementWrapper.py | def send_special_keys(self, value):
"""
Send special keys such as <enter> or <delete>
@rtype: WebElementWrapper
@return: Self
"""
def send_keys_element():
"""
Wrapper to send keys
"""
return self.element.send_keys(va... | def send_special_keys(self, value):
"""
Send special keys such as <enter> or <delete>
@rtype: WebElementWrapper
@return: Self
"""
def send_keys_element():
"""
Wrapper to send keys
"""
return self.element.send_keys(va... | [
"Send",
"special",
"keys",
"such",
"as",
"<enter",
">",
"or",
"<delete",
">"
] | Shapeways/coyote_framework | python | https://github.com/Shapeways/coyote_framework/blob/cb29899b984a21d56bf65d0b1d907073948fe16c/coyote_framework/webdriver/webdriverwrapper/WebElementWrapper.py#L281-L294 | [
"def",
"send_special_keys",
"(",
"self",
",",
"value",
")",
":",
"def",
"send_keys_element",
"(",
")",
":",
"\"\"\"\n Wrapper to send keys\n \"\"\"",
"return",
"self",
".",
"element",
".",
"send_keys",
"(",
"value",
")",
"self",
".",
"execute_a... | cb29899b984a21d56bf65d0b1d907073948fe16c |
train | WebElementWrapper.set | Sets an input with a specified value; if force_set=True, will set through javascript if webdriver fails
NOTE: if val is None, this function will interpret this to be an empty string
@type val: str
@param val: string to send to element
@type force_set: bool
@p... | coyote_framework/webdriver/webdriverwrapper/WebElementWrapper.py | def set(self, val, force_set=False):
"""
Sets an input with a specified value; if force_set=True, will set through javascript if webdriver fails
NOTE: if val is None, this function will interpret this to be an empty string
@type val: str
@param val: string to se... | def set(self, val, force_set=False):
"""
Sets an input with a specified value; if force_set=True, will set through javascript if webdriver fails
NOTE: if val is None, this function will interpret this to be an empty string
@type val: str
@param val: string to se... | [
"Sets",
"an",
"input",
"with",
"a",
"specified",
"value",
";",
"if",
"force_set",
"=",
"True",
"will",
"set",
"through",
"javascript",
"if",
"webdriver",
"fails",
"NOTE",
":",
"if",
"val",
"is",
"None",
"this",
"function",
"will",
"interpret",
"this",
"to"... | Shapeways/coyote_framework | python | https://github.com/Shapeways/coyote_framework/blob/cb29899b984a21d56bf65d0b1d907073948fe16c/coyote_framework/webdriver/webdriverwrapper/WebElementWrapper.py#L311-L347 | [
"def",
"set",
"(",
"self",
",",
"val",
",",
"force_set",
"=",
"False",
")",
":",
"if",
"val",
"is",
"None",
":",
"val",
"=",
"\"\"",
"self",
".",
"click",
"(",
"force_click",
"=",
"True",
"if",
"force_set",
"else",
"False",
")",
"self",
".",
"clear... | cb29899b984a21d56bf65d0b1d907073948fe16c |
train | WebElementWrapper.submit | Submit a webe element
@rtype: WebElementWrapper
@return: Self | coyote_framework/webdriver/webdriverwrapper/WebElementWrapper.py | def submit(self):
"""
Submit a webe element
@rtype: WebElementWrapper
@return: Self
"""
def submit_element():
"""
Wrapper to submit element
"""
return self.element.submit()
self.execute_and_handle_webelement_... | def submit(self):
"""
Submit a webe element
@rtype: WebElementWrapper
@return: Self
"""
def submit_element():
"""
Wrapper to submit element
"""
return self.element.submit()
self.execute_and_handle_webelement_... | [
"Submit",
"a",
"webe",
"element"
] | Shapeways/coyote_framework | python | https://github.com/Shapeways/coyote_framework/blob/cb29899b984a21d56bf65d0b1d907073948fe16c/coyote_framework/webdriver/webdriverwrapper/WebElementWrapper.py#L349-L362 | [
"def",
"submit",
"(",
"self",
")",
":",
"def",
"submit_element",
"(",
")",
":",
"\"\"\"\n Wrapper to submit element\n \"\"\"",
"return",
"self",
".",
"element",
".",
"submit",
"(",
")",
"self",
".",
"execute_and_handle_webelement_exceptions",
"(",
... | cb29899b984a21d56bf65d0b1d907073948fe16c |
train | WebElementWrapper.value_of_css_property | Get value of CSS property for element
@rtype: str
@return: value of CSS property | coyote_framework/webdriver/webdriverwrapper/WebElementWrapper.py | def value_of_css_property(self, property_name):
"""
Get value of CSS property for element
@rtype: str
@return: value of CSS property
"""
def value_of_css_property_element():
"""
Wrapper to get css property
"""
return... | def value_of_css_property(self, property_name):
"""
Get value of CSS property for element
@rtype: str
@return: value of CSS property
"""
def value_of_css_property_element():
"""
Wrapper to get css property
"""
return... | [
"Get",
"value",
"of",
"CSS",
"property",
"for",
"element"
] | Shapeways/coyote_framework | python | https://github.com/Shapeways/coyote_framework/blob/cb29899b984a21d56bf65d0b1d907073948fe16c/coyote_framework/webdriver/webdriverwrapper/WebElementWrapper.py#L364-L377 | [
"def",
"value_of_css_property",
"(",
"self",
",",
"property_name",
")",
":",
"def",
"value_of_css_property_element",
"(",
")",
":",
"\"\"\"\n Wrapper to get css property\n \"\"\"",
"return",
"self",
".",
"element",
".",
"value_of_css_property",
"(",
"p... | cb29899b984a21d56bf65d0b1d907073948fe16c |
train | WebElementWrapper.has_class | Test if an element has a specific classname
@type classname: str
@param classname: Classname to test for; cannot contain spaces
@rtype: bool
@return: True if classname exists; false otherwise | coyote_framework/webdriver/webdriverwrapper/WebElementWrapper.py | def has_class(self, classname):
"""Test if an element has a specific classname
@type classname: str
@param classname: Classname to test for; cannot contain spaces
@rtype: bool
@return: True if classname exists; false otherwise
"""
def element_has_class():
... | def has_class(self, classname):
"""Test if an element has a specific classname
@type classname: str
@param classname: Classname to test for; cannot contain spaces
@rtype: bool
@return: True if classname exists; false otherwise
"""
def element_has_class():
... | [
"Test",
"if",
"an",
"element",
"has",
"a",
"specific",
"classname"
] | Shapeways/coyote_framework | python | https://github.com/Shapeways/coyote_framework/blob/cb29899b984a21d56bf65d0b1d907073948fe16c/coyote_framework/webdriver/webdriverwrapper/WebElementWrapper.py#L379-L400 | [
"def",
"has_class",
"(",
"self",
",",
"classname",
")",
":",
"def",
"element_has_class",
"(",
")",
":",
"\"\"\"Wrapper to test if element has a class\"\"\"",
"pattern",
"=",
"re",
".",
"compile",
"(",
"'(\\s|^){classname}(\\s|$)'",
".",
"format",
"(",
"classname",
"... | cb29899b984a21d56bf65d0b1d907073948fe16c |
train | WebElementWrapper.parent | Get the parent of the element
@rtype: WebElementWrapper
@return: Parent of webelementwrapper on which this was invoked | coyote_framework/webdriver/webdriverwrapper/WebElementWrapper.py | def parent(self):
"""
Get the parent of the element
@rtype: WebElementWrapper
@return: Parent of webelementwrapper on which this was invoked
"""
def parent_element():
"""
Wrapper to retrieve parent element
"""
return... | def parent(self):
"""
Get the parent of the element
@rtype: WebElementWrapper
@return: Parent of webelementwrapper on which this was invoked
"""
def parent_element():
"""
Wrapper to retrieve parent element
"""
return... | [
"Get",
"the",
"parent",
"of",
"the",
"element"
] | Shapeways/coyote_framework | python | https://github.com/Shapeways/coyote_framework/blob/cb29899b984a21d56bf65d0b1d907073948fe16c/coyote_framework/webdriver/webdriverwrapper/WebElementWrapper.py#L431-L443 | [
"def",
"parent",
"(",
"self",
")",
":",
"def",
"parent_element",
"(",
")",
":",
"\"\"\"\n Wrapper to retrieve parent element\n \"\"\"",
"return",
"WebElementWrapper",
"(",
"self",
".",
"driver_wrapper",
",",
"self",
".",
"locator",
",",
"self",
"... | cb29899b984a21d56bf65d0b1d907073948fe16c |
train | WebElementWrapper.parent_element | Get the parent of the element
@rtype: WebElementWrapper
@return: Parent of webelementwrapper on which this was invoked | coyote_framework/webdriver/webdriverwrapper/WebElementWrapper.py | def parent_element(self):
"""
Get the parent of the element
@rtype: WebElementWrapper
@return: Parent of webelementwrapper on which this was invoked
"""
def parent_element():
"""
Wrapper to get parent element
"""
par... | def parent_element(self):
"""
Get the parent of the element
@rtype: WebElementWrapper
@return: Parent of webelementwrapper on which this was invoked
"""
def parent_element():
"""
Wrapper to get parent element
"""
par... | [
"Get",
"the",
"parent",
"of",
"the",
"element"
] | Shapeways/coyote_framework | python | https://github.com/Shapeways/coyote_framework/blob/cb29899b984a21d56bf65d0b1d907073948fe16c/coyote_framework/webdriver/webdriverwrapper/WebElementWrapper.py#L445-L460 | [
"def",
"parent_element",
"(",
"self",
")",
":",
"def",
"parent_element",
"(",
")",
":",
"\"\"\"\n Wrapper to get parent element\n \"\"\"",
"parent",
"=",
"self",
".",
"driver_wrapper",
".",
"execute_script",
"(",
"'return arguments[0].parentNode;'",
",... | cb29899b984a21d56bf65d0b1d907073948fe16c |
train | WebElementWrapper.text | Get the text of the element
@rtype: str
@return: Text of the element | coyote_framework/webdriver/webdriverwrapper/WebElementWrapper.py | def text(self, force_get=False):
"""
Get the text of the element
@rtype: str
@return: Text of the element
"""
def text_element():
"""
Wrapper to get text of element
"""
return self.element.text
def force_tex... | def text(self, force_get=False):
"""
Get the text of the element
@rtype: str
@return: Text of the element
"""
def text_element():
"""
Wrapper to get text of element
"""
return self.element.text
def force_tex... | [
"Get",
"the",
"text",
"of",
"the",
"element"
] | Shapeways/coyote_framework | python | https://github.com/Shapeways/coyote_framework/blob/cb29899b984a21d56bf65d0b1d907073948fe16c/coyote_framework/webdriver/webdriverwrapper/WebElementWrapper.py#L490-L512 | [
"def",
"text",
"(",
"self",
",",
"force_get",
"=",
"False",
")",
":",
"def",
"text_element",
"(",
")",
":",
"\"\"\"\n Wrapper to get text of element\n \"\"\"",
"return",
"self",
".",
"element",
".",
"text",
"def",
"force_text_element",
"(",
")"... | cb29899b984a21d56bf65d0b1d907073948fe16c |
train | WebElementWrapper.highlight | Draws a dotted red box around the wrapped element using javascript
@rtype: WebElementWrapper
@return: Self | coyote_framework/webdriver/webdriverwrapper/WebElementWrapper.py | def highlight(self):
"""
Draws a dotted red box around the wrapped element using javascript
@rtype: WebElementWrapper
@return: Self
"""
js_executor = self.driver_wrapper.js_executor
def highlight_element():
"""
Wrapper to highlight ... | def highlight(self):
"""
Draws a dotted red box around the wrapped element using javascript
@rtype: WebElementWrapper
@return: Self
"""
js_executor = self.driver_wrapper.js_executor
def highlight_element():
"""
Wrapper to highlight ... | [
"Draws",
"a",
"dotted",
"red",
"box",
"around",
"the",
"wrapped",
"element",
"using",
"javascript"
] | Shapeways/coyote_framework | python | https://github.com/Shapeways/coyote_framework/blob/cb29899b984a21d56bf65d0b1d907073948fe16c/coyote_framework/webdriver/webdriverwrapper/WebElementWrapper.py#L514-L535 | [
"def",
"highlight",
"(",
"self",
")",
":",
"js_executor",
"=",
"self",
".",
"driver_wrapper",
".",
"js_executor",
"def",
"highlight_element",
"(",
")",
":",
"\"\"\"\n Wrapper to highlight elements\n \"\"\"",
"location",
"=",
"self",
".",
"element",... | cb29899b984a21d56bf65d0b1d907073948fe16c |
train | WebElementWrapper.set_attribute | Sets the attribute of the element to a specified value
@type name: str
@param name: the name of the attribute
@type value: str
@param value: the attribute of the value | coyote_framework/webdriver/webdriverwrapper/WebElementWrapper.py | def set_attribute(self, name, value):
"""Sets the attribute of the element to a specified value
@type name: str
@param name: the name of the attribute
@type value: str
@param value: the attribute of the value
"""
js_executor = self.driver_wrapper.js_e... | def set_attribute(self, name, value):
"""Sets the attribute of the element to a specified value
@type name: str
@param name: the name of the attribute
@type value: str
@param value: the attribute of the value
"""
js_executor = self.driver_wrapper.js_e... | [
"Sets",
"the",
"attribute",
"of",
"the",
"element",
"to",
"a",
"specified",
"value"
] | Shapeways/coyote_framework | python | https://github.com/Shapeways/coyote_framework/blob/cb29899b984a21d56bf65d0b1d907073948fe16c/coyote_framework/webdriver/webdriverwrapper/WebElementWrapper.py#L537-L556 | [
"def",
"set_attribute",
"(",
"self",
",",
"name",
",",
"value",
")",
":",
"js_executor",
"=",
"self",
".",
"driver_wrapper",
".",
"js_executor",
"def",
"set_attribute_element",
"(",
")",
":",
"\"\"\"\n Wrapper to set attribute\n \"\"\"",
"js_execut... | cb29899b984a21d56bf65d0b1d907073948fe16c |
train | WebElementWrapper.select_option | Selects an option by value, text, or index. You must name the parameter
@type value: str
@param value: the value of the option
@type text: str
@param text: the option's visible text
@type index: int
@param index: the zero-based index of the option
... | coyote_framework/webdriver/webdriverwrapper/WebElementWrapper.py | def select_option(self, value=None, text=None, index=None):
"""
Selects an option by value, text, or index. You must name the parameter
@type value: str
@param value: the value of the option
@type text: str
@param text: the option's visible text
@type... | def select_option(self, value=None, text=None, index=None):
"""
Selects an option by value, text, or index. You must name the parameter
@type value: str
@param value: the value of the option
@type text: str
@param text: the option's visible text
@type... | [
"Selects",
"an",
"option",
"by",
"value",
"text",
"or",
"index",
".",
"You",
"must",
"name",
"the",
"parameter"
] | Shapeways/coyote_framework | python | https://github.com/Shapeways/coyote_framework/blob/cb29899b984a21d56bf65d0b1d907073948fe16c/coyote_framework/webdriver/webdriverwrapper/WebElementWrapper.py#L560-L579 | [
"def",
"select_option",
"(",
"self",
",",
"value",
"=",
"None",
",",
"text",
"=",
"None",
",",
"index",
"=",
"None",
")",
":",
"def",
"do_select",
"(",
")",
":",
"\"\"\"\n Perform selection\n \"\"\"",
"return",
"self",
".",
"set_select",
... | cb29899b984a21d56bf65d0b1d907073948fe16c |
train | WebElementWrapper.deselect_option | De-selects an option by value, text, or index. You must name the parameter
@type value: str
@param value: the value of the option
@type text: str
@param text: the option's visible text
@type index: int
@param index: the zero-based index of the option
... | coyote_framework/webdriver/webdriverwrapper/WebElementWrapper.py | def deselect_option(self, value=None, text=None, index=None):
"""
De-selects an option by value, text, or index. You must name the parameter
@type value: str
@param value: the value of the option
@type text: str
@param text: the option's visible text
... | def deselect_option(self, value=None, text=None, index=None):
"""
De-selects an option by value, text, or index. You must name the parameter
@type value: str
@param value: the value of the option
@type text: str
@param text: the option's visible text
... | [
"De",
"-",
"selects",
"an",
"option",
"by",
"value",
"text",
"or",
"index",
".",
"You",
"must",
"name",
"the",
"parameter"
] | Shapeways/coyote_framework | python | https://github.com/Shapeways/coyote_framework/blob/cb29899b984a21d56bf65d0b1d907073948fe16c/coyote_framework/webdriver/webdriverwrapper/WebElementWrapper.py#L581-L600 | [
"def",
"deselect_option",
"(",
"self",
",",
"value",
"=",
"None",
",",
"text",
"=",
"None",
",",
"index",
"=",
"None",
")",
":",
"def",
"do_deselect",
"(",
")",
":",
"\"\"\"\n Perform selection\n \"\"\"",
"return",
"self",
".",
"set_select"... | cb29899b984a21d56bf65d0b1d907073948fe16c |
train | WebElementWrapper.set_select | Private method used by select methods
@type select_or_deselect: str
@param select_or_deselect: Should I select or deselect the element
@type value: str
@type value: Value to be selected
@type text: str
@type text: ... | coyote_framework/webdriver/webdriverwrapper/WebElementWrapper.py | def set_select(self, select_or_deselect = 'select', value=None, text=None, index=None):
"""
Private method used by select methods
@type select_or_deselect: str
@param select_or_deselect: Should I select or deselect the element
@type value: str
@type val... | def set_select(self, select_or_deselect = 'select', value=None, text=None, index=None):
"""
Private method used by select methods
@type select_or_deselect: str
@param select_or_deselect: Should I select or deselect the element
@type value: str
@type val... | [
"Private",
"method",
"used",
"by",
"select",
"methods"
] | Shapeways/coyote_framework | python | https://github.com/Shapeways/coyote_framework/blob/cb29899b984a21d56bf65d0b1d907073948fe16c/coyote_framework/webdriver/webdriverwrapper/WebElementWrapper.py#L616-L653 | [
"def",
"set_select",
"(",
"self",
",",
"select_or_deselect",
"=",
"'select'",
",",
"value",
"=",
"None",
",",
"text",
"=",
"None",
",",
"index",
"=",
"None",
")",
":",
"# TODO: raise exception if element is not select element",
"if",
"select_or_deselect",
"is",
"'... | cb29899b984a21d56bf65d0b1d907073948fe16c |
train | WebElementWrapper.checkbox_check | Wrapper to check a checkbox | coyote_framework/webdriver/webdriverwrapper/WebElementWrapper.py | def checkbox_check(self, force_check=False):
"""
Wrapper to check a checkbox
"""
if not self.get_attribute('checked'):
self.click(force_click=force_check) | def checkbox_check(self, force_check=False):
"""
Wrapper to check a checkbox
"""
if not self.get_attribute('checked'):
self.click(force_click=force_check) | [
"Wrapper",
"to",
"check",
"a",
"checkbox"
] | Shapeways/coyote_framework | python | https://github.com/Shapeways/coyote_framework/blob/cb29899b984a21d56bf65d0b1d907073948fe16c/coyote_framework/webdriver/webdriverwrapper/WebElementWrapper.py#L655-L660 | [
"def",
"checkbox_check",
"(",
"self",
",",
"force_check",
"=",
"False",
")",
":",
"if",
"not",
"self",
".",
"get_attribute",
"(",
"'checked'",
")",
":",
"self",
".",
"click",
"(",
"force_click",
"=",
"force_check",
")"
] | cb29899b984a21d56bf65d0b1d907073948fe16c |
train | WebElementWrapper.checkbox_uncheck | Wrapper to uncheck a checkbox | coyote_framework/webdriver/webdriverwrapper/WebElementWrapper.py | def checkbox_uncheck(self, force_check=False):
"""
Wrapper to uncheck a checkbox
"""
if self.get_attribute('checked'):
self.click(force_click=force_check) | def checkbox_uncheck(self, force_check=False):
"""
Wrapper to uncheck a checkbox
"""
if self.get_attribute('checked'):
self.click(force_click=force_check) | [
"Wrapper",
"to",
"uncheck",
"a",
"checkbox"
] | Shapeways/coyote_framework | python | https://github.com/Shapeways/coyote_framework/blob/cb29899b984a21d56bf65d0b1d907073948fe16c/coyote_framework/webdriver/webdriverwrapper/WebElementWrapper.py#L662-L667 | [
"def",
"checkbox_uncheck",
"(",
"self",
",",
"force_check",
"=",
"False",
")",
":",
"if",
"self",
".",
"get_attribute",
"(",
"'checked'",
")",
":",
"self",
".",
"click",
"(",
"force_click",
"=",
"force_check",
")"
] | cb29899b984a21d56bf65d0b1d907073948fe16c |
train | WebElementWrapper.hover | Hovers the element | coyote_framework/webdriver/webdriverwrapper/WebElementWrapper.py | def hover(self):
"""
Hovers the element
"""
def do_hover():
"""
Perform hover
"""
ActionChains(self.driver_wrapper.driver).move_to_element(self.element).perform()
return self.execute_and_handle_webelement_exceptions(do_hover, 'hover... | def hover(self):
"""
Hovers the element
"""
def do_hover():
"""
Perform hover
"""
ActionChains(self.driver_wrapper.driver).move_to_element(self.element).perform()
return self.execute_and_handle_webelement_exceptions(do_hover, 'hover... | [
"Hovers",
"the",
"element"
] | Shapeways/coyote_framework | python | https://github.com/Shapeways/coyote_framework/blob/cb29899b984a21d56bf65d0b1d907073948fe16c/coyote_framework/webdriver/webdriverwrapper/WebElementWrapper.py#L677-L686 | [
"def",
"hover",
"(",
"self",
")",
":",
"def",
"do_hover",
"(",
")",
":",
"\"\"\"\n Perform hover\n \"\"\"",
"ActionChains",
"(",
"self",
".",
"driver_wrapper",
".",
"driver",
")",
".",
"move_to_element",
"(",
"self",
".",
"element",
")",
".... | cb29899b984a21d56bf65d0b1d907073948fe16c |
train | WebElementWrapper.find | Find wrapper, invokes webDriverWrapper find with the current element as the search object
@type locator: webdriverwrapper.support.locator.Locator
@param locator: locator used in search
@type find_all: bool
@param find_all: should I find all elements, or j... | coyote_framework/webdriver/webdriverwrapper/WebElementWrapper.py | def find(self, locator, find_all=False, search_object=None, exclude_invisible=None, *args, **kwargs):
"""
Find wrapper, invokes webDriverWrapper find with the current element as the search object
@type locator: webdriverwrapper.support.locator.Locator
@param locator: lo... | def find(self, locator, find_all=False, search_object=None, exclude_invisible=None, *args, **kwargs):
"""
Find wrapper, invokes webDriverWrapper find with the current element as the search object
@type locator: webdriverwrapper.support.locator.Locator
@param locator: lo... | [
"Find",
"wrapper",
"invokes",
"webDriverWrapper",
"find",
"with",
"the",
"current",
"element",
"as",
"the",
"search",
"object"
] | Shapeways/coyote_framework | python | https://github.com/Shapeways/coyote_framework/blob/cb29899b984a21d56bf65d0b1d907073948fe16c/coyote_framework/webdriver/webdriverwrapper/WebElementWrapper.py#L688-L708 | [
"def",
"find",
"(",
"self",
",",
"locator",
",",
"find_all",
"=",
"False",
",",
"search_object",
"=",
"None",
",",
"exclude_invisible",
"=",
"None",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"search_object",
"=",
"self",
".",
"element",
"if"... | cb29899b984a21d56bf65d0b1d907073948fe16c |
train | WebElementWrapper.find_once | Find wrapper to run a single find
@type locator: webdriverwrapper.support.locator.Locator
@param locator: locator used in search
@type find_all: bool
@param find_all: should I find all elements, or just one?
@rtype: WebElementWrap... | coyote_framework/webdriver/webdriverwrapper/WebElementWrapper.py | def find_once(self, locator):
"""
Find wrapper to run a single find
@type locator: webdriverwrapper.support.locator.Locator
@param locator: locator used in search
@type find_all: bool
@param find_all: should I find all elements, or just on... | def find_once(self, locator):
"""
Find wrapper to run a single find
@type locator: webdriverwrapper.support.locator.Locator
@param locator: locator used in search
@type find_all: bool
@param find_all: should I find all elements, or just on... | [
"Find",
"wrapper",
"to",
"run",
"a",
"single",
"find"
] | Shapeways/coyote_framework | python | https://github.com/Shapeways/coyote_framework/blob/cb29899b984a21d56bf65d0b1d907073948fe16c/coyote_framework/webdriver/webdriverwrapper/WebElementWrapper.py#L710-L735 | [
"def",
"find_once",
"(",
"self",
",",
"locator",
")",
":",
"params",
"=",
"[",
"]",
"params",
".",
"append",
"(",
"self",
".",
"driver_wrapper",
".",
"find_attempts",
")",
"params",
".",
"append",
"(",
"self",
".",
"driver_wrapper",
".",
"implicit_wait",
... | cb29899b984a21d56bf65d0b1d907073948fe16c |
train | WebElementWrapper.find_all | Find wrapper, finds all elements
@type locator: webdriverwrapper.support.locator.Locator
@param locator: locator used in search
@rtype: list
@return: A list of WebElementWrappers | coyote_framework/webdriver/webdriverwrapper/WebElementWrapper.py | def find_all(self, locator):
"""
Find wrapper, finds all elements
@type locator: webdriverwrapper.support.locator.Locator
@param locator: locator used in search
@rtype: list
@return: A list of WebElementWrappers
""... | def find_all(self, locator):
"""
Find wrapper, finds all elements
@type locator: webdriverwrapper.support.locator.Locator
@param locator: locator used in search
@rtype: list
@return: A list of WebElementWrappers
""... | [
"Find",
"wrapper",
"finds",
"all",
"elements"
] | Shapeways/coyote_framework | python | https://github.com/Shapeways/coyote_framework/blob/cb29899b984a21d56bf65d0b1d907073948fe16c/coyote_framework/webdriver/webdriverwrapper/WebElementWrapper.py#L737-L747 | [
"def",
"find_all",
"(",
"self",
",",
"locator",
")",
":",
"return",
"self",
".",
"driver_wrapper",
".",
"find",
"(",
"locator",
",",
"True",
",",
"self",
".",
"element",
")"
] | cb29899b984a21d56bf65d0b1d907073948fe16c |
train | WebElementWrapper.is_present | Tests to see if an element is present
@type locator: webdriverwrapper.support.locator.Locator
@param locator: locator used in search
@rtype: bool
@return: True if present, False if not present | coyote_framework/webdriver/webdriverwrapper/WebElementWrapper.py | def is_present(self, locator):
"""
Tests to see if an element is present
@type locator: webdriverwrapper.support.locator.Locator
@param locator: locator used in search
@rtype: bool
@return: True if present, False if not pr... | def is_present(self, locator):
"""
Tests to see if an element is present
@type locator: webdriverwrapper.support.locator.Locator
@param locator: locator used in search
@rtype: bool
@return: True if present, False if not pr... | [
"Tests",
"to",
"see",
"if",
"an",
"element",
"is",
"present"
] | Shapeways/coyote_framework | python | https://github.com/Shapeways/coyote_framework/blob/cb29899b984a21d56bf65d0b1d907073948fe16c/coyote_framework/webdriver/webdriverwrapper/WebElementWrapper.py#L749-L759 | [
"def",
"is_present",
"(",
"self",
",",
"locator",
")",
":",
"return",
"self",
".",
"driver_wrapper",
".",
"is_present",
"(",
"locator",
",",
"search_object",
"=",
"self",
".",
"element",
")"
] | cb29899b984a21d56bf65d0b1d907073948fe16c |
train | WebElementWrapper.wait_until_stale | Waits for the element to go stale in the DOM
@type timeout: int
@param timeout: override for default timeout
@rtype: WebElementWrapper
@return: Self | coyote_framework/webdriver/webdriverwrapper/WebElementWrapper.py | def wait_until_stale(self, timeout=None):
"""
Waits for the element to go stale in the DOM
@type timeout: int
@param timeout: override for default timeout
@rtype: WebElementWrapper
@return: Self
"""
timeout... | def wait_until_stale(self, timeout=None):
"""
Waits for the element to go stale in the DOM
@type timeout: int
@param timeout: override for default timeout
@rtype: WebElementWrapper
@return: Self
"""
timeout... | [
"Waits",
"for",
"the",
"element",
"to",
"go",
"stale",
"in",
"the",
"DOM"
] | Shapeways/coyote_framework | python | https://github.com/Shapeways/coyote_framework/blob/cb29899b984a21d56bf65d0b1d907073948fe16c/coyote_framework/webdriver/webdriverwrapper/WebElementWrapper.py#L774-L793 | [
"def",
"wait_until_stale",
"(",
"self",
",",
"timeout",
"=",
"None",
")",
":",
"timeout",
"=",
"timeout",
"if",
"timeout",
"is",
"not",
"None",
"else",
"self",
".",
"driver_wrapper",
".",
"timeout",
"def",
"wait",
"(",
")",
":",
"\"\"\"\n Wrapper ... | cb29899b984a21d56bf65d0b1d907073948fe16c |
train | WebElementWrapper.execute_and_handle_webelement_exceptions | Private method to be called by other methods to handle common WebDriverExceptions or throw
a custom exception
@type function_to_execute: types.FunctionType
@param function_to_execute: A function containing some webdriver calls
@type name_of_action: str
@param ... | coyote_framework/webdriver/webdriverwrapper/WebElementWrapper.py | def execute_and_handle_webelement_exceptions(self, function_to_execute, name_of_action):
"""
Private method to be called by other methods to handle common WebDriverExceptions or throw
a custom exception
@type function_to_execute: types.FunctionType
@param function_to_execut... | def execute_and_handle_webelement_exceptions(self, function_to_execute, name_of_action):
"""
Private method to be called by other methods to handle common WebDriverExceptions or throw
a custom exception
@type function_to_execute: types.FunctionType
@param function_to_execut... | [
"Private",
"method",
"to",
"be",
"called",
"by",
"other",
"methods",
"to",
"handle",
"common",
"WebDriverExceptions",
"or",
"throw",
"a",
"custom",
"exception"
] | Shapeways/coyote_framework | python | https://github.com/Shapeways/coyote_framework/blob/cb29899b984a21d56bf65d0b1d907073948fe16c/coyote_framework/webdriver/webdriverwrapper/WebElementWrapper.py#L795-L850 | [
"def",
"execute_and_handle_webelement_exceptions",
"(",
"self",
",",
"function_to_execute",
",",
"name_of_action",
")",
":",
"if",
"self",
".",
"element",
"is",
"not",
"None",
":",
"attempts",
"=",
"0",
"while",
"attempts",
"<",
"self",
".",
"driver_wrapper",
".... | cb29899b984a21d56bf65d0b1d907073948fe16c |
train | RequestDriver.request | Makes a request using requests
@param uri: The uri to send request
@param method: Method to use to send request
@param headers: Any headers to send with request
@param cookies: Request cookies (in addition to session cookies)
@param params: Request parameters
@param data... | coyote_framework/requests/requestdriver.py | def request(self, uri, method=GET, headers=None, cookies=None, params=None, data=None, post_files=None,**kwargs):
"""Makes a request using requests
@param uri: The uri to send request
@param method: Method to use to send request
@param headers: Any headers to send with request
@... | def request(self, uri, method=GET, headers=None, cookies=None, params=None, data=None, post_files=None,**kwargs):
"""Makes a request using requests
@param uri: The uri to send request
@param method: Method to use to send request
@param headers: Any headers to send with request
@... | [
"Makes",
"a",
"request",
"using",
"requests"
] | Shapeways/coyote_framework | python | https://github.com/Shapeways/coyote_framework/blob/cb29899b984a21d56bf65d0b1d907073948fe16c/coyote_framework/requests/requestdriver.py#L34-L80 | [
"def",
"request",
"(",
"self",
",",
"uri",
",",
"method",
"=",
"GET",
",",
"headers",
"=",
"None",
",",
"cookies",
"=",
"None",
",",
"params",
"=",
"None",
",",
"data",
"=",
"None",
",",
"post_files",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":... | cb29899b984a21d56bf65d0b1d907073948fe16c |
train | RequestDriver.save_last_response_to_file | Saves the body of the last response to a file
@param filename: Filename to save to
@return: Returns False if there is an OS error, True if successful | coyote_framework/requests/requestdriver.py | def save_last_response_to_file(self, filename):
"""Saves the body of the last response to a file
@param filename: Filename to save to
@return: Returns False if there is an OS error, True if successful
"""
response = self.get_last_response()
return self.save_response_to_f... | def save_last_response_to_file(self, filename):
"""Saves the body of the last response to a file
@param filename: Filename to save to
@return: Returns False if there is an OS error, True if successful
"""
response = self.get_last_response()
return self.save_response_to_f... | [
"Saves",
"the",
"body",
"of",
"the",
"last",
"response",
"to",
"a",
"file"
] | Shapeways/coyote_framework | python | https://github.com/Shapeways/coyote_framework/blob/cb29899b984a21d56bf65d0b1d907073948fe16c/coyote_framework/requests/requestdriver.py#L96-L103 | [
"def",
"save_last_response_to_file",
"(",
"self",
",",
"filename",
")",
":",
"response",
"=",
"self",
".",
"get_last_response",
"(",
")",
"return",
"self",
".",
"save_response_to_file",
"(",
"response",
",",
"filename",
")"
] | cb29899b984a21d56bf65d0b1d907073948fe16c |
train | RequestDriver.save_response_to_file | Saves the body of the last response to a file
@param filename: Filename to save to
@return: Returns False if there is an OS error, True if successful | coyote_framework/requests/requestdriver.py | def save_response_to_file(self, response, filename):
"""Saves the body of the last response to a file
@param filename: Filename to save to
@return: Returns False if there is an OS error, True if successful
"""
try:
last_response = self.get_last_response()
... | def save_response_to_file(self, response, filename):
"""Saves the body of the last response to a file
@param filename: Filename to save to
@return: Returns False if there is an OS error, True if successful
"""
try:
last_response = self.get_last_response()
... | [
"Saves",
"the",
"body",
"of",
"the",
"last",
"response",
"to",
"a",
"file"
] | Shapeways/coyote_framework | python | https://github.com/Shapeways/coyote_framework/blob/cb29899b984a21d56bf65d0b1d907073948fe16c/coyote_framework/requests/requestdriver.py#L105-L117 | [
"def",
"save_response_to_file",
"(",
"self",
",",
"response",
",",
"filename",
")",
":",
"try",
":",
"last_response",
"=",
"self",
".",
"get_last_response",
"(",
")",
"with",
"open",
"(",
"filename",
",",
"'w'",
")",
"as",
"f",
":",
"f",
".",
"write",
... | cb29899b984a21d56bf65d0b1d907073948fe16c |
train | validate_url | Validates that the url can be opened and responds with an allowed response code; ignores javascript: urls
url -- the string url to ping
allowed_response_codes -- a list of response codes that the validator will ignore | coyote_framework/mixins/URLValidator.py | def validate_url(url, allowed_response_codes=None):
"""Validates that the url can be opened and responds with an allowed response code; ignores javascript: urls
url -- the string url to ping
allowed_response_codes -- a list of response codes that the validator will ignore
"""
allowed_response_codes... | def validate_url(url, allowed_response_codes=None):
"""Validates that the url can be opened and responds with an allowed response code; ignores javascript: urls
url -- the string url to ping
allowed_response_codes -- a list of response codes that the validator will ignore
"""
allowed_response_codes... | [
"Validates",
"that",
"the",
"url",
"can",
"be",
"opened",
"and",
"responds",
"with",
"an",
"allowed",
"response",
"code",
";",
"ignores",
"javascript",
":",
"urls"
] | Shapeways/coyote_framework | python | https://github.com/Shapeways/coyote_framework/blob/cb29899b984a21d56bf65d0b1d907073948fe16c/coyote_framework/mixins/URLValidator.py#L6-L26 | [
"def",
"validate_url",
"(",
"url",
",",
"allowed_response_codes",
"=",
"None",
")",
":",
"allowed_response_codes",
"=",
"[",
"200",
"]",
"if",
"allowed_response_codes",
"is",
"None",
"else",
"allowed_response_codes",
"# link calls a js function, do not try to open",
"if",... | cb29899b984a21d56bf65d0b1d907073948fe16c |
train | validate_urls | Validates that a list of urls can be opened and each responds with an allowed response code
urls -- the list of urls to ping
allowed_response_codes -- a list of response codes that the validator will ignore | coyote_framework/mixins/URLValidator.py | def validate_urls(urls, allowed_response_codes=None):
"""Validates that a list of urls can be opened and each responds with an allowed response code
urls -- the list of urls to ping
allowed_response_codes -- a list of response codes that the validator will ignore
"""
for url in urls:
valid... | def validate_urls(urls, allowed_response_codes=None):
"""Validates that a list of urls can be opened and each responds with an allowed response code
urls -- the list of urls to ping
allowed_response_codes -- a list of response codes that the validator will ignore
"""
for url in urls:
valid... | [
"Validates",
"that",
"a",
"list",
"of",
"urls",
"can",
"be",
"opened",
"and",
"each",
"responds",
"with",
"an",
"allowed",
"response",
"code"
] | Shapeways/coyote_framework | python | https://github.com/Shapeways/coyote_framework/blob/cb29899b984a21d56bf65d0b1d907073948fe16c/coyote_framework/mixins/URLValidator.py#L29-L38 | [
"def",
"validate_urls",
"(",
"urls",
",",
"allowed_response_codes",
"=",
"None",
")",
":",
"for",
"url",
"in",
"urls",
":",
"validate_url",
"(",
"url",
",",
"allowed_response_codes",
"=",
"allowed_response_codes",
")",
"return",
"True"
] | cb29899b984a21d56bf65d0b1d907073948fe16c |
train | DriverFactory.new_driver | Instantiates a new WebDriver instance, determining class by environment variables | coyote_framework/webdriver/webdriver/driverfactory.py | def new_driver(browser_name, *args, **kwargs):
"""Instantiates a new WebDriver instance, determining class by environment variables
"""
if browser_name == FIREFOX:
return webdriver.Firefox(*args, **kwargs)
# elif options['local'] and options['browser_name'] == CHROME:
... | def new_driver(browser_name, *args, **kwargs):
"""Instantiates a new WebDriver instance, determining class by environment variables
"""
if browser_name == FIREFOX:
return webdriver.Firefox(*args, **kwargs)
# elif options['local'] and options['browser_name'] == CHROME:
... | [
"Instantiates",
"a",
"new",
"WebDriver",
"instance",
"determining",
"class",
"by",
"environment",
"variables"
] | Shapeways/coyote_framework | python | https://github.com/Shapeways/coyote_framework/blob/cb29899b984a21d56bf65d0b1d907073948fe16c/coyote_framework/webdriver/webdriver/driverfactory.py#L16-L39 | [
"def",
"new_driver",
"(",
"browser_name",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"browser_name",
"==",
"FIREFOX",
":",
"return",
"webdriver",
".",
"Firefox",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
"# elif options['local'] and o... | cb29899b984a21d56bf65d0b1d907073948fe16c |
train | ExampleUrlBuilder.build_follow_url | Build a URL for the /follow page | example/example_app/utility/urlbuilder.py | def build_follow_url(host=None, **params):
"""
Build a URL for the /follow page
"""
# template = '?{params}'
config = ExampleConfig()
template = '/follow?{params}'
if not host:
host = config.get('example_web_hostname')
return ExampleUrlBuild... | def build_follow_url(host=None, **params):
"""
Build a URL for the /follow page
"""
# template = '?{params}'
config = ExampleConfig()
template = '/follow?{params}'
if not host:
host = config.get('example_web_hostname')
return ExampleUrlBuild... | [
"Build",
"a",
"URL",
"for",
"the",
"/",
"follow",
"page"
] | Shapeways/coyote_framework | python | https://github.com/Shapeways/coyote_framework/blob/cb29899b984a21d56bf65d0b1d907073948fe16c/example/example_app/utility/urlbuilder.py#L14-L30 | [
"def",
"build_follow_url",
"(",
"host",
"=",
"None",
",",
"*",
"*",
"params",
")",
":",
"# template = '?{params}'",
"config",
"=",
"ExampleConfig",
"(",
")",
"template",
"=",
"'/follow?{params}'",
"if",
"not",
"host",
":",
"host",
"=",
"config",
".",
"get",
... | cb29899b984a21d56bf65d0b1d907073948fe16c |
train | encode_collection | Encodes all the string keys and values in a collection with specified encoding | coyote_framework/mixins/stringconversion.py | def encode_collection(collection, encoding='utf-8'):
"""Encodes all the string keys and values in a collection with specified encoding"""
if isinstance(collection, dict):
return dict((encode_collection(key), encode_collection(value)) for key, value in collection.iteritems())
elif isinstance(collect... | def encode_collection(collection, encoding='utf-8'):
"""Encodes all the string keys and values in a collection with specified encoding"""
if isinstance(collection, dict):
return dict((encode_collection(key), encode_collection(value)) for key, value in collection.iteritems())
elif isinstance(collect... | [
"Encodes",
"all",
"the",
"string",
"keys",
"and",
"values",
"in",
"a",
"collection",
"with",
"specified",
"encoding"
] | Shapeways/coyote_framework | python | https://github.com/Shapeways/coyote_framework/blob/cb29899b984a21d56bf65d0b1d907073948fe16c/coyote_framework/mixins/stringconversion.py#L4-L14 | [
"def",
"encode_collection",
"(",
"collection",
",",
"encoding",
"=",
"'utf-8'",
")",
":",
"if",
"isinstance",
"(",
"collection",
",",
"dict",
")",
":",
"return",
"dict",
"(",
"(",
"encode_collection",
"(",
"key",
")",
",",
"encode_collection",
"(",
"value",
... | cb29899b984a21d56bf65d0b1d907073948fe16c |
train | get_delimited_string_from_list | Given a list, returns a string representation of that list with specified delimiter and optional string chars
_list -- the list or tuple to stringify
delimiter -- the the character to seperate all values
wrap_values_with_char -- if specified, will wrap all values in list with this character in the represen... | coyote_framework/mixins/stringconversion.py | def get_delimited_string_from_list(_list, delimiter=', ', wrap_values_with_char=None, wrap_strings_with_char=None):
"""Given a list, returns a string representation of that list with specified delimiter and optional string chars
_list -- the list or tuple to stringify
delimiter -- the the character to sepe... | def get_delimited_string_from_list(_list, delimiter=', ', wrap_values_with_char=None, wrap_strings_with_char=None):
"""Given a list, returns a string representation of that list with specified delimiter and optional string chars
_list -- the list or tuple to stringify
delimiter -- the the character to sepe... | [
"Given",
"a",
"list",
"returns",
"a",
"string",
"representation",
"of",
"that",
"list",
"with",
"specified",
"delimiter",
"and",
"optional",
"string",
"chars"
] | Shapeways/coyote_framework | python | https://github.com/Shapeways/coyote_framework/blob/cb29899b984a21d56bf65d0b1d907073948fe16c/coyote_framework/mixins/stringconversion.py#L17-L37 | [
"def",
"get_delimited_string_from_list",
"(",
"_list",
",",
"delimiter",
"=",
"', '",
",",
"wrap_values_with_char",
"=",
"None",
",",
"wrap_strings_with_char",
"=",
"None",
")",
":",
"if",
"wrap_values_with_char",
"is",
"not",
"None",
":",
"return",
"delimiter",
"... | cb29899b984a21d56bf65d0b1d907073948fe16c |
train | JavascriptExecutor.execute_script | Execute script passed in to function
@type string: str
@value string: Script to execute
@type args: dict
@value args: Dictionary representing command line args
@rtype: int
@rtype: response code | coyote_framework/webdriver/webdriverwrapper/support/JavascriptExecutor.py | def execute_script(self, string, args=None):
"""
Execute script passed in to function
@type string: str
@value string: Script to execute
@type args: dict
@value args: Dictionary representing command line args
@rtype: int
@rtype: ... | def execute_script(self, string, args=None):
"""
Execute script passed in to function
@type string: str
@value string: Script to execute
@type args: dict
@value args: Dictionary representing command line args
@rtype: int
@rtype: ... | [
"Execute",
"script",
"passed",
"in",
"to",
"function"
] | Shapeways/coyote_framework | python | https://github.com/Shapeways/coyote_framework/blob/cb29899b984a21d56bf65d0b1d907073948fe16c/coyote_framework/webdriver/webdriverwrapper/support/JavascriptExecutor.py#L21-L44 | [
"def",
"execute_script",
"(",
"self",
",",
"string",
",",
"args",
"=",
"None",
")",
":",
"result",
"=",
"None",
"try",
":",
"result",
"=",
"self",
".",
"driver_wrapper",
".",
"driver",
".",
"execute_script",
"(",
"string",
",",
"args",
")",
"return",
"... | cb29899b984a21d56bf65d0b1d907073948fe16c |
train | JavascriptExecutor.execute_template | Execute script from a template
@type template_name: str
@value template_name: Script template to implement
@type args: dict
@value args: Dictionary representing command line args
@rtype: bool
@rtype: Success or... | coyote_framework/webdriver/webdriverwrapper/support/JavascriptExecutor.py | def execute_template(self, template_name, variables, args=None):
"""
Execute script from a template
@type template_name: str
@value template_name: Script template to implement
@type args: dict
@value args: Dictionary representing command line ... | def execute_template(self, template_name, variables, args=None):
"""
Execute script from a template
@type template_name: str
@value template_name: Script template to implement
@type args: dict
@value args: Dictionary representing command line ... | [
"Execute",
"script",
"from",
"a",
"template"
] | Shapeways/coyote_framework | python | https://github.com/Shapeways/coyote_framework/blob/cb29899b984a21d56bf65d0b1d907073948fe16c/coyote_framework/webdriver/webdriverwrapper/support/JavascriptExecutor.py#L46-L63 | [
"def",
"execute_template",
"(",
"self",
",",
"template_name",
",",
"variables",
",",
"args",
"=",
"None",
")",
":",
"js_text",
"=",
"self",
".",
"build_js_from_template",
"(",
"template_name",
",",
"variables",
")",
"try",
":",
"self",
".",
"execute_script",
... | cb29899b984a21d56bf65d0b1d907073948fe16c |
train | JavascriptExecutor.execute_template_and_return_result | Execute script from a template and return result
@type template_name: str
@value template_name: Script template to implement
@type variables: dict
@value variables: Dictionary representing template construction args
@type args: dict
@value a... | coyote_framework/webdriver/webdriverwrapper/support/JavascriptExecutor.py | def execute_template_and_return_result(self, template_name, variables, args=None):
"""
Execute script from a template and return result
@type template_name: str
@value template_name: Script template to implement
@type variables: dict
@value variables: D... | def execute_template_and_return_result(self, template_name, variables, args=None):
"""
Execute script from a template and return result
@type template_name: str
@value template_name: Script template to implement
@type variables: dict
@value variables: D... | [
"Execute",
"script",
"from",
"a",
"template",
"and",
"return",
"result"
] | Shapeways/coyote_framework | python | https://github.com/Shapeways/coyote_framework/blob/cb29899b984a21d56bf65d0b1d907073948fe16c/coyote_framework/webdriver/webdriverwrapper/support/JavascriptExecutor.py#L65-L80 | [
"def",
"execute_template_and_return_result",
"(",
"self",
",",
"template_name",
",",
"variables",
",",
"args",
"=",
"None",
")",
":",
"js_text",
"=",
"self",
".",
"build_js_from_template",
"(",
"template_name",
",",
"variables",
")",
"return",
"self",
".",
"exec... | cb29899b984a21d56bf65d0b1d907073948fe16c |
train | JavascriptExecutor.build_js_from_template | Build a JS script from a template and args
@type template_file: str
@param template_file: Script template to implement; can be the name of a built-in script or full filepath to
a js file that contains the script. E.g. 'clickElementTemplate.js',
... | coyote_framework/webdriver/webdriverwrapper/support/JavascriptExecutor.py | def build_js_from_template(self, template_file, variables):
"""
Build a JS script from a template and args
@type template_file: str
@param template_file: Script template to implement; can be the name of a built-in script or full filepath to
a js file... | def build_js_from_template(self, template_file, variables):
"""
Build a JS script from a template and args
@type template_file: str
@param template_file: Script template to implement; can be the name of a built-in script or full filepath to
a js file... | [
"Build",
"a",
"JS",
"script",
"from",
"a",
"template",
"and",
"args"
] | Shapeways/coyote_framework | python | https://github.com/Shapeways/coyote_framework/blob/cb29899b984a21d56bf65d0b1d907073948fe16c/coyote_framework/webdriver/webdriverwrapper/support/JavascriptExecutor.py#L82-L136 | [
"def",
"build_js_from_template",
"(",
"self",
",",
"template_file",
",",
"variables",
")",
":",
"template_variable_character",
"=",
"'%'",
"# raise an exception if user passed non-dictionary variables",
"if",
"not",
"isinstance",
"(",
"variables",
",",
"dict",
")",
":",
... | cb29899b984a21d56bf65d0b1d907073948fe16c |
train | UrlBuilder.build | Builds a url with a string template and template variables; relative path if host is None, abs otherwise:
template format: "/staticendpoint/{dynamic_endpoint}?{params}" | coyote_framework/util/urls/urlbuilder.py | def build(template='/', host=None, scheme=None, port=None, **template_vars):
"""Builds a url with a string template and template variables; relative path if host is None, abs otherwise:
template format: "/staticendpoint/{dynamic_endpoint}?{params}"
"""
# TODO: refactor to build_absol... | def build(template='/', host=None, scheme=None, port=None, **template_vars):
"""Builds a url with a string template and template variables; relative path if host is None, abs otherwise:
template format: "/staticendpoint/{dynamic_endpoint}?{params}"
"""
# TODO: refactor to build_absol... | [
"Builds",
"a",
"url",
"with",
"a",
"string",
"template",
"and",
"template",
"variables",
";",
"relative",
"path",
"if",
"host",
"is",
"None",
"abs",
"otherwise",
":",
"template",
"format",
":",
"/",
"staticendpoint",
"/",
"{",
"dynamic_endpoint",
"}",
"?",
... | Shapeways/coyote_framework | python | https://github.com/Shapeways/coyote_framework/blob/cb29899b984a21d56bf65d0b1d907073948fe16c/coyote_framework/util/urls/urlbuilder.py#L13-L45 | [
"def",
"build",
"(",
"template",
"=",
"'/'",
",",
"host",
"=",
"None",
",",
"scheme",
"=",
"None",
",",
"port",
"=",
"None",
",",
"*",
"*",
"template_vars",
")",
":",
"# TODO: refactor to build_absolute and build_relative instead of handling based on params",
"parse... | cb29899b984a21d56bf65d0b1d907073948fe16c |
train | poll | Calls the function until bool(return value) is truthy
@param step: Wait time between each function call
@param timeout: Max amount of time that will elapse. If the function is in progress when timeout has passed, the
function will be allowed to complete.
@type ignore_exceptions: tuple
@param ignore... | coyote_framework/util/apps/polling/polling.py | def poll(function, step=0.5, timeout=3, ignore_exceptions=(), exception_message='', message_builder=None,
args=(), kwargs=None, ontimeout=()):
"""Calls the function until bool(return value) is truthy
@param step: Wait time between each function call
@param timeout: Max amount of time that will ela... | def poll(function, step=0.5, timeout=3, ignore_exceptions=(), exception_message='', message_builder=None,
args=(), kwargs=None, ontimeout=()):
"""Calls the function until bool(return value) is truthy
@param step: Wait time between each function call
@param timeout: Max amount of time that will ela... | [
"Calls",
"the",
"function",
"until",
"bool",
"(",
"return",
"value",
")",
"is",
"truthy"
] | Shapeways/coyote_framework | python | https://github.com/Shapeways/coyote_framework/blob/cb29899b984a21d56bf65d0b1d907073948fe16c/coyote_framework/util/apps/polling/polling.py#L6-L50 | [
"def",
"poll",
"(",
"function",
",",
"step",
"=",
"0.5",
",",
"timeout",
"=",
"3",
",",
"ignore_exceptions",
"=",
"(",
")",
",",
"exception_message",
"=",
"''",
",",
"message_builder",
"=",
"None",
",",
"args",
"=",
"(",
")",
",",
"kwargs",
"=",
"Non... | cb29899b984a21d56bf65d0b1d907073948fe16c |
train | Locator.build | Formats the locator with specified parameters | coyote_framework/webdriver/webdriverwrapper/support/locator.py | def build(self, **variables):
"""Formats the locator with specified parameters"""
return Locator(self.by, self.locator.format(**variables), self.description) | def build(self, **variables):
"""Formats the locator with specified parameters"""
return Locator(self.by, self.locator.format(**variables), self.description) | [
"Formats",
"the",
"locator",
"with",
"specified",
"parameters"
] | Shapeways/coyote_framework | python | https://github.com/Shapeways/coyote_framework/blob/cb29899b984a21d56bf65d0b1d907073948fe16c/coyote_framework/webdriver/webdriverwrapper/support/locator.py#L32-L34 | [
"def",
"build",
"(",
"self",
",",
"*",
"*",
"variables",
")",
":",
"return",
"Locator",
"(",
"self",
".",
"by",
",",
"self",
".",
"locator",
".",
"format",
"(",
"*",
"*",
"variables",
")",
",",
"self",
".",
"description",
")"
] | cb29899b984a21d56bf65d0b1d907073948fe16c |
train | random_words_string | Gets a | coyote_framework/util/apps/randomwords/words.py | def random_words_string(count=1, maxchars=None, sep=''):
"""Gets a
"""
nouns = sep.join([random_word() for x in xrange(0, count)])
if maxchars is not None and nouns > maxchars:
nouns = nouns[0:maxchars-1]
return nouns | def random_words_string(count=1, maxchars=None, sep=''):
"""Gets a
"""
nouns = sep.join([random_word() for x in xrange(0, count)])
if maxchars is not None and nouns > maxchars:
nouns = nouns[0:maxchars-1]
return nouns | [
"Gets",
"a"
] | Shapeways/coyote_framework | python | https://github.com/Shapeways/coyote_framework/blob/cb29899b984a21d56bf65d0b1d907073948fe16c/coyote_framework/util/apps/randomwords/words.py#L25-L33 | [
"def",
"random_words_string",
"(",
"count",
"=",
"1",
",",
"maxchars",
"=",
"None",
",",
"sep",
"=",
"''",
")",
":",
"nouns",
"=",
"sep",
".",
"join",
"(",
"[",
"random_word",
"(",
")",
"for",
"x",
"in",
"xrange",
"(",
"0",
",",
"count",
")",
"]"... | cb29899b984a21d56bf65d0b1d907073948fe16c |
train | is_subdomain | Tests if a hostname is a subdomain of a reference hostname
e.g. www.domain.com is subdomain of reference
@param domain: Domain to test if it is a subdomain
@param reference: Reference "parent" domain | coyote_framework/util/apps/driver_interop/drivercookies.py | def is_subdomain(domain, reference):
"""Tests if a hostname is a subdomain of a reference hostname
e.g. www.domain.com is subdomain of reference
@param domain: Domain to test if it is a subdomain
@param reference: Reference "parent" domain
"""
index_of_reference = domain.find(reference)
if ... | def is_subdomain(domain, reference):
"""Tests if a hostname is a subdomain of a reference hostname
e.g. www.domain.com is subdomain of reference
@param domain: Domain to test if it is a subdomain
@param reference: Reference "parent" domain
"""
index_of_reference = domain.find(reference)
if ... | [
"Tests",
"if",
"a",
"hostname",
"is",
"a",
"subdomain",
"of",
"a",
"reference",
"hostname",
"e",
".",
"g",
".",
"www",
".",
"domain",
".",
"com",
"is",
"subdomain",
"of",
"reference"
] | Shapeways/coyote_framework | python | https://github.com/Shapeways/coyote_framework/blob/cb29899b984a21d56bf65d0b1d907073948fe16c/coyote_framework/util/apps/driver_interop/drivercookies.py#L7-L17 | [
"def",
"is_subdomain",
"(",
"domain",
",",
"reference",
")",
":",
"index_of_reference",
"=",
"domain",
".",
"find",
"(",
"reference",
")",
"if",
"index_of_reference",
">",
"0",
"and",
"domain",
"[",
"index_of_reference",
":",
"]",
"==",
"reference",
":",
"re... | cb29899b984a21d56bf65d0b1d907073948fe16c |
train | dump_requestdriver_cookies_into_webdriver | Adds all cookies in the RequestDriver session to Webdriver
@type requestdriver: RequestDriver
@param requestdriver: RequestDriver with cookies
@type webdriverwrapper: WebDriverWrapper
@param webdriverwrapper: WebDriverWrapper to receive cookies
@param handle_sub_domain: If True, will check driver u... | coyote_framework/util/apps/driver_interop/drivercookies.py | def dump_requestdriver_cookies_into_webdriver(requestdriver, webdriverwrapper, handle_sub_domain=True):
"""Adds all cookies in the RequestDriver session to Webdriver
@type requestdriver: RequestDriver
@param requestdriver: RequestDriver with cookies
@type webdriverwrapper: WebDriverWrapper
@param w... | def dump_requestdriver_cookies_into_webdriver(requestdriver, webdriverwrapper, handle_sub_domain=True):
"""Adds all cookies in the RequestDriver session to Webdriver
@type requestdriver: RequestDriver
@param requestdriver: RequestDriver with cookies
@type webdriverwrapper: WebDriverWrapper
@param w... | [
"Adds",
"all",
"cookies",
"in",
"the",
"RequestDriver",
"session",
"to",
"Webdriver"
] | Shapeways/coyote_framework | python | https://github.com/Shapeways/coyote_framework/blob/cb29899b984a21d56bf65d0b1d907073948fe16c/coyote_framework/util/apps/driver_interop/drivercookies.py#L21-L61 | [
"def",
"dump_requestdriver_cookies_into_webdriver",
"(",
"requestdriver",
",",
"webdriverwrapper",
",",
"handle_sub_domain",
"=",
"True",
")",
":",
"driver_hostname",
"=",
"urlparse",
"(",
"webdriverwrapper",
".",
"current_url",
"(",
")",
")",
".",
"netloc",
"for",
... | cb29899b984a21d56bf65d0b1d907073948fe16c |
train | dump_webdriver_cookies_into_requestdriver | Adds all cookies in the Webdriver session to requestdriver
@type requestdriver: RequestDriver
@param requestdriver: RequestDriver with cookies
@type webdriver: WebDriverWrapper
@param webdriver: WebDriverWrapper to receive cookies
@rtype: None
@return: None | coyote_framework/util/apps/driver_interop/drivercookies.py | def dump_webdriver_cookies_into_requestdriver(requestdriver, webdriverwrapper):
"""Adds all cookies in the Webdriver session to requestdriver
@type requestdriver: RequestDriver
@param requestdriver: RequestDriver with cookies
@type webdriver: WebDriverWrapper
@param webdriver: WebDriverWrapper to r... | def dump_webdriver_cookies_into_requestdriver(requestdriver, webdriverwrapper):
"""Adds all cookies in the Webdriver session to requestdriver
@type requestdriver: RequestDriver
@param requestdriver: RequestDriver with cookies
@type webdriver: WebDriverWrapper
@param webdriver: WebDriverWrapper to r... | [
"Adds",
"all",
"cookies",
"in",
"the",
"Webdriver",
"session",
"to",
"requestdriver"
] | Shapeways/coyote_framework | python | https://github.com/Shapeways/coyote_framework/blob/cb29899b984a21d56bf65d0b1d907073948fe16c/coyote_framework/util/apps/driver_interop/drivercookies.py#L64-L80 | [
"def",
"dump_webdriver_cookies_into_requestdriver",
"(",
"requestdriver",
",",
"webdriverwrapper",
")",
":",
"for",
"cookie",
"in",
"webdriverwrapper",
".",
"get_cookies",
"(",
")",
":",
"# Wedbriver uses \"expiry\"; requests uses \"expires\", adjust for this",
"expires",
"=",
... | cb29899b984a21d56bf65d0b1d907073948fe16c |
train | get_firefox_binary | Gets the firefox binary
@rtype: FirefoxBinary | coyote_framework/drivers/coyote_driverfactory.py | def get_firefox_binary():
"""Gets the firefox binary
@rtype: FirefoxBinary
"""
browser_config = BrowserConfig()
constants_config = ConstantsConfig()
log_dir = os.path.join(constants_config.get('logs_dir'), 'firefox')
create_directory(log_dir)
log_path = os.path.join(log_dir, '{}_{}.log... | def get_firefox_binary():
"""Gets the firefox binary
@rtype: FirefoxBinary
"""
browser_config = BrowserConfig()
constants_config = ConstantsConfig()
log_dir = os.path.join(constants_config.get('logs_dir'), 'firefox')
create_directory(log_dir)
log_path = os.path.join(log_dir, '{}_{}.log... | [
"Gets",
"the",
"firefox",
"binary"
] | Shapeways/coyote_framework | python | https://github.com/Shapeways/coyote_framework/blob/cb29899b984a21d56bf65d0b1d907073948fe16c/coyote_framework/drivers/coyote_driverfactory.py#L51-L67 | [
"def",
"get_firefox_binary",
"(",
")",
":",
"browser_config",
"=",
"BrowserConfig",
"(",
")",
"constants_config",
"=",
"ConstantsConfig",
"(",
")",
"log_dir",
"=",
"os",
".",
"path",
".",
"join",
"(",
"constants_config",
".",
"get",
"(",
"'logs_dir'",
")",
"... | cb29899b984a21d56bf65d0b1d907073948fe16c |
train | _log_fail_callback | Raises an assertion error if the page has severe console errors
@param driver: ShapewaysDriver
@return: None | coyote_framework/drivers/coyote_driverfactory.py | def _log_fail_callback(driver, *args, **kwargs):
"""Raises an assertion error if the page has severe console errors
@param driver: ShapewaysDriver
@return: None
"""
try:
logs = driver.get_browser_log(levels=[BROWSER_LOG_LEVEL_SEVERE])
failure_message = 'There were severe console er... | def _log_fail_callback(driver, *args, **kwargs):
"""Raises an assertion error if the page has severe console errors
@param driver: ShapewaysDriver
@return: None
"""
try:
logs = driver.get_browser_log(levels=[BROWSER_LOG_LEVEL_SEVERE])
failure_message = 'There were severe console er... | [
"Raises",
"an",
"assertion",
"error",
"if",
"the",
"page",
"has",
"severe",
"console",
"errors"
] | Shapeways/coyote_framework | python | https://github.com/Shapeways/coyote_framework/blob/cb29899b984a21d56bf65d0b1d907073948fe16c/coyote_framework/drivers/coyote_driverfactory.py#L70-L87 | [
"def",
"_log_fail_callback",
"(",
"driver",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"try",
":",
"logs",
"=",
"driver",
".",
"get_browser_log",
"(",
"levels",
"=",
"[",
"BROWSER_LOG_LEVEL_SEVERE",
"]",
")",
"failure_message",
"=",
"'There were se... | cb29899b984a21d56bf65d0b1d907073948fe16c |
train | CoyoteEntityAbstract.clone_and_update | Clones the object and updates the clone with the args
@param kwargs: Keyword arguments to set
@return: The cloned copy with updated values | coyote_framework/database/coyote_entity_abstract.py | def clone_and_update(self, **kwargs):
"""Clones the object and updates the clone with the args
@param kwargs: Keyword arguments to set
@return: The cloned copy with updated values
"""
cloned = self.clone()
cloned.update(**kwargs)
return cloned | def clone_and_update(self, **kwargs):
"""Clones the object and updates the clone with the args
@param kwargs: Keyword arguments to set
@return: The cloned copy with updated values
"""
cloned = self.clone()
cloned.update(**kwargs)
return cloned | [
"Clones",
"the",
"object",
"and",
"updates",
"the",
"clone",
"with",
"the",
"args"
] | Shapeways/coyote_framework | python | https://github.com/Shapeways/coyote_framework/blob/cb29899b984a21d56bf65d0b1d907073948fe16c/coyote_framework/database/coyote_entity_abstract.py#L12-L20 | [
"def",
"clone_and_update",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"cloned",
"=",
"self",
".",
"clone",
"(",
")",
"cloned",
".",
"update",
"(",
"*",
"*",
"kwargs",
")",
"return",
"cloned"
] | cb29899b984a21d56bf65d0b1d907073948fe16c |
train | ContactForm.message | Render the body of the message to a string. | src/contact_form/forms.py | def message(self):
"""
Render the body of the message to a string.
"""
template_name = self.template_name() if \
callable(self.template_name) \
else self.template_name
return loader.render_to_string(
template_name, self.get_context(), request=... | def message(self):
"""
Render the body of the message to a string.
"""
template_name = self.template_name() if \
callable(self.template_name) \
else self.template_name
return loader.render_to_string(
template_name, self.get_context(), request=... | [
"Render",
"the",
"body",
"of",
"the",
"message",
"to",
"a",
"string",
"."
] | ubernostrum/django-contact-form | python | https://github.com/ubernostrum/django-contact-form/blob/7dd8491cd75fc39d0edfb2c14c270a130d5afa9e/src/contact_form/forms.py#L45-L55 | [
"def",
"message",
"(",
"self",
")",
":",
"template_name",
"=",
"self",
".",
"template_name",
"(",
")",
"if",
"callable",
"(",
"self",
".",
"template_name",
")",
"else",
"self",
".",
"template_name",
"return",
"loader",
".",
"render_to_string",
"(",
"template... | 7dd8491cd75fc39d0edfb2c14c270a130d5afa9e |
train | ContactForm.subject | Render the subject of the message to a string. | src/contact_form/forms.py | def subject(self):
"""
Render the subject of the message to a string.
"""
template_name = self.subject_template_name() if \
callable(self.subject_template_name) \
else self.subject_template_name
subject = loader.render_to_string(
template_name... | def subject(self):
"""
Render the subject of the message to a string.
"""
template_name = self.subject_template_name() if \
callable(self.subject_template_name) \
else self.subject_template_name
subject = loader.render_to_string(
template_name... | [
"Render",
"the",
"subject",
"of",
"the",
"message",
"to",
"a",
"string",
"."
] | ubernostrum/django-contact-form | python | https://github.com/ubernostrum/django-contact-form/blob/7dd8491cd75fc39d0edfb2c14c270a130d5afa9e/src/contact_form/forms.py#L57-L68 | [
"def",
"subject",
"(",
"self",
")",
":",
"template_name",
"=",
"self",
".",
"subject_template_name",
"(",
")",
"if",
"callable",
"(",
"self",
".",
"subject_template_name",
")",
"else",
"self",
".",
"subject_template_name",
"subject",
"=",
"loader",
".",
"rende... | 7dd8491cd75fc39d0edfb2c14c270a130d5afa9e |
train | ContactForm.get_context | Return the context used to render the templates for the email
subject and body.
By default, this context includes:
* All of the validated values in the form, as variables of the
same names as their fields.
* The current ``Site`` object, as the variable ``site``.
* A... | src/contact_form/forms.py | def get_context(self):
"""
Return the context used to render the templates for the email
subject and body.
By default, this context includes:
* All of the validated values in the form, as variables of the
same names as their fields.
* The current ``Site`` obj... | def get_context(self):
"""
Return the context used to render the templates for the email
subject and body.
By default, this context includes:
* All of the validated values in the form, as variables of the
same names as their fields.
* The current ``Site`` obj... | [
"Return",
"the",
"context",
"used",
"to",
"render",
"the",
"templates",
"for",
"the",
"email",
"subject",
"and",
"body",
"."
] | ubernostrum/django-contact-form | python | https://github.com/ubernostrum/django-contact-form/blob/7dd8491cd75fc39d0edfb2c14c270a130d5afa9e/src/contact_form/forms.py#L70-L90 | [
"def",
"get_context",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"is_valid",
"(",
")",
":",
"raise",
"ValueError",
"(",
"\"Cannot generate Context from invalid contact form\"",
")",
"return",
"dict",
"(",
"self",
".",
"cleaned_data",
",",
"site",
"=",
"g... | 7dd8491cd75fc39d0edfb2c14c270a130d5afa9e |
train | ContactForm.get_message_dict | Generate the various parts of the message and return them in a
dictionary, suitable for passing directly as keyword arguments
to ``django.core.mail.send_mail()``.
By default, the following values are returned:
* ``from_email``
* ``message``
* ``recipient_list``
... | src/contact_form/forms.py | def get_message_dict(self):
"""
Generate the various parts of the message and return them in a
dictionary, suitable for passing directly as keyword arguments
to ``django.core.mail.send_mail()``.
By default, the following values are returned:
* ``from_email``
* ... | def get_message_dict(self):
"""
Generate the various parts of the message and return them in a
dictionary, suitable for passing directly as keyword arguments
to ``django.core.mail.send_mail()``.
By default, the following values are returned:
* ``from_email``
* ... | [
"Generate",
"the",
"various",
"parts",
"of",
"the",
"message",
"and",
"return",
"them",
"in",
"a",
"dictionary",
"suitable",
"for",
"passing",
"directly",
"as",
"keyword",
"arguments",
"to",
"django",
".",
"core",
".",
"mail",
".",
"send_mail",
"()",
"."
] | ubernostrum/django-contact-form | python | https://github.com/ubernostrum/django-contact-form/blob/7dd8491cd75fc39d0edfb2c14c270a130d5afa9e/src/contact_form/forms.py#L92-L118 | [
"def",
"get_message_dict",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"is_valid",
"(",
")",
":",
"raise",
"ValueError",
"(",
"\"Message cannot be sent from invalid contact form\"",
")",
"message_dict",
"=",
"{",
"}",
"for",
"message_part",
"in",
"(",
"'fro... | 7dd8491cd75fc39d0edfb2c14c270a130d5afa9e |
train | initialise_shopify_session | Initialise the Shopify session with the Shopify App's API credentials. | shopify_auth/apps.py | def initialise_shopify_session():
"""
Initialise the Shopify session with the Shopify App's API credentials.
"""
if not settings.SHOPIFY_APP_API_KEY or not settings.SHOPIFY_APP_API_SECRET:
raise ImproperlyConfigured("SHOPIFY_APP_API_KEY and SHOPIFY_APP_API_SECRET must be set in settings")
sh... | def initialise_shopify_session():
"""
Initialise the Shopify session with the Shopify App's API credentials.
"""
if not settings.SHOPIFY_APP_API_KEY or not settings.SHOPIFY_APP_API_SECRET:
raise ImproperlyConfigured("SHOPIFY_APP_API_KEY and SHOPIFY_APP_API_SECRET must be set in settings")
sh... | [
"Initialise",
"the",
"Shopify",
"session",
"with",
"the",
"Shopify",
"App",
"s",
"API",
"credentials",
"."
] | discolabs/django-shopify-auth | python | https://github.com/discolabs/django-shopify-auth/blob/76523867bc630c7ade963d787afea1a94017874a/shopify_auth/apps.py#L23-L29 | [
"def",
"initialise_shopify_session",
"(",
")",
":",
"if",
"not",
"settings",
".",
"SHOPIFY_APP_API_KEY",
"or",
"not",
"settings",
".",
"SHOPIFY_APP_API_SECRET",
":",
"raise",
"ImproperlyConfigured",
"(",
"\"SHOPIFY_APP_API_KEY and SHOPIFY_APP_API_SECRET must be set in settings\... | 76523867bc630c7ade963d787afea1a94017874a |
train | anonymous_required | Decorator requiring the current user to be anonymous (not logged in). | shopify_auth/decorators.py | def anonymous_required(function=None, redirect_url=None):
"""
Decorator requiring the current user to be anonymous (not logged in).
"""
if not redirect_url:
redirect_url = settings.LOGIN_REDIRECT_URL
actual_decorator = user_passes_test(
is_anonymous,
login_url=redirect_url,
... | def anonymous_required(function=None, redirect_url=None):
"""
Decorator requiring the current user to be anonymous (not logged in).
"""
if not redirect_url:
redirect_url = settings.LOGIN_REDIRECT_URL
actual_decorator = user_passes_test(
is_anonymous,
login_url=redirect_url,
... | [
"Decorator",
"requiring",
"the",
"current",
"user",
"to",
"be",
"anonymous",
"(",
"not",
"logged",
"in",
")",
"."
] | discolabs/django-shopify-auth | python | https://github.com/discolabs/django-shopify-auth/blob/76523867bc630c7ade963d787afea1a94017874a/shopify_auth/decorators.py#L26-L41 | [
"def",
"anonymous_required",
"(",
"function",
"=",
"None",
",",
"redirect_url",
"=",
"None",
")",
":",
"if",
"not",
"redirect_url",
":",
"redirect_url",
"=",
"settings",
".",
"LOGIN_REDIRECT_URL",
"actual_decorator",
"=",
"user_passes_test",
"(",
"is_anonymous",
"... | 76523867bc630c7ade963d787afea1a94017874a |
train | login_required | Decorator that wraps django.contrib.auth.decorators.login_required, but supports extracting Shopify's authentication
query parameters (`shop`, `timestamp`, `signature` and `hmac`) and passing them on to the login URL (instead of just
wrapping them up and encoding them in to the `next` parameter).
This is u... | shopify_auth/decorators.py | def login_required(f, redirect_field_name=REDIRECT_FIELD_NAME, login_url=None):
"""
Decorator that wraps django.contrib.auth.decorators.login_required, but supports extracting Shopify's authentication
query parameters (`shop`, `timestamp`, `signature` and `hmac`) and passing them on to the login URL (instea... | def login_required(f, redirect_field_name=REDIRECT_FIELD_NAME, login_url=None):
"""
Decorator that wraps django.contrib.auth.decorators.login_required, but supports extracting Shopify's authentication
query parameters (`shop`, `timestamp`, `signature` and `hmac`) and passing them on to the login URL (instea... | [
"Decorator",
"that",
"wraps",
"django",
".",
"contrib",
".",
"auth",
".",
"decorators",
".",
"login_required",
"but",
"supports",
"extracting",
"Shopify",
"s",
"authentication",
"query",
"parameters",
"(",
"shop",
"timestamp",
"signature",
"and",
"hmac",
")",
"a... | discolabs/django-shopify-auth | python | https://github.com/discolabs/django-shopify-auth/blob/76523867bc630c7ade963d787afea1a94017874a/shopify_auth/decorators.py#L44-L76 | [
"def",
"login_required",
"(",
"f",
",",
"redirect_field_name",
"=",
"REDIRECT_FIELD_NAME",
",",
"login_url",
"=",
"None",
")",
":",
"@",
"wraps",
"(",
"f",
")",
"def",
"wrapper",
"(",
"request",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"if"... | 76523867bc630c7ade963d787afea1a94017874a |
train | ShopUserManager.create_user | Creates and saves a ShopUser with the given domain and password. | shopify_auth/models.py | def create_user(self, myshopify_domain, password=None):
"""
Creates and saves a ShopUser with the given domain and password.
"""
if not myshopify_domain:
raise ValueError('ShopUsers must have a myshopify domain')
user = self.model(myshopify_domain=myshopify_domain)
... | def create_user(self, myshopify_domain, password=None):
"""
Creates and saves a ShopUser with the given domain and password.
"""
if not myshopify_domain:
raise ValueError('ShopUsers must have a myshopify domain')
user = self.model(myshopify_domain=myshopify_domain)
... | [
"Creates",
"and",
"saves",
"a",
"ShopUser",
"with",
"the",
"given",
"domain",
"and",
"password",
"."
] | discolabs/django-shopify-auth | python | https://github.com/discolabs/django-shopify-auth/blob/76523867bc630c7ade963d787afea1a94017874a/shopify_auth/models.py#L10-L23 | [
"def",
"create_user",
"(",
"self",
",",
"myshopify_domain",
",",
"password",
"=",
"None",
")",
":",
"if",
"not",
"myshopify_domain",
":",
"raise",
"ValueError",
"(",
"'ShopUsers must have a myshopify domain'",
")",
"user",
"=",
"self",
".",
"model",
"(",
"myshop... | 76523867bc630c7ade963d787afea1a94017874a |
train | add_query_parameters_to_url | Merge a dictionary of query parameters into the given URL.
Ensures all parameters are sorted in dictionary order when returning the URL. | shopify_auth/helpers.py | def add_query_parameters_to_url(url, query_parameters):
"""
Merge a dictionary of query parameters into the given URL.
Ensures all parameters are sorted in dictionary order when returning the URL.
"""
# Parse the given URL into parts.
url_parts = urllib.parse.urlparse(url)
# Parse existing ... | def add_query_parameters_to_url(url, query_parameters):
"""
Merge a dictionary of query parameters into the given URL.
Ensures all parameters are sorted in dictionary order when returning the URL.
"""
# Parse the given URL into parts.
url_parts = urllib.parse.urlparse(url)
# Parse existing ... | [
"Merge",
"a",
"dictionary",
"of",
"query",
"parameters",
"into",
"the",
"given",
"URL",
".",
"Ensures",
"all",
"parameters",
"are",
"sorted",
"in",
"dictionary",
"order",
"when",
"returning",
"the",
"URL",
"."
] | discolabs/django-shopify-auth | python | https://github.com/discolabs/django-shopify-auth/blob/76523867bc630c7ade963d787afea1a94017874a/shopify_auth/helpers.py#L5-L24 | [
"def",
"add_query_parameters_to_url",
"(",
"url",
",",
"query_parameters",
")",
":",
"# Parse the given URL into parts.",
"url_parts",
"=",
"urllib",
".",
"parse",
".",
"urlparse",
"(",
"url",
")",
"# Parse existing parameters and add new parameters.",
"qs_args",
"=",
"ur... | 76523867bc630c7ade963d787afea1a94017874a |
train | Connection.bind | Bind an event to a callback
:param event_name: The name of the event to bind to.
:type event_name: str
:param callback: The callback to notify of this event. | pysher/connection.py | def bind(self, event_name, callback, *args, **kwargs):
"""Bind an event to a callback
:param event_name: The name of the event to bind to.
:type event_name: str
:param callback: The callback to notify of this event.
"""
self.event_callbacks[event_name].append((callback,... | def bind(self, event_name, callback, *args, **kwargs):
"""Bind an event to a callback
:param event_name: The name of the event to bind to.
:type event_name: str
:param callback: The callback to notify of this event.
"""
self.event_callbacks[event_name].append((callback,... | [
"Bind",
"an",
"event",
"to",
"a",
"callback"
] | nlsdfnbch/Pysher | python | https://github.com/nlsdfnbch/Pysher/blob/8bec81616be2b6c9a9c0e2774b42890426a73745/pysher/connection.py#L73-L81 | [
"def",
"bind",
"(",
"self",
",",
"event_name",
",",
"callback",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"event_callbacks",
"[",
"event_name",
"]",
".",
"append",
"(",
"(",
"callback",
",",
"args",
",",
"kwargs",
")",
")"
] | 8bec81616be2b6c9a9c0e2774b42890426a73745 |
train | Connection.send_event | Send an event to the Pusher server.
:param str event_name:
:param Any data:
:param str channel_name: | pysher/connection.py | def send_event(self, event_name, data, channel_name=None):
"""Send an event to the Pusher server.
:param str event_name:
:param Any data:
:param str channel_name:
"""
event = {'event': event_name, 'data': data}
if channel_name:
event['channel'] = chan... | def send_event(self, event_name, data, channel_name=None):
"""Send an event to the Pusher server.
:param str event_name:
:param Any data:
:param str channel_name:
"""
event = {'event': event_name, 'data': data}
if channel_name:
event['channel'] = chan... | [
"Send",
"an",
"event",
"to",
"the",
"Pusher",
"server",
"."
] | nlsdfnbch/Pysher | python | https://github.com/nlsdfnbch/Pysher/blob/8bec81616be2b6c9a9c0e2774b42890426a73745/pysher/connection.py#L206-L221 | [
"def",
"send_event",
"(",
"self",
",",
"event_name",
",",
"data",
",",
"channel_name",
"=",
"None",
")",
":",
"event",
"=",
"{",
"'event'",
":",
"event_name",
",",
"'data'",
":",
"data",
"}",
"if",
"channel_name",
":",
"event",
"[",
"'channel'",
"]",
"... | 8bec81616be2b6c9a9c0e2774b42890426a73745 |
train | Channel.trigger | Trigger an event on this channel. Only available for private or
presence channels
:param event_name: The name of the event. Must begin with 'client-''
:type event_name: str
:param data: The data to send with the event. | pysher/channel.py | def trigger(self, event_name, data):
"""Trigger an event on this channel. Only available for private or
presence channels
:param event_name: The name of the event. Must begin with 'client-''
:type event_name: str
:param data: The data to send with the event.
"""
... | def trigger(self, event_name, data):
"""Trigger an event on this channel. Only available for private or
presence channels
:param event_name: The name of the event. Must begin with 'client-''
:type event_name: str
:param data: The data to send with the event.
"""
... | [
"Trigger",
"an",
"event",
"on",
"this",
"channel",
".",
"Only",
"available",
"for",
"private",
"or",
"presence",
"channels"
] | nlsdfnbch/Pysher | python | https://github.com/nlsdfnbch/Pysher/blob/8bec81616be2b6c9a9c0e2774b42890426a73745/pysher/channel.py#L24-L36 | [
"def",
"trigger",
"(",
"self",
",",
"event_name",
",",
"data",
")",
":",
"if",
"self",
".",
"connection",
":",
"if",
"event_name",
".",
"startswith",
"(",
"\"client-\"",
")",
":",
"if",
"self",
".",
"name",
".",
"startswith",
"(",
"\"private-\"",
")",
... | 8bec81616be2b6c9a9c0e2774b42890426a73745 |
train | Pusher.subscribe | Subscribe to a channel.
:param str channel_name: The name of the channel to subscribe to.
:param str auth: The token to use if authenticated externally.
:rtype: pysher.Channel | pysher/pusher.py | def subscribe(self, channel_name, auth=None):
"""Subscribe to a channel.
:param str channel_name: The name of the channel to subscribe to.
:param str auth: The token to use if authenticated externally.
:rtype: pysher.Channel
"""
data = {'channel': channel_name}
i... | def subscribe(self, channel_name, auth=None):
"""Subscribe to a channel.
:param str channel_name: The name of the channel to subscribe to.
:param str auth: The token to use if authenticated externally.
:rtype: pysher.Channel
"""
data = {'channel': channel_name}
i... | [
"Subscribe",
"to",
"a",
"channel",
"."
] | nlsdfnbch/Pysher | python | https://github.com/nlsdfnbch/Pysher/blob/8bec81616be2b6c9a9c0e2774b42890426a73745/pysher/pusher.py#L87-L108 | [
"def",
"subscribe",
"(",
"self",
",",
"channel_name",
",",
"auth",
"=",
"None",
")",
":",
"data",
"=",
"{",
"'channel'",
":",
"channel_name",
"}",
"if",
"auth",
"is",
"None",
":",
"if",
"channel_name",
".",
"startswith",
"(",
"'presence-'",
")",
":",
"... | 8bec81616be2b6c9a9c0e2774b42890426a73745 |
train | Pusher.unsubscribe | Unsubscribe from a channel
:param str channel_name: The name of the channel to unsubscribe from. | pysher/pusher.py | def unsubscribe(self, channel_name):
"""Unsubscribe from a channel
:param str channel_name: The name of the channel to unsubscribe from.
"""
if channel_name in self.channels:
self.connection.send_event(
'pusher:unsubscribe', {
'channel': c... | def unsubscribe(self, channel_name):
"""Unsubscribe from a channel
:param str channel_name: The name of the channel to unsubscribe from.
"""
if channel_name in self.channels:
self.connection.send_event(
'pusher:unsubscribe', {
'channel': c... | [
"Unsubscribe",
"from",
"a",
"channel"
] | nlsdfnbch/Pysher | python | https://github.com/nlsdfnbch/Pysher/blob/8bec81616be2b6c9a9c0e2774b42890426a73745/pysher/pusher.py#L110-L121 | [
"def",
"unsubscribe",
"(",
"self",
",",
"channel_name",
")",
":",
"if",
"channel_name",
"in",
"self",
".",
"channels",
":",
"self",
".",
"connection",
".",
"send_event",
"(",
"'pusher:unsubscribe'",
",",
"{",
"'channel'",
":",
"channel_name",
",",
"}",
")",
... | 8bec81616be2b6c9a9c0e2774b42890426a73745 |
train | Pusher._connection_handler | Handle incoming data.
:param str event_name: Name of the event.
:param Any data: Data received.
:param str channel_name: Name of the channel this event and data belongs to. | pysher/pusher.py | def _connection_handler(self, event_name, data, channel_name):
"""Handle incoming data.
:param str event_name: Name of the event.
:param Any data: Data received.
:param str channel_name: Name of the channel this event and data belongs to.
"""
if channel_name in self.chan... | def _connection_handler(self, event_name, data, channel_name):
"""Handle incoming data.
:param str event_name: Name of the event.
:param Any data: Data received.
:param str channel_name: Name of the channel this event and data belongs to.
"""
if channel_name in self.chan... | [
"Handle",
"incoming",
"data",
"."
] | nlsdfnbch/Pysher | python | https://github.com/nlsdfnbch/Pysher/blob/8bec81616be2b6c9a9c0e2774b42890426a73745/pysher/pusher.py#L131-L139 | [
"def",
"_connection_handler",
"(",
"self",
",",
"event_name",
",",
"data",
",",
"channel_name",
")",
":",
"if",
"channel_name",
"in",
"self",
".",
"channels",
":",
"self",
".",
"channels",
"[",
"channel_name",
"]",
".",
"_handle_event",
"(",
"event_name",
",... | 8bec81616be2b6c9a9c0e2774b42890426a73745 |
train | Pusher._reconnect_handler | Handle a reconnect. | pysher/pusher.py | def _reconnect_handler(self):
"""Handle a reconnect."""
for channel_name, channel in self.channels.items():
data = {'channel': channel_name}
if channel.auth:
data['auth'] = channel.auth
self.connection.send_event('pusher:subscribe', data) | def _reconnect_handler(self):
"""Handle a reconnect."""
for channel_name, channel in self.channels.items():
data = {'channel': channel_name}
if channel.auth:
data['auth'] = channel.auth
self.connection.send_event('pusher:subscribe', data) | [
"Handle",
"a",
"reconnect",
"."
] | nlsdfnbch/Pysher | python | https://github.com/nlsdfnbch/Pysher/blob/8bec81616be2b6c9a9c0e2774b42890426a73745/pysher/pusher.py#L141-L149 | [
"def",
"_reconnect_handler",
"(",
"self",
")",
":",
"for",
"channel_name",
",",
"channel",
"in",
"self",
".",
"channels",
".",
"items",
"(",
")",
":",
"data",
"=",
"{",
"'channel'",
":",
"channel_name",
"}",
"if",
"channel",
".",
"auth",
":",
"data",
"... | 8bec81616be2b6c9a9c0e2774b42890426a73745 |
train | Pusher._generate_auth_token | Generate a token for authentication with the given channel.
:param str channel_name: Name of the channel to generate a signature for.
:rtype: str | pysher/pusher.py | def _generate_auth_token(self, channel_name):
"""Generate a token for authentication with the given channel.
:param str channel_name: Name of the channel to generate a signature for.
:rtype: str
"""
subject = "{}:{}".format(self.connection.socket_id, channel_name)
h = hm... | def _generate_auth_token(self, channel_name):
"""Generate a token for authentication with the given channel.
:param str channel_name: Name of the channel to generate a signature for.
:rtype: str
"""
subject = "{}:{}".format(self.connection.socket_id, channel_name)
h = hm... | [
"Generate",
"a",
"token",
"for",
"authentication",
"with",
"the",
"given",
"channel",
"."
] | nlsdfnbch/Pysher | python | https://github.com/nlsdfnbch/Pysher/blob/8bec81616be2b6c9a9c0e2774b42890426a73745/pysher/pusher.py#L151-L161 | [
"def",
"_generate_auth_token",
"(",
"self",
",",
"channel_name",
")",
":",
"subject",
"=",
"\"{}:{}\"",
".",
"format",
"(",
"self",
".",
"connection",
".",
"socket_id",
",",
"channel_name",
")",
"h",
"=",
"hmac",
".",
"new",
"(",
"self",
".",
"secret_as_by... | 8bec81616be2b6c9a9c0e2774b42890426a73745 |
train | Pusher._generate_presence_token | Generate a presence token.
:param str channel_name: Name of the channel to generate a signature for.
:rtype: str | pysher/pusher.py | def _generate_presence_token(self, channel_name):
"""Generate a presence token.
:param str channel_name: Name of the channel to generate a signature for.
:rtype: str
"""
subject = "{}:{}:{}".format(self.connection.socket_id, channel_name, json.dumps(self.user_data))
h = ... | def _generate_presence_token(self, channel_name):
"""Generate a presence token.
:param str channel_name: Name of the channel to generate a signature for.
:rtype: str
"""
subject = "{}:{}:{}".format(self.connection.socket_id, channel_name, json.dumps(self.user_data))
h = ... | [
"Generate",
"a",
"presence",
"token",
"."
] | nlsdfnbch/Pysher | python | https://github.com/nlsdfnbch/Pysher/blob/8bec81616be2b6c9a9c0e2774b42890426a73745/pysher/pusher.py#L163-L173 | [
"def",
"_generate_presence_token",
"(",
"self",
",",
"channel_name",
")",
":",
"subject",
"=",
"\"{}:{}:{}\"",
".",
"format",
"(",
"self",
".",
"connection",
".",
"socket_id",
",",
"channel_name",
",",
"json",
".",
"dumps",
"(",
"self",
".",
"user_data",
")"... | 8bec81616be2b6c9a9c0e2774b42890426a73745 |
train | UitmuntendNl.pos | Tries to decide about the part of speech. | lltk/nl/scrapers/uitmuntend.py | def pos(self, element = None):
''' Tries to decide about the part of speech. '''
tags = []
if element:
if element.startswith(('de ', 'het ', 'het/de', 'de/het')) and not re.search('\[[\w|\s][\w|\s]+\]', element.split('\r\n')[0], re.U):
tags.append('NN')
if re.search('[\w|\s|/]+ \| [\w|\s|/]+ - [\w|\s|/... | def pos(self, element = None):
''' Tries to decide about the part of speech. '''
tags = []
if element:
if element.startswith(('de ', 'het ', 'het/de', 'de/het')) and not re.search('\[[\w|\s][\w|\s]+\]', element.split('\r\n')[0], re.U):
tags.append('NN')
if re.search('[\w|\s|/]+ \| [\w|\s|/]+ - [\w|\s|/... | [
"Tries",
"to",
"decide",
"about",
"the",
"part",
"of",
"speech",
"."
] | lltk/lltk | python | https://github.com/lltk/lltk/blob/d171de55c1b97695fddedf4b02401ae27bf1d634/lltk/nl/scrapers/uitmuntend.py#L40-L57 | [
"def",
"pos",
"(",
"self",
",",
"element",
"=",
"None",
")",
":",
"tags",
"=",
"[",
"]",
"if",
"element",
":",
"if",
"element",
".",
"startswith",
"(",
"(",
"'de '",
",",
"'het '",
",",
"'het/de'",
",",
"'de/het'",
")",
")",
"and",
"not",
"re",
"... | d171de55c1b97695fddedf4b02401ae27bf1d634 |
train | UitmuntendNl.articles | Tries to scrape the correct articles for singular and plural from uitmuntend.nl. | lltk/nl/scrapers/uitmuntend.py | def articles(self):
''' Tries to scrape the correct articles for singular and plural from uitmuntend.nl. '''
result = [None, None]
element = self._first('NN')
if element:
element = element.split('\r\n')[0]
if ' | ' in element:
# This means there is a plural
singular, plural = element.split(' | ')... | def articles(self):
''' Tries to scrape the correct articles for singular and plural from uitmuntend.nl. '''
result = [None, None]
element = self._first('NN')
if element:
element = element.split('\r\n')[0]
if ' | ' in element:
# This means there is a plural
singular, plural = element.split(' | ')... | [
"Tries",
"to",
"scrape",
"the",
"correct",
"articles",
"for",
"singular",
"and",
"plural",
"from",
"uitmuntend",
".",
"nl",
"."
] | lltk/lltk | python | https://github.com/lltk/lltk/blob/d171de55c1b97695fddedf4b02401ae27bf1d634/lltk/nl/scrapers/uitmuntend.py#L60-L79 | [
"def",
"articles",
"(",
"self",
")",
":",
"result",
"=",
"[",
"None",
",",
"None",
"]",
"element",
"=",
"self",
".",
"_first",
"(",
"'NN'",
")",
"if",
"element",
":",
"element",
"=",
"element",
".",
"split",
"(",
"'\\r\\n'",
")",
"[",
"0",
"]",
"... | d171de55c1b97695fddedf4b02401ae27bf1d634 |
train | UitmuntendNl.plural | Tries to scrape the plural version from uitmuntend.nl. | lltk/nl/scrapers/uitmuntend.py | def plural(self):
''' Tries to scrape the plural version from uitmuntend.nl. '''
element = self._first('NN')
if element:
element = element.split('\r\n')[0]
if ' | ' in element:
# This means there is a plural
singular, plural = element.split(' | ')
return [plural.split(' ')[1]]
else:
# Th... | def plural(self):
''' Tries to scrape the plural version from uitmuntend.nl. '''
element = self._first('NN')
if element:
element = element.split('\r\n')[0]
if ' | ' in element:
# This means there is a plural
singular, plural = element.split(' | ')
return [plural.split(' ')[1]]
else:
# Th... | [
"Tries",
"to",
"scrape",
"the",
"plural",
"version",
"from",
"uitmuntend",
".",
"nl",
"."
] | lltk/lltk | python | https://github.com/lltk/lltk/blob/d171de55c1b97695fddedf4b02401ae27bf1d634/lltk/nl/scrapers/uitmuntend.py#L82-L95 | [
"def",
"plural",
"(",
"self",
")",
":",
"element",
"=",
"self",
".",
"_first",
"(",
"'NN'",
")",
"if",
"element",
":",
"element",
"=",
"element",
".",
"split",
"(",
"'\\r\\n'",
")",
"[",
"0",
"]",
"if",
"' | '",
"in",
"element",
":",
"# This means th... | d171de55c1b97695fddedf4b02401ae27bf1d634 |
train | download | Downloads a file via HTTP. | lltk/helpers.py | def download(url, filename, overwrite = False):
''' Downloads a file via HTTP. '''
from requests import get
from os.path import exists
debug('Downloading ' + unicode(url) + '...')
data = get(url)
if data.status_code == 200:
if not exists(filename) or overwrite:
f = open(filename, 'wb')
f.write(data.cont... | def download(url, filename, overwrite = False):
''' Downloads a file via HTTP. '''
from requests import get
from os.path import exists
debug('Downloading ' + unicode(url) + '...')
data = get(url)
if data.status_code == 200:
if not exists(filename) or overwrite:
f = open(filename, 'wb')
f.write(data.cont... | [
"Downloads",
"a",
"file",
"via",
"HTTP",
"."
] | lltk/lltk | python | https://github.com/lltk/lltk/blob/d171de55c1b97695fddedf4b02401ae27bf1d634/lltk/helpers.py#L6-L20 | [
"def",
"download",
"(",
"url",
",",
"filename",
",",
"overwrite",
"=",
"False",
")",
":",
"from",
"requests",
"import",
"get",
"from",
"os",
".",
"path",
"import",
"exists",
"debug",
"(",
"'Downloading '",
"+",
"unicode",
"(",
"url",
")",
"+",
"'...'",
... | d171de55c1b97695fddedf4b02401ae27bf1d634 |
train | warning | Prints a message if warning mode is enabled. | lltk/helpers.py | def warning(message):
''' Prints a message if warning mode is enabled. '''
import lltk.config as config
if config['warnings']:
try:
from termcolor import colored
except ImportError:
def colored(message, color):
return message
print colored('@LLTK-WARNING: ' + message, 'red') | def warning(message):
''' Prints a message if warning mode is enabled. '''
import lltk.config as config
if config['warnings']:
try:
from termcolor import colored
except ImportError:
def colored(message, color):
return message
print colored('@LLTK-WARNING: ' + message, 'red') | [
"Prints",
"a",
"message",
"if",
"warning",
"mode",
"is",
"enabled",
"."
] | lltk/lltk | python | https://github.com/lltk/lltk/blob/d171de55c1b97695fddedf4b02401ae27bf1d634/lltk/helpers.py#L42-L54 | [
"def",
"warning",
"(",
"message",
")",
":",
"import",
"lltk",
".",
"config",
"as",
"config",
"if",
"config",
"[",
"'warnings'",
"]",
":",
"try",
":",
"from",
"termcolor",
"import",
"colored",
"except",
"ImportError",
":",
"def",
"colored",
"(",
"message",
... | d171de55c1b97695fddedf4b02401ae27bf1d634 |
train | trace | Decorator used to trace function calls for debugging purposes. | lltk/helpers.py | def trace(f, *args, **kwargs):
''' Decorator used to trace function calls for debugging purposes. '''
print 'Calling %s() with args %s, %s ' % (f.__name__, args, kwargs)
return f(*args,**kwargs) | def trace(f, *args, **kwargs):
''' Decorator used to trace function calls for debugging purposes. '''
print 'Calling %s() with args %s, %s ' % (f.__name__, args, kwargs)
return f(*args,**kwargs) | [
"Decorator",
"used",
"to",
"trace",
"function",
"calls",
"for",
"debugging",
"purposes",
"."
] | lltk/lltk | python | https://github.com/lltk/lltk/blob/d171de55c1b97695fddedf4b02401ae27bf1d634/lltk/helpers.py#L68-L72 | [
"def",
"trace",
"(",
"f",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"print",
"'Calling %s() with args %s, %s '",
"%",
"(",
"f",
".",
"__name__",
",",
"args",
",",
"kwargs",
")",
"return",
"f",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
"... | d171de55c1b97695fddedf4b02401ae27bf1d634 |
train | VandaleNl.articles | Tries to scrape the correct articles for singular and plural from vandale.nl. | lltk/nl/scrapers/vandale.py | def articles(self):
''' Tries to scrape the correct articles for singular and plural from vandale.nl. '''
result = [None, None]
element = self._first('NN')
if element:
if re.search('(de|het/?de|het);', element, re.U):
result[0] = re.findall('(de|het/?de|het);', element, re.U)[0].split('/')
if re.sear... | def articles(self):
''' Tries to scrape the correct articles for singular and plural from vandale.nl. '''
result = [None, None]
element = self._first('NN')
if element:
if re.search('(de|het/?de|het);', element, re.U):
result[0] = re.findall('(de|het/?de|het);', element, re.U)[0].split('/')
if re.sear... | [
"Tries",
"to",
"scrape",
"the",
"correct",
"articles",
"for",
"singular",
"and",
"plural",
"from",
"vandale",
".",
"nl",
"."
] | lltk/lltk | python | https://github.com/lltk/lltk/blob/d171de55c1b97695fddedf4b02401ae27bf1d634/lltk/nl/scrapers/vandale.py#L56-L70 | [
"def",
"articles",
"(",
"self",
")",
":",
"result",
"=",
"[",
"None",
",",
"None",
"]",
"element",
"=",
"self",
".",
"_first",
"(",
"'NN'",
")",
"if",
"element",
":",
"if",
"re",
".",
"search",
"(",
"'(de|het/?de|het);'",
",",
"element",
",",
"re",
... | d171de55c1b97695fddedf4b02401ae27bf1d634 |
train | VandaleNl.plural | Tries to scrape the plural version from vandale.nl. | lltk/nl/scrapers/vandale.py | def plural(self):
''' Tries to scrape the plural version from vandale.nl. '''
element = self._first('NN')
if element:
if re.search('meervoud: ([\w|\s|\'|\-|,]+)', element, re.U):
results = re.search('meervoud: ([\w|\s|\'|\-|,]+)', element, re.U).groups()[0].split(', ')
results = [x.replace('ook ', '')... | def plural(self):
''' Tries to scrape the plural version from vandale.nl. '''
element = self._first('NN')
if element:
if re.search('meervoud: ([\w|\s|\'|\-|,]+)', element, re.U):
results = re.search('meervoud: ([\w|\s|\'|\-|,]+)', element, re.U).groups()[0].split(', ')
results = [x.replace('ook ', '')... | [
"Tries",
"to",
"scrape",
"the",
"plural",
"version",
"from",
"vandale",
".",
"nl",
"."
] | lltk/lltk | python | https://github.com/lltk/lltk/blob/d171de55c1b97695fddedf4b02401ae27bf1d634/lltk/nl/scrapers/vandale.py#L73-L85 | [
"def",
"plural",
"(",
"self",
")",
":",
"element",
"=",
"self",
".",
"_first",
"(",
"'NN'",
")",
"if",
"element",
":",
"if",
"re",
".",
"search",
"(",
"'meervoud: ([\\w|\\s|\\'|\\-|,]+)'",
",",
"element",
",",
"re",
".",
"U",
")",
":",
"results",
"=",
... | d171de55c1b97695fddedf4b02401ae27bf1d634 |
train | VandaleNl.miniaturize | Tries to scrape the miniaturized version from vandale.nl. | lltk/nl/scrapers/vandale.py | def miniaturize(self):
''' Tries to scrape the miniaturized version from vandale.nl. '''
element = self._first('NN')
if element:
if re.search('verkleinwoord: (\w+)', element, re.U):
return re.findall('verkleinwoord: (\w+)', element, re.U)
else:
return ['']
return [None] | def miniaturize(self):
''' Tries to scrape the miniaturized version from vandale.nl. '''
element = self._first('NN')
if element:
if re.search('verkleinwoord: (\w+)', element, re.U):
return re.findall('verkleinwoord: (\w+)', element, re.U)
else:
return ['']
return [None] | [
"Tries",
"to",
"scrape",
"the",
"miniaturized",
"version",
"from",
"vandale",
".",
"nl",
"."
] | lltk/lltk | python | https://github.com/lltk/lltk/blob/d171de55c1b97695fddedf4b02401ae27bf1d634/lltk/nl/scrapers/vandale.py#L88-L97 | [
"def",
"miniaturize",
"(",
"self",
")",
":",
"element",
"=",
"self",
".",
"_first",
"(",
"'NN'",
")",
"if",
"element",
":",
"if",
"re",
".",
"search",
"(",
"'verkleinwoord: (\\w+)'",
",",
"element",
",",
"re",
".",
"U",
")",
":",
"return",
"re",
".",... | d171de55c1b97695fddedf4b02401ae27bf1d634 |
train | VerbixDe._normalize | Returns a sanitized string. | lltk/de/scrapers/verbix.py | def _normalize(self, string):
''' Returns a sanitized string. '''
string = super(VerbixDe, self)._normalize(string)
string = string.replace('sie; Sie', 'sie')
string = string.strip()
return string | def _normalize(self, string):
''' Returns a sanitized string. '''
string = super(VerbixDe, self)._normalize(string)
string = string.replace('sie; Sie', 'sie')
string = string.strip()
return string | [
"Returns",
"a",
"sanitized",
"string",
"."
] | lltk/lltk | python | https://github.com/lltk/lltk/blob/d171de55c1b97695fddedf4b02401ae27bf1d634/lltk/de/scrapers/verbix.py#L19-L25 | [
"def",
"_normalize",
"(",
"self",
",",
"string",
")",
":",
"string",
"=",
"super",
"(",
"VerbixDe",
",",
"self",
")",
".",
"_normalize",
"(",
"string",
")",
"string",
"=",
"string",
".",
"replace",
"(",
"'sie; Sie'",
",",
"'sie'",
")",
"string",
"=",
... | d171de55c1b97695fddedf4b02401ae27bf1d634 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.