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 | ChromeRemoteDebugInterface.Debugger_setPauseOnExceptions | Function path: Debugger.setPauseOnExceptions
Domain: Debugger
Method name: setPauseOnExceptions
Parameters:
Required arguments:
'state' (type: string) -> Pause on exceptions mode.
No return value.
Description: Defines pause on exceptions state. Can be set to stop on all exceptions, uncaugh... | ChromeController/Generator/Generated.py | def Debugger_setPauseOnExceptions(self, state):
"""
Function path: Debugger.setPauseOnExceptions
Domain: Debugger
Method name: setPauseOnExceptions
Parameters:
Required arguments:
'state' (type: string) -> Pause on exceptions mode.
No return value.
Description: Defines pause on excepti... | def Debugger_setPauseOnExceptions(self, state):
"""
Function path: Debugger.setPauseOnExceptions
Domain: Debugger
Method name: setPauseOnExceptions
Parameters:
Required arguments:
'state' (type: string) -> Pause on exceptions mode.
No return value.
Description: Defines pause on excepti... | [
"Function",
"path",
":",
"Debugger",
".",
"setPauseOnExceptions",
"Domain",
":",
"Debugger",
"Method",
"name",
":",
"setPauseOnExceptions",
"Parameters",
":",
"Required",
"arguments",
":",
"state",
"(",
"type",
":",
"string",
")",
"-",
">",
"Pause",
"on",
"exc... | fake-name/ChromeController | python | https://github.com/fake-name/ChromeController/blob/914dd136184e8f1165c7aa6ef30418aaf10c61f0/ChromeController/Generator/Generated.py#L7352-L7370 | [
"def",
"Debugger_setPauseOnExceptions",
"(",
"self",
",",
"state",
")",
":",
"assert",
"isinstance",
"(",
"state",
",",
"(",
"str",
",",
")",
")",
",",
"\"Argument 'state' must be of type '['str']'. Received type: '%s'\"",
"%",
"type",
"(",
"state",
")",
"subdom_fun... | 914dd136184e8f1165c7aa6ef30418aaf10c61f0 |
train | ChromeRemoteDebugInterface.Debugger_setVariableValue | Function path: Debugger.setVariableValue
Domain: Debugger
Method name: setVariableValue
Parameters:
Required arguments:
'scopeNumber' (type: integer) -> 0-based number of scope as was listed in scope chain. Only 'local', 'closure' and 'catch' scope types are allowed. Other scopes could be manipulat... | ChromeController/Generator/Generated.py | def Debugger_setVariableValue(self, scopeNumber, variableName, newValue,
callFrameId):
"""
Function path: Debugger.setVariableValue
Domain: Debugger
Method name: setVariableValue
Parameters:
Required arguments:
'scopeNumber' (type: integer) -> 0-based number of scope as was listed in scope... | def Debugger_setVariableValue(self, scopeNumber, variableName, newValue,
callFrameId):
"""
Function path: Debugger.setVariableValue
Domain: Debugger
Method name: setVariableValue
Parameters:
Required arguments:
'scopeNumber' (type: integer) -> 0-based number of scope as was listed in scope... | [
"Function",
"path",
":",
"Debugger",
".",
"setVariableValue",
"Domain",
":",
"Debugger",
"Method",
"name",
":",
"setVariableValue",
"Parameters",
":",
"Required",
"arguments",
":",
"scopeNumber",
"(",
"type",
":",
"integer",
")",
"-",
">",
"0",
"-",
"based",
... | fake-name/ChromeController | python | https://github.com/fake-name/ChromeController/blob/914dd136184e8f1165c7aa6ef30418aaf10c61f0/ChromeController/Generator/Generated.py#L7431-L7457 | [
"def",
"Debugger_setVariableValue",
"(",
"self",
",",
"scopeNumber",
",",
"variableName",
",",
"newValue",
",",
"callFrameId",
")",
":",
"assert",
"isinstance",
"(",
"scopeNumber",
",",
"(",
"int",
",",
")",
")",
",",
"\"Argument 'scopeNumber' must be of type '['int... | 914dd136184e8f1165c7aa6ef30418aaf10c61f0 |
train | ChromeRemoteDebugInterface.Debugger_setAsyncCallStackDepth | Function path: Debugger.setAsyncCallStackDepth
Domain: Debugger
Method name: setAsyncCallStackDepth
Parameters:
Required arguments:
'maxDepth' (type: integer) -> Maximum depth of async call stacks. Setting to <code>0</code> will effectively disable collecting async call stacks (default).
No retu... | ChromeController/Generator/Generated.py | def Debugger_setAsyncCallStackDepth(self, maxDepth):
"""
Function path: Debugger.setAsyncCallStackDepth
Domain: Debugger
Method name: setAsyncCallStackDepth
Parameters:
Required arguments:
'maxDepth' (type: integer) -> Maximum depth of async call stacks. Setting to <code>0</code> will effective... | def Debugger_setAsyncCallStackDepth(self, maxDepth):
"""
Function path: Debugger.setAsyncCallStackDepth
Domain: Debugger
Method name: setAsyncCallStackDepth
Parameters:
Required arguments:
'maxDepth' (type: integer) -> Maximum depth of async call stacks. Setting to <code>0</code> will effective... | [
"Function",
"path",
":",
"Debugger",
".",
"setAsyncCallStackDepth",
"Domain",
":",
"Debugger",
"Method",
"name",
":",
"setAsyncCallStackDepth",
"Parameters",
":",
"Required",
"arguments",
":",
"maxDepth",
"(",
"type",
":",
"integer",
")",
"-",
">",
"Maximum",
"d... | fake-name/ChromeController | python | https://github.com/fake-name/ChromeController/blob/914dd136184e8f1165c7aa6ef30418aaf10c61f0/ChromeController/Generator/Generated.py#L7459-L7477 | [
"def",
"Debugger_setAsyncCallStackDepth",
"(",
"self",
",",
"maxDepth",
")",
":",
"assert",
"isinstance",
"(",
"maxDepth",
",",
"(",
"int",
",",
")",
")",
",",
"\"Argument 'maxDepth' must be of type '['int']'. Received type: '%s'\"",
"%",
"type",
"(",
"maxDepth",
")",... | 914dd136184e8f1165c7aa6ef30418aaf10c61f0 |
train | ChromeRemoteDebugInterface.Debugger_setBlackboxPatterns | Function path: Debugger.setBlackboxPatterns
Domain: Debugger
Method name: setBlackboxPatterns
WARNING: This function is marked 'Experimental'!
Parameters:
Required arguments:
'patterns' (type: array) -> Array of regexps that will be used to check script url for blackbox state.
No return va... | ChromeController/Generator/Generated.py | def Debugger_setBlackboxPatterns(self, patterns):
"""
Function path: Debugger.setBlackboxPatterns
Domain: Debugger
Method name: setBlackboxPatterns
WARNING: This function is marked 'Experimental'!
Parameters:
Required arguments:
'patterns' (type: array) -> Array of regexps that will be us... | def Debugger_setBlackboxPatterns(self, patterns):
"""
Function path: Debugger.setBlackboxPatterns
Domain: Debugger
Method name: setBlackboxPatterns
WARNING: This function is marked 'Experimental'!
Parameters:
Required arguments:
'patterns' (type: array) -> Array of regexps that will be us... | [
"Function",
"path",
":",
"Debugger",
".",
"setBlackboxPatterns",
"Domain",
":",
"Debugger",
"Method",
"name",
":",
"setBlackboxPatterns",
"WARNING",
":",
"This",
"function",
"is",
"marked",
"Experimental",
"!",
"Parameters",
":",
"Required",
"arguments",
":",
"pat... | fake-name/ChromeController | python | https://github.com/fake-name/ChromeController/blob/914dd136184e8f1165c7aa6ef30418aaf10c61f0/ChromeController/Generator/Generated.py#L7479-L7499 | [
"def",
"Debugger_setBlackboxPatterns",
"(",
"self",
",",
"patterns",
")",
":",
"assert",
"isinstance",
"(",
"patterns",
",",
"(",
"list",
",",
"tuple",
")",
")",
",",
"\"Argument 'patterns' must be of type '['list', 'tuple']'. Received type: '%s'\"",
"%",
"type",
"(",
... | 914dd136184e8f1165c7aa6ef30418aaf10c61f0 |
train | ChromeRemoteDebugInterface.Debugger_setBlackboxedRanges | Function path: Debugger.setBlackboxedRanges
Domain: Debugger
Method name: setBlackboxedRanges
WARNING: This function is marked 'Experimental'!
Parameters:
Required arguments:
'scriptId' (type: Runtime.ScriptId) -> Id of the script.
'positions' (type: array) -> No description
No return... | ChromeController/Generator/Generated.py | def Debugger_setBlackboxedRanges(self, scriptId, positions):
"""
Function path: Debugger.setBlackboxedRanges
Domain: Debugger
Method name: setBlackboxedRanges
WARNING: This function is marked 'Experimental'!
Parameters:
Required arguments:
'scriptId' (type: Runtime.ScriptId) -> Id of the ... | def Debugger_setBlackboxedRanges(self, scriptId, positions):
"""
Function path: Debugger.setBlackboxedRanges
Domain: Debugger
Method name: setBlackboxedRanges
WARNING: This function is marked 'Experimental'!
Parameters:
Required arguments:
'scriptId' (type: Runtime.ScriptId) -> Id of the ... | [
"Function",
"path",
":",
"Debugger",
".",
"setBlackboxedRanges",
"Domain",
":",
"Debugger",
"Method",
"name",
":",
"setBlackboxedRanges",
"WARNING",
":",
"This",
"function",
"is",
"marked",
"Experimental",
"!",
"Parameters",
":",
"Required",
"arguments",
":",
"scr... | fake-name/ChromeController | python | https://github.com/fake-name/ChromeController/blob/914dd136184e8f1165c7aa6ef30418aaf10c61f0/ChromeController/Generator/Generated.py#L7501-L7522 | [
"def",
"Debugger_setBlackboxedRanges",
"(",
"self",
",",
"scriptId",
",",
"positions",
")",
":",
"assert",
"isinstance",
"(",
"positions",
",",
"(",
"list",
",",
"tuple",
")",
")",
",",
"\"Argument 'positions' must be of type '['list', 'tuple']'. Received type: '%s'\"",
... | 914dd136184e8f1165c7aa6ef30418aaf10c61f0 |
train | ChromeRemoteDebugInterface.Profiler_setSamplingInterval | Function path: Profiler.setSamplingInterval
Domain: Profiler
Method name: setSamplingInterval
Parameters:
Required arguments:
'interval' (type: integer) -> New sampling interval in microseconds.
No return value.
Description: Changes CPU profiler sampling interval. Must be called before CPU... | ChromeController/Generator/Generated.py | def Profiler_setSamplingInterval(self, interval):
"""
Function path: Profiler.setSamplingInterval
Domain: Profiler
Method name: setSamplingInterval
Parameters:
Required arguments:
'interval' (type: integer) -> New sampling interval in microseconds.
No return value.
Description: Changes... | def Profiler_setSamplingInterval(self, interval):
"""
Function path: Profiler.setSamplingInterval
Domain: Profiler
Method name: setSamplingInterval
Parameters:
Required arguments:
'interval' (type: integer) -> New sampling interval in microseconds.
No return value.
Description: Changes... | [
"Function",
"path",
":",
"Profiler",
".",
"setSamplingInterval",
"Domain",
":",
"Profiler",
"Method",
"name",
":",
"setSamplingInterval",
"Parameters",
":",
"Required",
"arguments",
":",
"interval",
"(",
"type",
":",
"integer",
")",
"-",
">",
"New",
"sampling",
... | fake-name/ChromeController | python | https://github.com/fake-name/ChromeController/blob/914dd136184e8f1165c7aa6ef30418aaf10c61f0/ChromeController/Generator/Generated.py#L7587-L7605 | [
"def",
"Profiler_setSamplingInterval",
"(",
"self",
",",
"interval",
")",
":",
"assert",
"isinstance",
"(",
"interval",
",",
"(",
"int",
",",
")",
")",
",",
"\"Argument 'interval' must be of type '['int']'. Received type: '%s'\"",
"%",
"type",
"(",
"interval",
")",
... | 914dd136184e8f1165c7aa6ef30418aaf10c61f0 |
train | ChromeRemoteDebugInterface.update_headers | Given a set of headers, update both the user-agent
and additional headers for the remote browser.
header_args must be a dict. Keys are the names of
the corresponding HTTP header.
return value is a 2-tuple of the results of the user-agent
update, as well as the extra headers update.
If no 'User-Agent' key ... | ChromeController/manager.py | def update_headers(self, header_args):
'''
Given a set of headers, update both the user-agent
and additional headers for the remote browser.
header_args must be a dict. Keys are the names of
the corresponding HTTP header.
return value is a 2-tuple of the results of the user-agent
update, as well as the ... | def update_headers(self, header_args):
'''
Given a set of headers, update both the user-agent
and additional headers for the remote browser.
header_args must be a dict. Keys are the names of
the corresponding HTTP header.
return value is a 2-tuple of the results of the user-agent
update, as well as the ... | [
"Given",
"a",
"set",
"of",
"headers",
"update",
"both",
"the",
"user",
"-",
"agent",
"and",
"additional",
"headers",
"for",
"the",
"remote",
"browser",
"."
] | fake-name/ChromeController | python | https://github.com/fake-name/ChromeController/blob/914dd136184e8f1165c7aa6ef30418aaf10c61f0/ChromeController/manager.py#L96-L121 | [
"def",
"update_headers",
"(",
"self",
",",
"header_args",
")",
":",
"assert",
"isinstance",
"(",
"header_args",
",",
"dict",
")",
",",
"\"header_args must be a dict, passed type was %s\"",
"%",
"(",
"type",
"(",
"header_args",
")",
",",
")",
"ua",
"=",
"header_a... | 914dd136184e8f1165c7aa6ef30418aaf10c61f0 |
train | ChromeRemoteDebugInterface.get_cookies | Retreive the cookies from the remote browser.
Return value is a list of http.cookiejar.Cookie() instances.
These can be directly used with the various http.cookiejar.XXXCookieJar
cookie management classes. | ChromeController/manager.py | def get_cookies(self):
'''
Retreive the cookies from the remote browser.
Return value is a list of http.cookiejar.Cookie() instances.
These can be directly used with the various http.cookiejar.XXXCookieJar
cookie management classes.
'''
ret = self.Network_getAllCookies()
assert 'result' in ret, "No re... | def get_cookies(self):
'''
Retreive the cookies from the remote browser.
Return value is a list of http.cookiejar.Cookie() instances.
These can be directly used with the various http.cookiejar.XXXCookieJar
cookie management classes.
'''
ret = self.Network_getAllCookies()
assert 'result' in ret, "No re... | [
"Retreive",
"the",
"cookies",
"from",
"the",
"remote",
"browser",
"."
] | fake-name/ChromeController | python | https://github.com/fake-name/ChromeController/blob/914dd136184e8f1165c7aa6ef30418aaf10c61f0/ChromeController/manager.py#L165-L236 | [
"def",
"get_cookies",
"(",
"self",
")",
":",
"ret",
"=",
"self",
".",
"Network_getAllCookies",
"(",
")",
"assert",
"'result'",
"in",
"ret",
",",
"\"No return value in function response!\"",
"assert",
"'cookies'",
"in",
"ret",
"[",
"'result'",
"]",
",",
"\"No 'co... | 914dd136184e8f1165c7aa6ef30418aaf10c61f0 |
train | ChromeRemoteDebugInterface.set_cookie | Add a cookie to the remote chromium instance.
Passed value `cookie` must be an instance of `http.cookiejar.Cookie()`. | ChromeController/manager.py | def set_cookie(self, cookie):
'''
Add a cookie to the remote chromium instance.
Passed value `cookie` must be an instance of `http.cookiejar.Cookie()`.
'''
# Function path: Network.setCookie
# Domain: Network
# Method name: setCookie
# WARNING: This function is marked 'Experimental'!
# Parameters:
... | def set_cookie(self, cookie):
'''
Add a cookie to the remote chromium instance.
Passed value `cookie` must be an instance of `http.cookiejar.Cookie()`.
'''
# Function path: Network.setCookie
# Domain: Network
# Method name: setCookie
# WARNING: This function is marked 'Experimental'!
# Parameters:
... | [
"Add",
"a",
"cookie",
"to",
"the",
"remote",
"chromium",
"instance",
"."
] | fake-name/ChromeController | python | https://github.com/fake-name/ChromeController/blob/914dd136184e8f1165c7aa6ef30418aaf10c61f0/ChromeController/manager.py#L238-L310 | [
"def",
"set_cookie",
"(",
"self",
",",
"cookie",
")",
":",
"# Function path: Network.setCookie",
"# Domain: Network",
"# Method name: setCookie",
"# WARNING: This function is marked 'Experimental'!",
"# Parameters:",
"# Required arguments:",
"# 'url' (type: string... | 914dd136184e8f1165c7aa6ef30418aaf10c61f0 |
train | ChromeRemoteDebugInterface.get_current_url | Probe the remote session for the current window URL.
This is primarily used to do things like unwrap redirects,
or circumvent outbound url wrappers. | ChromeController/manager.py | def get_current_url(self):
'''
Probe the remote session for the current window URL.
This is primarily used to do things like unwrap redirects,
or circumvent outbound url wrappers.
'''
res = self.Page_getNavigationHistory()
assert 'result' in res
assert 'currentIndex' in res['result']
assert 'entries... | def get_current_url(self):
'''
Probe the remote session for the current window URL.
This is primarily used to do things like unwrap redirects,
or circumvent outbound url wrappers.
'''
res = self.Page_getNavigationHistory()
assert 'result' in res
assert 'currentIndex' in res['result']
assert 'entries... | [
"Probe",
"the",
"remote",
"session",
"for",
"the",
"current",
"window",
"URL",
"."
] | fake-name/ChromeController | python | https://github.com/fake-name/ChromeController/blob/914dd136184e8f1165c7aa6ef30418aaf10c61f0/ChromeController/manager.py#L337-L350 | [
"def",
"get_current_url",
"(",
"self",
")",
":",
"res",
"=",
"self",
".",
"Page_getNavigationHistory",
"(",
")",
"assert",
"'result'",
"in",
"res",
"assert",
"'currentIndex'",
"in",
"res",
"[",
"'result'",
"]",
"assert",
"'entries'",
"in",
"res",
"[",
"'resu... | 914dd136184e8f1165c7aa6ef30418aaf10c61f0 |
train | ChromeRemoteDebugInterface.get_page_url_title | Get the title and current url from the remote session.
Return is a 2-tuple: (page_title, page_url). | ChromeController/manager.py | def get_page_url_title(self):
'''
Get the title and current url from the remote session.
Return is a 2-tuple: (page_title, page_url).
'''
cr_tab_id = self.transport._get_cr_tab_meta_for_key(self.tab_id)['id']
targets = self.Target_getTargets()
assert 'result' in targets
assert 'targetInfos' in targe... | def get_page_url_title(self):
'''
Get the title and current url from the remote session.
Return is a 2-tuple: (page_title, page_url).
'''
cr_tab_id = self.transport._get_cr_tab_meta_for_key(self.tab_id)['id']
targets = self.Target_getTargets()
assert 'result' in targets
assert 'targetInfos' in targe... | [
"Get",
"the",
"title",
"and",
"current",
"url",
"from",
"the",
"remote",
"session",
"."
] | fake-name/ChromeController | python | https://github.com/fake-name/ChromeController/blob/914dd136184e8f1165c7aa6ef30418aaf10c61f0/ChromeController/manager.py#L352-L378 | [
"def",
"get_page_url_title",
"(",
"self",
")",
":",
"cr_tab_id",
"=",
"self",
".",
"transport",
".",
"_get_cr_tab_meta_for_key",
"(",
"self",
".",
"tab_id",
")",
"[",
"'id'",
"]",
"targets",
"=",
"self",
".",
"Target_getTargets",
"(",
")",
"assert",
"'result... | 914dd136184e8f1165c7aa6ef30418aaf10c61f0 |
train | ChromeRemoteDebugInterface.execute_javascript | Execute a javascript string in the context of the browser tab. | ChromeController/manager.py | def execute_javascript(self, *args, **kwargs):
'''
Execute a javascript string in the context of the browser tab.
'''
ret = self.__exec_js(*args, **kwargs)
return ret | def execute_javascript(self, *args, **kwargs):
'''
Execute a javascript string in the context of the browser tab.
'''
ret = self.__exec_js(*args, **kwargs)
return ret | [
"Execute",
"a",
"javascript",
"string",
"in",
"the",
"context",
"of",
"the",
"browser",
"tab",
"."
] | fake-name/ChromeController | python | https://github.com/fake-name/ChromeController/blob/914dd136184e8f1165c7aa6ef30418aaf10c61f0/ChromeController/manager.py#L400-L406 | [
"def",
"execute_javascript",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"ret",
"=",
"self",
".",
"__exec_js",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
"return",
"ret"
] | 914dd136184e8f1165c7aa6ef30418aaf10c61f0 |
train | ChromeRemoteDebugInterface.find_element | DOM_performSearch(self, query, includeUserAgentShadowDOM)
Python Function: DOM_performSearch
Domain: DOM
Method name: performSearch
WARNING: This function is marked 'Experimental'!
Parameters:
'query' (type: string) -> Plain text or query selector or XPath s... | ChromeController/manager.py | def find_element(self, search):
'''
DOM_performSearch(self, query, includeUserAgentShadowDOM)
Python Function: DOM_performSearch
Domain: DOM
Method name: performSearch
WARNING: This function is marked 'Experimental'!
Parameters:
'query' (type: string) -... | def find_element(self, search):
'''
DOM_performSearch(self, query, includeUserAgentShadowDOM)
Python Function: DOM_performSearch
Domain: DOM
Method name: performSearch
WARNING: This function is marked 'Experimental'!
Parameters:
'query' (type: string) -... | [
"DOM_performSearch",
"(",
"self",
"query",
"includeUserAgentShadowDOM",
")",
"Python",
"Function",
":",
"DOM_performSearch",
"Domain",
":",
"DOM",
"Method",
"name",
":",
"performSearch"
] | fake-name/ChromeController | python | https://github.com/fake-name/ChromeController/blob/914dd136184e8f1165c7aa6ef30418aaf10c61f0/ChromeController/manager.py#L408-L467 | [
"def",
"find_element",
"(",
"self",
",",
"search",
")",
":",
"res",
"=",
"self",
".",
"DOM_performSearch",
"(",
"search",
",",
"includeUserAgentShadowDOM",
"=",
"False",
")",
"assert",
"'result'",
"in",
"res",
"assert",
"'searchId'",
"in",
"res",
"[",
"'resu... | 914dd136184e8f1165c7aa6ef30418aaf10c61f0 |
train | ChromeRemoteDebugInterface.get_unpacked_response_body | Return a unpacked, decoded resposne body from Network_getResponseBody() | ChromeController/manager.py | def get_unpacked_response_body(self, requestId, mimetype="application/unknown"):
'''
Return a unpacked, decoded resposne body from Network_getResponseBody()
'''
content = self.Network_getResponseBody(requestId)
assert 'result' in content
result = content['result']
assert 'base64Encoded' in result
asse... | def get_unpacked_response_body(self, requestId, mimetype="application/unknown"):
'''
Return a unpacked, decoded resposne body from Network_getResponseBody()
'''
content = self.Network_getResponseBody(requestId)
assert 'result' in content
result = content['result']
assert 'base64Encoded' in result
asse... | [
"Return",
"a",
"unpacked",
"decoded",
"resposne",
"body",
"from",
"Network_getResponseBody",
"()"
] | fake-name/ChromeController | python | https://github.com/fake-name/ChromeController/blob/914dd136184e8f1165c7aa6ef30418aaf10c61f0/ChromeController/manager.py#L527-L546 | [
"def",
"get_unpacked_response_body",
"(",
"self",
",",
"requestId",
",",
"mimetype",
"=",
"\"application/unknown\"",
")",
":",
"content",
"=",
"self",
".",
"Network_getResponseBody",
"(",
"requestId",
")",
"assert",
"'result'",
"in",
"content",
"result",
"=",
"con... | 914dd136184e8f1165c7aa6ef30418aaf10c61f0 |
train | ChromeRemoteDebugInterface.handle_page_location_changed | If the chrome tab has internally redirected (generally because jerberscript), this
will walk the page navigation responses and attempt to fetch the response body for
the tab's latest location. | ChromeController/manager.py | def handle_page_location_changed(self, timeout=None):
'''
If the chrome tab has internally redirected (generally because jerberscript), this
will walk the page navigation responses and attempt to fetch the response body for
the tab's latest location.
'''
# In general, this is often called after other mecha... | def handle_page_location_changed(self, timeout=None):
'''
If the chrome tab has internally redirected (generally because jerberscript), this
will walk the page navigation responses and attempt to fetch the response body for
the tab's latest location.
'''
# In general, this is often called after other mecha... | [
"If",
"the",
"chrome",
"tab",
"has",
"internally",
"redirected",
"(",
"generally",
"because",
"jerberscript",
")",
"this",
"will",
"walk",
"the",
"page",
"navigation",
"responses",
"and",
"attempt",
"to",
"fetch",
"the",
"response",
"body",
"for",
"the",
"tab"... | fake-name/ChromeController | python | https://github.com/fake-name/ChromeController/blob/914dd136184e8f1165c7aa6ef30418aaf10c61f0/ChromeController/manager.py#L549-L587 | [
"def",
"handle_page_location_changed",
"(",
"self",
",",
"timeout",
"=",
"None",
")",
":",
"# In general, this is often called after other mechanisms have confirmed",
"# that the tab has already navigated. As such, we want to not wait a while",
"# to discover something went wrong, so use a t... | 914dd136184e8f1165c7aa6ef30418aaf10c61f0 |
train | ChromeRemoteDebugInterface.blocking_navigate_and_get_source | Do a blocking navigate to url `url`, and then extract the
response body and return that.
This effectively returns the *unrendered* page content that's sent over the wire. As such,
if the page does any modification of the contained markup during rendering (via javascript), this
function will not reflect the cha... | ChromeController/manager.py | def blocking_navigate_and_get_source(self, url, timeout=DEFAULT_TIMEOUT_SECS):
'''
Do a blocking navigate to url `url`, and then extract the
response body and return that.
This effectively returns the *unrendered* page content that's sent over the wire. As such,
if the page does any modification of the conta... | def blocking_navigate_and_get_source(self, url, timeout=DEFAULT_TIMEOUT_SECS):
'''
Do a blocking navigate to url `url`, and then extract the
response body and return that.
This effectively returns the *unrendered* page content that's sent over the wire. As such,
if the page does any modification of the conta... | [
"Do",
"a",
"blocking",
"navigate",
"to",
"url",
"url",
"and",
"then",
"extract",
"the",
"response",
"body",
"and",
"return",
"that",
"."
] | fake-name/ChromeController | python | https://github.com/fake-name/ChromeController/blob/914dd136184e8f1165c7aa6ef30418aaf10c61f0/ChromeController/manager.py#L589-L633 | [
"def",
"blocking_navigate_and_get_source",
"(",
"self",
",",
"url",
",",
"timeout",
"=",
"DEFAULT_TIMEOUT_SECS",
")",
":",
"resp",
"=",
"self",
".",
"blocking_navigate",
"(",
"url",
",",
"timeout",
")",
"assert",
"'requestId'",
"in",
"resp",
"assert",
"'response... | 914dd136184e8f1165c7aa6ef30418aaf10c61f0 |
train | ChromeRemoteDebugInterface.get_rendered_page_source | Get the HTML markup for the current page.
This is done by looking up the root DOM node, and then requesting the outer HTML
for that node ID.
This calls return will reflect any modifications made by javascript to the
page. For unmodified content, use `blocking_navigate_and_get_source()`
dom_idle_requirement... | ChromeController/manager.py | def get_rendered_page_source(self, dom_idle_requirement_secs=3, max_wait_timeout=30):
'''
Get the HTML markup for the current page.
This is done by looking up the root DOM node, and then requesting the outer HTML
for that node ID.
This calls return will reflect any modifications made by javascript to the
... | def get_rendered_page_source(self, dom_idle_requirement_secs=3, max_wait_timeout=30):
'''
Get the HTML markup for the current page.
This is done by looking up the root DOM node, and then requesting the outer HTML
for that node ID.
This calls return will reflect any modifications made by javascript to the
... | [
"Get",
"the",
"HTML",
"markup",
"for",
"the",
"current",
"page",
"."
] | fake-name/ChromeController | python | https://github.com/fake-name/ChromeController/blob/914dd136184e8f1165c7aa6ef30418aaf10c61f0/ChromeController/manager.py#L636-L698 | [
"def",
"get_rendered_page_source",
"(",
"self",
",",
"dom_idle_requirement_secs",
"=",
"3",
",",
"max_wait_timeout",
"=",
"30",
")",
":",
"# There are a bunch of events which generally indicate a page is still doing *things*.",
"# I have some concern about how this will handle things l... | 914dd136184e8f1165c7aa6ef30418aaf10c61f0 |
train | ChromeRemoteDebugInterface.take_screeshot | Take a screenshot of the virtual viewport content.
Return value is a png image as a bytestring. | ChromeController/manager.py | def take_screeshot(self):
'''
Take a screenshot of the virtual viewport content.
Return value is a png image as a bytestring.
'''
resp = self.Page_captureScreenshot()
assert 'result' in resp
assert 'data' in resp['result']
imgdat = base64.b64decode(resp['result']['data'])
return imgdat | def take_screeshot(self):
'''
Take a screenshot of the virtual viewport content.
Return value is a png image as a bytestring.
'''
resp = self.Page_captureScreenshot()
assert 'result' in resp
assert 'data' in resp['result']
imgdat = base64.b64decode(resp['result']['data'])
return imgdat | [
"Take",
"a",
"screenshot",
"of",
"the",
"virtual",
"viewport",
"content",
"."
] | fake-name/ChromeController | python | https://github.com/fake-name/ChromeController/blob/914dd136184e8f1165c7aa6ef30418aaf10c61f0/ChromeController/manager.py#L701-L711 | [
"def",
"take_screeshot",
"(",
"self",
")",
":",
"resp",
"=",
"self",
".",
"Page_captureScreenshot",
"(",
")",
"assert",
"'result'",
"in",
"resp",
"assert",
"'data'",
"in",
"resp",
"[",
"'result'",
"]",
"imgdat",
"=",
"base64",
".",
"b64decode",
"(",
"resp"... | 914dd136184e8f1165c7aa6ef30418aaf10c61f0 |
train | ChromeRemoteDebugInterface.blocking_navigate | Do a blocking navigate to url `url`.
This function triggers a navigation, and then waits for the browser
to claim the page has finished loading.
Roughly, this corresponds to the javascript `DOMContentLoaded` event,
meaning the dom for the page is ready.
Internals:
A navigation command results in a sequ... | ChromeController/manager.py | def blocking_navigate(self, url, timeout=DEFAULT_TIMEOUT_SECS):
'''
Do a blocking navigate to url `url`.
This function triggers a navigation, and then waits for the browser
to claim the page has finished loading.
Roughly, this corresponds to the javascript `DOMContentLoaded` event,
meaning the dom for the... | def blocking_navigate(self, url, timeout=DEFAULT_TIMEOUT_SECS):
'''
Do a blocking navigate to url `url`.
This function triggers a navigation, and then waits for the browser
to claim the page has finished loading.
Roughly, this corresponds to the javascript `DOMContentLoaded` event,
meaning the dom for the... | [
"Do",
"a",
"blocking",
"navigate",
"to",
"url",
"url",
"."
] | fake-name/ChromeController | python | https://github.com/fake-name/ChromeController/blob/914dd136184e8f1165c7aa6ef30418aaf10c61f0/ChromeController/manager.py#L714-L780 | [
"def",
"blocking_navigate",
"(",
"self",
",",
"url",
",",
"timeout",
"=",
"DEFAULT_TIMEOUT_SECS",
")",
":",
"self",
".",
"transport",
".",
"flush",
"(",
"tab_key",
"=",
"self",
".",
"tab_id",
")",
"ret",
"=",
"self",
".",
"Page_navigate",
"(",
"url",
"="... | 914dd136184e8f1165c7aa6ef30418aaf10c61f0 |
train | TabPooledChromium.tab | Get a chromium tab from the pool, optionally one that has an association with a specific netloc/URL.
If no url or netloc is specified, the per-thread identifier will be used.
If `extra_id` is specified, it's stringified value will be mixed into the pool key
If `use_tid` is true, the per-thread identifier will be... | ChromeController/tab_pool.py | def tab(self, netloc=None, url=None, extra_id=None, use_tid=False):
'''
Get a chromium tab from the pool, optionally one that has an association with a specific netloc/URL.
If no url or netloc is specified, the per-thread identifier will be used.
If `extra_id` is specified, it's stringified value will be mixed... | def tab(self, netloc=None, url=None, extra_id=None, use_tid=False):
'''
Get a chromium tab from the pool, optionally one that has an association with a specific netloc/URL.
If no url or netloc is specified, the per-thread identifier will be used.
If `extra_id` is specified, it's stringified value will be mixed... | [
"Get",
"a",
"chromium",
"tab",
"from",
"the",
"pool",
"optionally",
"one",
"that",
"has",
"an",
"association",
"with",
"a",
"specific",
"netloc",
"/",
"URL",
"."
] | fake-name/ChromeController | python | https://github.com/fake-name/ChromeController/blob/914dd136184e8f1165c7aa6ef30418aaf10c61f0/ChromeController/tab_pool.py#L88-L132 | [
"def",
"tab",
"(",
"self",
",",
"netloc",
"=",
"None",
",",
"url",
"=",
"None",
",",
"extra_id",
"=",
"None",
",",
"use_tid",
"=",
"False",
")",
":",
"assert",
"self",
".",
"alive",
",",
"\"Chrome has been shut down! Cannot continue!\"",
"if",
"not",
"netl... | 914dd136184e8f1165c7aa6ef30418aaf10c61f0 |
train | on_parent_exit | Return a function to be run in a child process which will trigger SIGNAME
to be sent when the parent process dies | ChromeController/exit_handler.py | def on_parent_exit(signame):
"""
Return a function to be run in a child process which will trigger SIGNAME
to be sent when the parent process dies
"""
signum = getattr(signal, signame)
def set_parent_exit_signal():
# http://linux.die.net/man/2/prctl
result = cdll['libc.so.6'].prc... | def on_parent_exit(signame):
"""
Return a function to be run in a child process which will trigger SIGNAME
to be sent when the parent process dies
"""
signum = getattr(signal, signame)
def set_parent_exit_signal():
# http://linux.die.net/man/2/prctl
result = cdll['libc.so.6'].prc... | [
"Return",
"a",
"function",
"to",
"be",
"run",
"in",
"a",
"child",
"process",
"which",
"will",
"trigger",
"SIGNAME",
"to",
"be",
"sent",
"when",
"the",
"parent",
"process",
"dies"
] | fake-name/ChromeController | python | https://github.com/fake-name/ChromeController/blob/914dd136184e8f1165c7aa6ef30418aaf10c61f0/ChromeController/exit_handler.py#L22-L33 | [
"def",
"on_parent_exit",
"(",
"signame",
")",
":",
"signum",
"=",
"getattr",
"(",
"signal",
",",
"signame",
")",
"def",
"set_parent_exit_signal",
"(",
")",
":",
"# http://linux.die.net/man/2/prctl",
"result",
"=",
"cdll",
"[",
"'libc.so.6'",
"]",
".",
"prctl",
... | 914dd136184e8f1165c7aa6ef30418aaf10c61f0 |
train | ChromeContext | Context manager for conveniently handling the lifetime of the underlying chromium instance.
In general, this should be the preferred way to use an instance of `ChromeRemoteDebugInterface`.
All parameters are forwarded through to the underlying ChromeRemoteDebugInterface() constructor. | ChromeController/chrome_context.py | def ChromeContext(*args, **kwargs):
'''
Context manager for conveniently handling the lifetime of the underlying chromium instance.
In general, this should be the preferred way to use an instance of `ChromeRemoteDebugInterface`.
All parameters are forwarded through to the underlying ChromeRemoteDebugInterface() c... | def ChromeContext(*args, **kwargs):
'''
Context manager for conveniently handling the lifetime of the underlying chromium instance.
In general, this should be the preferred way to use an instance of `ChromeRemoteDebugInterface`.
All parameters are forwarded through to the underlying ChromeRemoteDebugInterface() c... | [
"Context",
"manager",
"for",
"conveniently",
"handling",
"the",
"lifetime",
"of",
"the",
"underlying",
"chromium",
"instance",
"."
] | fake-name/ChromeController | python | https://github.com/fake-name/ChromeController/blob/914dd136184e8f1165c7aa6ef30418aaf10c61f0/ChromeController/chrome_context.py#L9-L34 | [
"def",
"ChromeContext",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"log",
"=",
"logging",
".",
"getLogger",
"(",
"\"Main.ChromeController.ChromeContext\"",
")",
"chrome_created",
"=",
"False",
"try",
":",
"chrome_instance",
"=",
"ChromeRemoteDebugInterfa... | 914dd136184e8f1165c7aa6ef30418aaf10c61f0 |
train | ChromeInterface.synchronous_command | Forward a command to the remote chrome instance via the transport
connection, and check the return for an error.
If the command resulted in an error, a `ChromeController.ChromeError` is raised,
with the error string containing the response from the remote
chrome instance describing the problem and it's cause.
... | ChromeController/manager_base.py | def synchronous_command(self, *args, **kwargs):
'''
Forward a command to the remote chrome instance via the transport
connection, and check the return for an error.
If the command resulted in an error, a `ChromeController.ChromeError` is raised,
with the error string containing the response from the remote
... | def synchronous_command(self, *args, **kwargs):
'''
Forward a command to the remote chrome instance via the transport
connection, and check the return for an error.
If the command resulted in an error, a `ChromeController.ChromeError` is raised,
with the error string containing the response from the remote
... | [
"Forward",
"a",
"command",
"to",
"the",
"remote",
"chrome",
"instance",
"via",
"the",
"transport",
"connection",
"and",
"check",
"the",
"return",
"for",
"an",
"error",
"."
] | fake-name/ChromeController | python | https://github.com/fake-name/ChromeController/blob/914dd136184e8f1165c7aa6ef30418aaf10c61f0/ChromeController/manager_base.py#L82-L101 | [
"def",
"synchronous_command",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"transport",
".",
"check_process_ded",
"(",
")",
"ret",
"=",
"self",
".",
"transport",
".",
"synchronous_command",
"(",
"tab_key",
"=",
"self",
"... | 914dd136184e8f1165c7aa6ef30418aaf10c61f0 |
train | ChromeInterface.drain_transport | "Drain" the transport connection.
This command simply returns all waiting messages sent from the remote chrome
instance. This can be useful when waiting for a specific asynchronous message
from chrome, but higher level calls are better suited for managing wait-for-message
type needs. | ChromeController/manager_base.py | def drain_transport(self):
'''
"Drain" the transport connection.
This command simply returns all waiting messages sent from the remote chrome
instance. This can be useful when waiting for a specific asynchronous message
from chrome, but higher level calls are better suited for managing wait-for-message
typ... | def drain_transport(self):
'''
"Drain" the transport connection.
This command simply returns all waiting messages sent from the remote chrome
instance. This can be useful when waiting for a specific asynchronous message
from chrome, but higher level calls are better suited for managing wait-for-message
typ... | [
"Drain",
"the",
"transport",
"connection",
"."
] | fake-name/ChromeController | python | https://github.com/fake-name/ChromeController/blob/914dd136184e8f1165c7aa6ef30418aaf10c61f0/ChromeController/manager_base.py#L103-L116 | [
"def",
"drain_transport",
"(",
"self",
")",
":",
"self",
".",
"transport",
".",
"check_process_ded",
"(",
")",
"ret",
"=",
"self",
".",
"transport",
".",
"drain",
"(",
"tab_key",
"=",
"self",
".",
"tab_id",
")",
"self",
".",
"transport",
".",
"check_proc... | 914dd136184e8f1165c7aa6ef30418aaf10c61f0 |
train | resetLoggingLocks | This function is a HACK!
Basically, if we fork() while a logging lock is held, the lock
is /copied/ while in the acquired state. However, since we've
forked, the thread that acquired the lock no longer exists,
so it can never unlock the lock, and we end up blocking
forever.
Therefore, we manually enter the logg... | logSetup.py | def resetLoggingLocks():
'''
This function is a HACK!
Basically, if we fork() while a logging lock is held, the lock
is /copied/ while in the acquired state. However, since we've
forked, the thread that acquired the lock no longer exists,
so it can never unlock the lock, and we end up blocking
forever.
Theref... | def resetLoggingLocks():
'''
This function is a HACK!
Basically, if we fork() while a logging lock is held, the lock
is /copied/ while in the acquired state. However, since we've
forked, the thread that acquired the lock no longer exists,
so it can never unlock the lock, and we end up blocking
forever.
Theref... | [
"This",
"function",
"is",
"a",
"HACK!"
] | fake-name/ChromeController | python | https://github.com/fake-name/ChromeController/blob/914dd136184e8f1165c7aa6ef30418aaf10c61f0/logSetup.py#L51-L81 | [
"def",
"resetLoggingLocks",
"(",
")",
":",
"try",
":",
"logging",
".",
"_releaseLock",
"(",
")",
"except",
"RuntimeError",
":",
"pass",
"# The lock is already released",
"# Iterate over the root logger hierarchy, and",
"# force-free all locks.",
"# if logging.Logger.root",
"f... | 914dd136184e8f1165c7aa6ef30418aaf10c61f0 |
train | RobustFileHandler.stream_emit | Emit a record.
If a formatter is specified, it is used to format the record.
The record is then written to the stream with a trailing newline. If
exception information is present, it is formatted using
traceback.print_exception and appended to the stream. If the stream
has an 'encoding' attribute, it is us... | logSetup.py | def stream_emit(self, record, source_name):
"""
Emit a record.
If a formatter is specified, it is used to format the record.
The record is then written to the stream with a trailing newline. If
exception information is present, it is formatted using
traceback.print_exception and appended to the stream. I... | def stream_emit(self, record, source_name):
"""
Emit a record.
If a formatter is specified, it is used to format the record.
The record is then written to the stream with a trailing newline. If
exception information is present, it is formatted using
traceback.print_exception and appended to the stream. I... | [
"Emit",
"a",
"record",
"."
] | fake-name/ChromeController | python | https://github.com/fake-name/ChromeController/blob/914dd136184e8f1165c7aa6ef30418aaf10c61f0/logSetup.py#L177-L204 | [
"def",
"stream_emit",
"(",
"self",
",",
"record",
",",
"source_name",
")",
":",
"if",
"not",
"source_name",
"in",
"self",
".",
"output_streams",
":",
"out_path",
"=",
"os",
".",
"path",
".",
"abspath",
"(",
"\"./logs\"",
")",
"logpath",
"=",
"ansi_escape",... | 914dd136184e8f1165c7aa6ef30418aaf10c61f0 |
train | RobustFileHandler.emit | Emit a record.
If the stream was not opened because 'delay' was specified in the
constructor, open it before calling the superclass's emit. | logSetup.py | def emit(self, record):
"""
Emit a record.
If the stream was not opened because 'delay' was specified in the
constructor, open it before calling the superclass's emit.
"""
failures = 0
while failures < 3:
try:
self.stream_emit(record, record.name)
break
except:
failures += 1
else:
... | def emit(self, record):
"""
Emit a record.
If the stream was not opened because 'delay' was specified in the
constructor, open it before calling the superclass's emit.
"""
failures = 0
while failures < 3:
try:
self.stream_emit(record, record.name)
break
except:
failures += 1
else:
... | [
"Emit",
"a",
"record",
"."
] | fake-name/ChromeController | python | https://github.com/fake-name/ChromeController/blob/914dd136184e8f1165c7aa6ef30418aaf10c61f0/logSetup.py#L206-L225 | [
"def",
"emit",
"(",
"self",
",",
"record",
")",
":",
"failures",
"=",
"0",
"while",
"failures",
"<",
"3",
":",
"try",
":",
"self",
".",
"stream_emit",
"(",
"record",
",",
"record",
".",
"name",
")",
"break",
"except",
":",
"failures",
"+=",
"1",
"e... | 914dd136184e8f1165c7aa6ef30418aaf10c61f0 |
train | ColourRunnerMixin.run_suite | This is the version from Django 1.7. | colour_runner/django_runner.py | def run_suite(self, suite, **kwargs):
"""This is the version from Django 1.7."""
return self.test_runner(
verbosity=self.verbosity,
failfast=self.failfast,
no_colour=self.no_colour,
).run(suite) | def run_suite(self, suite, **kwargs):
"""This is the version from Django 1.7."""
return self.test_runner(
verbosity=self.verbosity,
failfast=self.failfast,
no_colour=self.no_colour,
).run(suite) | [
"This",
"is",
"the",
"version",
"from",
"Django",
"1",
".",
"7",
"."
] | meshy/colour-runner | python | https://github.com/meshy/colour-runner/blob/40301226e37ce0901904746f373a5816fb22f022/colour_runner/django_runner.py#L11-L17 | [
"def",
"run_suite",
"(",
"self",
",",
"suite",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"self",
".",
"test_runner",
"(",
"verbosity",
"=",
"self",
".",
"verbosity",
",",
"failfast",
"=",
"self",
".",
"failfast",
",",
"no_colour",
"=",
"self",
".",
... | 40301226e37ce0901904746f373a5816fb22f022 |
train | DiffieHellman.generate_private_key | Generates a private key of key_length bits and attaches it to the object as the __private_key variable.
:return: void
:rtype: void | diffiehellman/diffiehellman.py | def generate_private_key(self):
"""
Generates a private key of key_length bits and attaches it to the object as the __private_key variable.
:return: void
:rtype: void
"""
key_length = self.key_length // 8 + 8
key = 0
try:
key = int.from_bytes... | def generate_private_key(self):
"""
Generates a private key of key_length bits and attaches it to the object as the __private_key variable.
:return: void
:rtype: void
"""
key_length = self.key_length // 8 + 8
key = 0
try:
key = int.from_bytes... | [
"Generates",
"a",
"private",
"key",
"of",
"key_length",
"bits",
"and",
"attaches",
"it",
"to",
"the",
"object",
"as",
"the",
"__private_key",
"variable",
"."
] | chrisvoncsefalvay/diffiehellman | python | https://github.com/chrisvoncsefalvay/diffiehellman/blob/06e656ea918c6c069d931a4e9443cb4b57d0a0cb/diffiehellman/diffiehellman.py#L60-L75 | [
"def",
"generate_private_key",
"(",
"self",
")",
":",
"key_length",
"=",
"self",
".",
"key_length",
"//",
"8",
"+",
"8",
"key",
"=",
"0",
"try",
":",
"key",
"=",
"int",
".",
"from_bytes",
"(",
"rng",
"(",
"key_length",
")",
",",
"byteorder",
"=",
"'b... | 06e656ea918c6c069d931a4e9443cb4b57d0a0cb |
train | DiffieHellman.generate_public_key | Generates public key.
:return: void
:rtype: void | diffiehellman/diffiehellman.py | def generate_public_key(self):
"""
Generates public key.
:return: void
:rtype: void
"""
self.public_key = pow(self.generator,
self.__private_key,
self.prime) | def generate_public_key(self):
"""
Generates public key.
:return: void
:rtype: void
"""
self.public_key = pow(self.generator,
self.__private_key,
self.prime) | [
"Generates",
"public",
"key",
"."
] | chrisvoncsefalvay/diffiehellman | python | https://github.com/chrisvoncsefalvay/diffiehellman/blob/06e656ea918c6c069d931a4e9443cb4b57d0a0cb/diffiehellman/diffiehellman.py#L81-L90 | [
"def",
"generate_public_key",
"(",
"self",
")",
":",
"self",
".",
"public_key",
"=",
"pow",
"(",
"self",
".",
"generator",
",",
"self",
".",
"__private_key",
",",
"self",
".",
"prime",
")"
] | 06e656ea918c6c069d931a4e9443cb4b57d0a0cb |
train | DiffieHellman.generate_shared_secret | Generates shared secret from the other party's public key.
:param other_public_key: Other party's public key
:type other_public_key: int
:param echo_return_key: Echo return shared key
:type bool
:return: void
:rtype: void | diffiehellman/diffiehellman.py | def generate_shared_secret(self, other_public_key, echo_return_key=False):
"""
Generates shared secret from the other party's public key.
:param other_public_key: Other party's public key
:type other_public_key: int
:param echo_return_key: Echo return shared key
:type bo... | def generate_shared_secret(self, other_public_key, echo_return_key=False):
"""
Generates shared secret from the other party's public key.
:param other_public_key: Other party's public key
:type other_public_key: int
:param echo_return_key: Echo return shared key
:type bo... | [
"Generates",
"shared",
"secret",
"from",
"the",
"other",
"party",
"s",
"public",
"key",
"."
] | chrisvoncsefalvay/diffiehellman | python | https://github.com/chrisvoncsefalvay/diffiehellman/blob/06e656ea918c6c069d931a4e9443cb4b57d0a0cb/diffiehellman/diffiehellman.py#L93-L119 | [
"def",
"generate_shared_secret",
"(",
"self",
",",
"other_public_key",
",",
"echo_return_key",
"=",
"False",
")",
":",
"if",
"self",
".",
"verify_public_key",
"(",
"other_public_key",
")",
"is",
"False",
":",
"raise",
"MalformedPublicKey",
"self",
".",
"shared_sec... | 06e656ea918c6c069d931a4e9443cb4b57d0a0cb |
train | requires_private_key | Decorator for functions that require the private key to be defined. | diffiehellman/decorators.py | def requires_private_key(func):
"""
Decorator for functions that require the private key to be defined.
"""
def func_wrapper(self, *args, **kwargs):
if hasattr(self, "_DiffieHellman__private_key"):
func(self, *args, **kwargs)
else:
self.generate_private_key()
... | def requires_private_key(func):
"""
Decorator for functions that require the private key to be defined.
"""
def func_wrapper(self, *args, **kwargs):
if hasattr(self, "_DiffieHellman__private_key"):
func(self, *args, **kwargs)
else:
self.generate_private_key()
... | [
"Decorator",
"for",
"functions",
"that",
"require",
"the",
"private",
"key",
"to",
"be",
"defined",
"."
] | chrisvoncsefalvay/diffiehellman | python | https://github.com/chrisvoncsefalvay/diffiehellman/blob/06e656ea918c6c069d931a4e9443cb4b57d0a0cb/diffiehellman/decorators.py#L32-L44 | [
"def",
"requires_private_key",
"(",
"func",
")",
":",
"def",
"func_wrapper",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"hasattr",
"(",
"self",
",",
"\"_DiffieHellman__private_key\"",
")",
":",
"func",
"(",
"self",
",",
"*",
... | 06e656ea918c6c069d931a4e9443cb4b57d0a0cb |
train | requires_public_key | Decorator for functions that require the public key to be defined. By definition, this includes the private key, as such, it's enough to use this to effect definition of both public and private key. | diffiehellman/decorators.py | def requires_public_key(func):
"""
Decorator for functions that require the public key to be defined. By definition, this includes the private key, as such, it's enough to use this to effect definition of both public and private key.
"""
def func_wrapper(self, *args, **kwargs):
if hasattr(self,... | def requires_public_key(func):
"""
Decorator for functions that require the public key to be defined. By definition, this includes the private key, as such, it's enough to use this to effect definition of both public and private key.
"""
def func_wrapper(self, *args, **kwargs):
if hasattr(self,... | [
"Decorator",
"for",
"functions",
"that",
"require",
"the",
"public",
"key",
"to",
"be",
"defined",
".",
"By",
"definition",
"this",
"includes",
"the",
"private",
"key",
"as",
"such",
"it",
"s",
"enough",
"to",
"use",
"this",
"to",
"effect",
"definition",
"... | chrisvoncsefalvay/diffiehellman | python | https://github.com/chrisvoncsefalvay/diffiehellman/blob/06e656ea918c6c069d931a4e9443cb4b57d0a0cb/diffiehellman/decorators.py#L47-L59 | [
"def",
"requires_public_key",
"(",
"func",
")",
":",
"def",
"func_wrapper",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"hasattr",
"(",
"self",
",",
"\"public_key\"",
")",
":",
"func",
"(",
"self",
",",
"*",
"args",
",",
... | 06e656ea918c6c069d931a4e9443cb4b57d0a0cb |
train | print_debug | Print if and only if the debug flag is set true in the config.yaml file.
Args:
args : var args of print arguments. | wtframework/wtf/utils/debug_utils.py | def print_debug(*args, **kwargs):
"""
Print if and only if the debug flag is set true in the config.yaml file.
Args:
args : var args of print arguments.
"""
if WTF_CONFIG_READER.get("debug", False) == True:
print(*args, **kwargs) | def print_debug(*args, **kwargs):
"""
Print if and only if the debug flag is set true in the config.yaml file.
Args:
args : var args of print arguments.
"""
if WTF_CONFIG_READER.get("debug", False) == True:
print(*args, **kwargs) | [
"Print",
"if",
"and",
"only",
"if",
"the",
"debug",
"flag",
"is",
"set",
"true",
"in",
"the",
"config",
".",
"yaml",
"file",
"."
] | wiredrive/wtframework | python | https://github.com/wiredrive/wtframework/blob/ef7f86c4d4cf7fb17745fd627b3cc4a41f4c0216/wtframework/wtf/utils/debug_utils.py#L64-L73 | [
"def",
"print_debug",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"WTF_CONFIG_READER",
".",
"get",
"(",
"\"debug\"",
",",
"False",
")",
"==",
"True",
":",
"print",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | ef7f86c4d4cf7fb17745fd627b3cc4a41f4c0216 |
train | TimeDebugger.print_time | Print the current elapsed time.
Kwargs:
message (str) : Message to prefix the time stamp.
print_frame_info (bool) : Add frame info to the print message. | wtframework/wtf/utils/debug_utils.py | def print_time(self, message="Time is now: ", print_frame_info=True):
"""
Print the current elapsed time.
Kwargs:
message (str) : Message to prefix the time stamp.
print_frame_info (bool) : Add frame info to the print message.
"""
if print_frame_info:
... | def print_time(self, message="Time is now: ", print_frame_info=True):
"""
Print the current elapsed time.
Kwargs:
message (str) : Message to prefix the time stamp.
print_frame_info (bool) : Add frame info to the print message.
"""
if print_frame_info:
... | [
"Print",
"the",
"current",
"elapsed",
"time",
"."
] | wiredrive/wtframework | python | https://github.com/wiredrive/wtframework/blob/ef7f86c4d4cf7fb17745fd627b3cc4a41f4c0216/wtframework/wtf/utils/debug_utils.py#L39-L52 | [
"def",
"print_time",
"(",
"self",
",",
"message",
"=",
"\"Time is now: \"",
",",
"print_frame_info",
"=",
"True",
")",
":",
"if",
"print_frame_info",
":",
"frame_info",
"=",
"inspect",
".",
"getouterframes",
"(",
"inspect",
".",
"currentframe",
"(",
")",
")",
... | ef7f86c4d4cf7fb17745fd627b3cc4a41f4c0216 |
train | WebUtils.check_url | Check if resource at URL is fetchable. (by trying to fetch it and checking for 200 status.
Args:
url (str): Url to check.
Returns:
Returns a tuple of {True/False, response code} | wtframework/wtf/web/web_utils.py | def check_url(url):
'''
Check if resource at URL is fetchable. (by trying to fetch it and checking for 200 status.
Args:
url (str): Url to check.
Returns:
Returns a tuple of {True/False, response code}
'''
request = urllib2.Request(url)
... | def check_url(url):
'''
Check if resource at URL is fetchable. (by trying to fetch it and checking for 200 status.
Args:
url (str): Url to check.
Returns:
Returns a tuple of {True/False, response code}
'''
request = urllib2.Request(url)
... | [
"Check",
"if",
"resource",
"at",
"URL",
"is",
"fetchable",
".",
"(",
"by",
"trying",
"to",
"fetch",
"it",
"and",
"checking",
"for",
"200",
"status",
"."
] | wiredrive/wtframework | python | https://github.com/wiredrive/wtframework/blob/ef7f86c4d4cf7fb17745fd627b3cc4a41f4c0216/wtframework/wtf/web/web_utils.py#L38-L54 | [
"def",
"check_url",
"(",
"url",
")",
":",
"request",
"=",
"urllib2",
".",
"Request",
"(",
"url",
")",
"try",
":",
"response",
"=",
"urlopen",
"(",
"request",
")",
"return",
"True",
",",
"response",
".",
"code",
"except",
"urllib2",
".",
"HTTPError",
"a... | ef7f86c4d4cf7fb17745fd627b3cc4a41f4c0216 |
train | WebUtils.get_base_url | Get the current base URL.
Args:
webdriver: Selenium WebDriver instance.
Returns:
str - base URL.
Usage::
driver.get("http://www.google.com/?q=hello+world")
WebUtils.get_base_url(driver)
#returns 'http://www.google.com' | wtframework/wtf/web/web_utils.py | def get_base_url(webdriver):
"""
Get the current base URL.
Args:
webdriver: Selenium WebDriver instance.
Returns:
str - base URL.
Usage::
driver.get("http://www.google.com/?q=hello+world")
WebUtils.get_base_url(driver)
... | def get_base_url(webdriver):
"""
Get the current base URL.
Args:
webdriver: Selenium WebDriver instance.
Returns:
str - base URL.
Usage::
driver.get("http://www.google.com/?q=hello+world")
WebUtils.get_base_url(driver)
... | [
"Get",
"the",
"current",
"base",
"URL",
"."
] | wiredrive/wtframework | python | https://github.com/wiredrive/wtframework/blob/ef7f86c4d4cf7fb17745fd627b3cc4a41f4c0216/wtframework/wtf/web/web_utils.py#L57-L79 | [
"def",
"get_base_url",
"(",
"webdriver",
")",
":",
"current_url",
"=",
"webdriver",
".",
"current_url",
"try",
":",
"return",
"re",
".",
"findall",
"(",
"\"^[^/]+//[^/$]+\"",
",",
"current_url",
")",
"[",
"0",
"]",
"except",
":",
"raise",
"RuntimeError",
"("... | ef7f86c4d4cf7fb17745fd627b3cc4a41f4c0216 |
train | WebUtils.get_browser_datetime | Get the current date/time on the web browser as a Python datetime object.
This date matches 'new Date();' when ran in JavaScript console.
Args:
webdriver: Selenium WebDriver instance
Returns:
datetime - Python datetime object.
Usage::
... | wtframework/wtf/web/web_utils.py | def get_browser_datetime(webdriver):
"""
Get the current date/time on the web browser as a Python datetime object.
This date matches 'new Date();' when ran in JavaScript console.
Args:
webdriver: Selenium WebDriver instance
Returns:
datetime - Py... | def get_browser_datetime(webdriver):
"""
Get the current date/time on the web browser as a Python datetime object.
This date matches 'new Date();' when ran in JavaScript console.
Args:
webdriver: Selenium WebDriver instance
Returns:
datetime - Py... | [
"Get",
"the",
"current",
"date",
"/",
"time",
"on",
"the",
"web",
"browser",
"as",
"a",
"Python",
"datetime",
"object",
".",
"This",
"date",
"matches",
"new",
"Date",
"()",
";",
"when",
"ran",
"in",
"JavaScript",
"console",
".",
"Args",
":",
"webdriver",... | wiredrive/wtframework | python | https://github.com/wiredrive/wtframework/blob/ef7f86c4d4cf7fb17745fd627b3cc4a41f4c0216/wtframework/wtf/web/web_utils.py#L82-L116 | [
"def",
"get_browser_datetime",
"(",
"webdriver",
")",
":",
"js_stmt",
"=",
"\"\"\"\n var wtf_get_date = new Date();\n return {'month':wtf_get_date.getMonth(), \n 'day':wtf_get_date.getDate(), \n 'year':wtf_get_date.getFullYear(),\n ... | ef7f86c4d4cf7fb17745fd627b3cc4a41f4c0216 |
train | WebUtils.is_webdriver_mobile | Check if a web driver if mobile.
Args:
webdriver (WebDriver): Selenium webdriver. | wtframework/wtf/web/web_utils.py | def is_webdriver_mobile(webdriver):
"""
Check if a web driver if mobile.
Args:
webdriver (WebDriver): Selenium webdriver.
"""
browser = webdriver.capabilities['browserName']
if (browser == u('iPhone') or
browser == u('android')):
re... | def is_webdriver_mobile(webdriver):
"""
Check if a web driver if mobile.
Args:
webdriver (WebDriver): Selenium webdriver.
"""
browser = webdriver.capabilities['browserName']
if (browser == u('iPhone') or
browser == u('android')):
re... | [
"Check",
"if",
"a",
"web",
"driver",
"if",
"mobile",
"."
] | wiredrive/wtframework | python | https://github.com/wiredrive/wtframework/blob/ef7f86c4d4cf7fb17745fd627b3cc4a41f4c0216/wtframework/wtf/web/web_utils.py#L119-L133 | [
"def",
"is_webdriver_mobile",
"(",
"webdriver",
")",
":",
"browser",
"=",
"webdriver",
".",
"capabilities",
"[",
"'browserName'",
"]",
"if",
"(",
"browser",
"==",
"u",
"(",
"'iPhone'",
")",
"or",
"browser",
"==",
"u",
"(",
"'android'",
")",
")",
":",
"re... | ef7f86c4d4cf7fb17745fd627b3cc4a41f4c0216 |
train | WebUtils.is_webdriver_ios | Check if a web driver if mobile.
Args:
webdriver (WebDriver): Selenium webdriver. | wtframework/wtf/web/web_utils.py | def is_webdriver_ios(webdriver):
"""
Check if a web driver if mobile.
Args:
webdriver (WebDriver): Selenium webdriver.
"""
browser = webdriver.capabilities['browserName']
if (browser == u('iPhone') or
browser == u('iPad')):
return T... | def is_webdriver_ios(webdriver):
"""
Check if a web driver if mobile.
Args:
webdriver (WebDriver): Selenium webdriver.
"""
browser = webdriver.capabilities['browserName']
if (browser == u('iPhone') or
browser == u('iPad')):
return T... | [
"Check",
"if",
"a",
"web",
"driver",
"if",
"mobile",
"."
] | wiredrive/wtframework | python | https://github.com/wiredrive/wtframework/blob/ef7f86c4d4cf7fb17745fd627b3cc4a41f4c0216/wtframework/wtf/web/web_utils.py#L136-L150 | [
"def",
"is_webdriver_ios",
"(",
"webdriver",
")",
":",
"browser",
"=",
"webdriver",
".",
"capabilities",
"[",
"'browserName'",
"]",
"if",
"(",
"browser",
"==",
"u",
"(",
"'iPhone'",
")",
"or",
"browser",
"==",
"u",
"(",
"'iPad'",
")",
")",
":",
"return",... | ef7f86c4d4cf7fb17745fd627b3cc4a41f4c0216 |
train | WebUtils.row_to_dictionary | Converts a row into a dictionary of key/values.
(Note: assumes all rows/columns have uniform cells. Does not
account for any row or column spans)
Args:
header_row_web_element (WebElement): WebElement reference to the column headers.
row_webelement (WebElement):... | wtframework/wtf/web/web_utils.py | def row_to_dictionary(header_row_web_element, row_webelement):
"""
Converts a row into a dictionary of key/values.
(Note: assumes all rows/columns have uniform cells. Does not
account for any row or column spans)
Args:
header_row_web_element (WebElement): W... | def row_to_dictionary(header_row_web_element, row_webelement):
"""
Converts a row into a dictionary of key/values.
(Note: assumes all rows/columns have uniform cells. Does not
account for any row or column spans)
Args:
header_row_web_element (WebElement): W... | [
"Converts",
"a",
"row",
"into",
"a",
"dictionary",
"of",
"key",
"/",
"values",
".",
"(",
"Note",
":",
"assumes",
"all",
"rows",
"/",
"columns",
"have",
"uniform",
"cells",
".",
"Does",
"not",
"account",
"for",
"any",
"row",
"or",
"column",
"spans",
")"... | wiredrive/wtframework | python | https://github.com/wiredrive/wtframework/blob/ef7f86c4d4cf7fb17745fd627b3cc4a41f4c0216/wtframework/wtf/web/web_utils.py#L154-L191 | [
"def",
"row_to_dictionary",
"(",
"header_row_web_element",
",",
"row_webelement",
")",
":",
"headers",
"=",
"header_row_web_element",
".",
"find_elements_by_tag_name",
"(",
"\"th\"",
")",
"data_cells",
"=",
"row_webelement",
".",
"find_elements_by_tag_name",
"(",
"\"td\""... | ef7f86c4d4cf7fb17745fd627b3cc4a41f4c0216 |
train | WebUtils.switch_to_window | Utility method for switching between windows. It will search through currently open
windows, then switch to the window matching the provided PageObject class.
Args:
page_class (PageObject): Page class to search for/instantiate.
webdriver (WebDriver): Selenium webdriver.
... | wtframework/wtf/web/web_utils.py | def switch_to_window(page_class, webdriver):
"""
Utility method for switching between windows. It will search through currently open
windows, then switch to the window matching the provided PageObject class.
Args:
page_class (PageObject): Page class to search for/instantia... | def switch_to_window(page_class, webdriver):
"""
Utility method for switching between windows. It will search through currently open
windows, then switch to the window matching the provided PageObject class.
Args:
page_class (PageObject): Page class to search for/instantia... | [
"Utility",
"method",
"for",
"switching",
"between",
"windows",
".",
"It",
"will",
"search",
"through",
"currently",
"open",
"windows",
"then",
"switch",
"to",
"the",
"window",
"matching",
"the",
"provided",
"PageObject",
"class",
"."
] | wiredrive/wtframework | python | https://github.com/wiredrive/wtframework/blob/ef7f86c4d4cf7fb17745fd627b3cc4a41f4c0216/wtframework/wtf/web/web_utils.py#L196-L221 | [
"def",
"switch_to_window",
"(",
"page_class",
",",
"webdriver",
")",
":",
"window_list",
"=",
"list",
"(",
"webdriver",
".",
"window_handles",
")",
"original_window",
"=",
"webdriver",
".",
"current_window_handle",
"for",
"window_handle",
"in",
"window_list",
":",
... | ef7f86c4d4cf7fb17745fd627b3cc4a41f4c0216 |
train | BrowserStandBy.start_standby | Create an instance of BrowserStandBy() and immediately return a running instance.
This is best used in a 'with' block.
Example::
with BrowserStandBy.start_standby():
# Now browser is in standby, you can do a bunch of stuff with in this block.
# ...
... | wtframework/wtf/web/web_utils.py | def start_standby(cls, webdriver=None, max_time=WTF_TIMEOUT_MANAGER.EPIC, sleep=5):
"""
Create an instance of BrowserStandBy() and immediately return a running instance.
This is best used in a 'with' block.
Example::
with BrowserStandBy.start_standby():
# N... | def start_standby(cls, webdriver=None, max_time=WTF_TIMEOUT_MANAGER.EPIC, sleep=5):
"""
Create an instance of BrowserStandBy() and immediately return a running instance.
This is best used in a 'with' block.
Example::
with BrowserStandBy.start_standby():
# N... | [
"Create",
"an",
"instance",
"of",
"BrowserStandBy",
"()",
"and",
"immediately",
"return",
"a",
"running",
"instance",
"."
] | wiredrive/wtframework | python | https://github.com/wiredrive/wtframework/blob/ef7f86c4d4cf7fb17745fd627b3cc4a41f4c0216/wtframework/wtf/web/web_utils.py#L267-L282 | [
"def",
"start_standby",
"(",
"cls",
",",
"webdriver",
"=",
"None",
",",
"max_time",
"=",
"WTF_TIMEOUT_MANAGER",
".",
"EPIC",
",",
"sleep",
"=",
"5",
")",
":",
"return",
"cls",
"(",
"webdriver",
"=",
"webdriver",
",",
"max_time",
"=",
"max_time",
",",
"sl... | ef7f86c4d4cf7fb17745fd627b3cc4a41f4c0216 |
train | BrowserStandBy.start | Start standing by. A periodic command like 'current_url' will be sent to the
webdriver instance to prevent it from timing out. | wtframework/wtf/web/web_utils.py | def start(self):
"""
Start standing by. A periodic command like 'current_url' will be sent to the
webdriver instance to prevent it from timing out.
"""
self._end_time = datetime.now() + timedelta(seconds=self._max_time)
self._thread = Thread(target=lambda: self.__stand... | def start(self):
"""
Start standing by. A periodic command like 'current_url' will be sent to the
webdriver instance to prevent it from timing out.
"""
self._end_time = datetime.now() + timedelta(seconds=self._max_time)
self._thread = Thread(target=lambda: self.__stand... | [
"Start",
"standing",
"by",
".",
"A",
"periodic",
"command",
"like",
"current_url",
"will",
"be",
"sent",
"to",
"the",
"webdriver",
"instance",
"to",
"prevent",
"it",
"from",
"timing",
"out",
"."
] | wiredrive/wtframework | python | https://github.com/wiredrive/wtframework/blob/ef7f86c4d4cf7fb17745fd627b3cc4a41f4c0216/wtframework/wtf/web/web_utils.py#L284-L294 | [
"def",
"start",
"(",
"self",
")",
":",
"self",
".",
"_end_time",
"=",
"datetime",
".",
"now",
"(",
")",
"+",
"timedelta",
"(",
"seconds",
"=",
"self",
".",
"_max_time",
")",
"self",
".",
"_thread",
"=",
"Thread",
"(",
"target",
"=",
"lambda",
":",
... | ef7f86c4d4cf7fb17745fd627b3cc4a41f4c0216 |
train | temp_path | Gets a temp path.
Kwargs:
file_name (str) : if file name is specified, it gets appended to the temp dir.
Usage::
temp_file_path = temp_path("myfile")
copyfile("myfile", temp_file_path) # copies 'myfile' to '/tmp/myfile' | wtframework/wtf/utils/file_utils.py | def temp_path(file_name=None):
"""
Gets a temp path.
Kwargs:
file_name (str) : if file name is specified, it gets appended to the temp dir.
Usage::
temp_file_path = temp_path("myfile")
copyfile("myfile", temp_file_path) # copies 'myfile' to '/tmp/myfile'
"""
if file_... | def temp_path(file_name=None):
"""
Gets a temp path.
Kwargs:
file_name (str) : if file name is specified, it gets appended to the temp dir.
Usage::
temp_file_path = temp_path("myfile")
copyfile("myfile", temp_file_path) # copies 'myfile' to '/tmp/myfile'
"""
if file_... | [
"Gets",
"a",
"temp",
"path",
"."
] | wiredrive/wtframework | python | https://github.com/wiredrive/wtframework/blob/ef7f86c4d4cf7fb17745fd627b3cc4a41f4c0216/wtframework/wtf/utils/file_utils.py#L29-L46 | [
"def",
"temp_path",
"(",
"file_name",
"=",
"None",
")",
":",
"if",
"file_name",
"is",
"None",
":",
"file_name",
"=",
"generate_timestamped_string",
"(",
"\"wtf_temp_file\"",
")",
"return",
"os",
".",
"path",
".",
"join",
"(",
"tempfile",
".",
"gettempdir",
"... | ef7f86c4d4cf7fb17745fd627b3cc4a41f4c0216 |
train | create_temp_file | Creates a temp file using a given name. Temp files are placed in the Project/temp/
directory. Any temp files being created with an existing temp file, will be
overridden. This is useful for testing uploads, where you would want to create a
temporary file with a desired name, upload it, then delete the... | wtframework/wtf/utils/file_utils.py | def create_temp_file(file_name=None, string_or_another_file=""):
"""
Creates a temp file using a given name. Temp files are placed in the Project/temp/
directory. Any temp files being created with an existing temp file, will be
overridden. This is useful for testing uploads, where you would want to... | def create_temp_file(file_name=None, string_or_another_file=""):
"""
Creates a temp file using a given name. Temp files are placed in the Project/temp/
directory. Any temp files being created with an existing temp file, will be
overridden. This is useful for testing uploads, where you would want to... | [
"Creates",
"a",
"temp",
"file",
"using",
"a",
"given",
"name",
".",
"Temp",
"files",
"are",
"placed",
"in",
"the",
"Project",
"/",
"temp",
"/",
"directory",
".",
"Any",
"temp",
"files",
"being",
"created",
"with",
"an",
"existing",
"temp",
"file",
"will"... | wiredrive/wtframework | python | https://github.com/wiredrive/wtframework/blob/ef7f86c4d4cf7fb17745fd627b3cc4a41f4c0216/wtframework/wtf/utils/file_utils.py#L49-L84 | [
"def",
"create_temp_file",
"(",
"file_name",
"=",
"None",
",",
"string_or_another_file",
"=",
"\"\"",
")",
":",
"temp_file_path",
"=",
"temp_path",
"(",
"file_name",
")",
"if",
"isinstance",
"(",
"string_or_another_file",
",",
"file",
")",
":",
"# attempt to read ... | ef7f86c4d4cf7fb17745fd627b3cc4a41f4c0216 |
train | download_to_tempfile | Downloads a URL contents to a tempfile. This is useful for testing downloads.
It will download the contents of a URL to a tempfile, which you then can
open and use to validate the downloaded contents.
Args:
url (str) : URL of the contents to download.
Kwargs:
file_name (str): Name of... | wtframework/wtf/utils/file_utils.py | def download_to_tempfile(url, file_name=None, extension=None):
"""
Downloads a URL contents to a tempfile. This is useful for testing downloads.
It will download the contents of a URL to a tempfile, which you then can
open and use to validate the downloaded contents.
Args:
url (str) : URL... | def download_to_tempfile(url, file_name=None, extension=None):
"""
Downloads a URL contents to a tempfile. This is useful for testing downloads.
It will download the contents of a URL to a tempfile, which you then can
open and use to validate the downloaded contents.
Args:
url (str) : URL... | [
"Downloads",
"a",
"URL",
"contents",
"to",
"a",
"tempfile",
".",
"This",
"is",
"useful",
"for",
"testing",
"downloads",
".",
"It",
"will",
"download",
"the",
"contents",
"of",
"a",
"URL",
"to",
"a",
"tempfile",
"which",
"you",
"then",
"can",
"open",
"and... | wiredrive/wtframework | python | https://github.com/wiredrive/wtframework/blob/ef7f86c4d4cf7fb17745fd627b3cc4a41f4c0216/wtframework/wtf/utils/file_utils.py#L87-L124 | [
"def",
"download_to_tempfile",
"(",
"url",
",",
"file_name",
"=",
"None",
",",
"extension",
"=",
"None",
")",
":",
"if",
"not",
"file_name",
":",
"file_name",
"=",
"generate_timestamped_string",
"(",
"\"wtf_temp_file\"",
")",
"if",
"extension",
":",
"file_path",... | ef7f86c4d4cf7fb17745fd627b3cc4a41f4c0216 |
train | PageObject.create_page | Class method short cut to call PageFactory on itself. Use it to instantiate
this PageObject using a webdriver.
Args:
webdriver (Webdriver): Instance of Selenium Webdriver.
Returns:
PageObject
Raises:
InvalidPageError | wtframework/wtf/web/page.py | def create_page(cls, webdriver=None, **kwargs):
"""Class method short cut to call PageFactory on itself. Use it to instantiate
this PageObject using a webdriver.
Args:
webdriver (Webdriver): Instance of Selenium Webdriver.
Returns:
PageObject
Raises:
... | def create_page(cls, webdriver=None, **kwargs):
"""Class method short cut to call PageFactory on itself. Use it to instantiate
this PageObject using a webdriver.
Args:
webdriver (Webdriver): Instance of Selenium Webdriver.
Returns:
PageObject
Raises:
... | [
"Class",
"method",
"short",
"cut",
"to",
"call",
"PageFactory",
"on",
"itself",
".",
"Use",
"it",
"to",
"instantiate",
"this",
"PageObject",
"using",
"a",
"webdriver",
"."
] | wiredrive/wtframework | python | https://github.com/wiredrive/wtframework/blob/ef7f86c4d4cf7fb17745fd627b3cc4a41f4c0216/wtframework/wtf/web/page.py#L114-L130 | [
"def",
"create_page",
"(",
"cls",
",",
"webdriver",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"not",
"webdriver",
":",
"webdriver",
"=",
"WTF_WEBDRIVER_MANAGER",
".",
"get_driver",
"(",
")",
"return",
"PageFactory",
".",
"create_page",
"(",
"cl... | ef7f86c4d4cf7fb17745fd627b3cc4a41f4c0216 |
train | PageFactory.create_page | Instantiate a page object from a given Interface or Abstract class.
Args:
page_object_class_or_interface (Class): PageObject class, AbstractBaseClass, or
Interface to attempt to consturct.
Kwargs:
webdriver (WebDriver): Selenium Webdriver to use to instantiate the ... | wtframework/wtf/web/page.py | def create_page(page_object_class_or_interface,
webdriver=None, **kwargs):
"""
Instantiate a page object from a given Interface or Abstract class.
Args:
page_object_class_or_interface (Class): PageObject class, AbstractBaseClass, or
Interface to atte... | def create_page(page_object_class_or_interface,
webdriver=None, **kwargs):
"""
Instantiate a page object from a given Interface or Abstract class.
Args:
page_object_class_or_interface (Class): PageObject class, AbstractBaseClass, or
Interface to atte... | [
"Instantiate",
"a",
"page",
"object",
"from",
"a",
"given",
"Interface",
"or",
"Abstract",
"class",
"."
] | wiredrive/wtframework | python | https://github.com/wiredrive/wtframework/blob/ef7f86c4d4cf7fb17745fd627b3cc4a41f4c0216/wtframework/wtf/web/page.py#L167-L296 | [
"def",
"create_page",
"(",
"page_object_class_or_interface",
",",
"webdriver",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"not",
"webdriver",
":",
"webdriver",
"=",
"WTF_WEBDRIVER_MANAGER",
".",
"get_driver",
"(",
")",
"# will be used later when tracking ... | ef7f86c4d4cf7fb17745fd627b3cc4a41f4c0216 |
train | PageFactory.__instantiate_page_object | Attempts to instantiate a page object.
Args:
page_obj_class (PageObject) - PageObject to instantiate.
webdriver (WebDriver) - Selenium webdriver to associate with the PageObject
Returns:
PageObject - If page object instantiation succeeded.
True -... | wtframework/wtf/web/page.py | def __instantiate_page_object(page_obj_class, webdriver, **kwargs):
"""
Attempts to instantiate a page object.
Args:
page_obj_class (PageObject) - PageObject to instantiate.
webdriver (WebDriver) - Selenium webdriver to associate with the PageObject
Retu... | def __instantiate_page_object(page_obj_class, webdriver, **kwargs):
"""
Attempts to instantiate a page object.
Args:
page_obj_class (PageObject) - PageObject to instantiate.
webdriver (WebDriver) - Selenium webdriver to associate with the PageObject
Retu... | [
"Attempts",
"to",
"instantiate",
"a",
"page",
"object",
"."
] | wiredrive/wtframework | python | https://github.com/wiredrive/wtframework/blob/ef7f86c4d4cf7fb17745fd627b3cc4a41f4c0216/wtframework/wtf/web/page.py#L299-L326 | [
"def",
"__instantiate_page_object",
"(",
"page_obj_class",
",",
"webdriver",
",",
"*",
"*",
"kwargs",
")",
":",
"try",
":",
"page",
"=",
"page_obj_class",
"(",
"webdriver",
",",
"*",
"*",
"kwargs",
")",
"return",
"page",
"except",
"InvalidPageError",
":",
"#... | ef7f86c4d4cf7fb17745fd627b3cc4a41f4c0216 |
train | PageFactory.__itersubclasses | Credit goes to: http://code.activestate.com/recipes/576949-find-all-subclasses-of-a-given-class/
itersubclasses(cls)
Generator over all subclasses of a given class, in depth first order.
>>> list(itersubclasses(int)) == [bool]
True
>>> class A(object): pass
>>> class B... | wtframework/wtf/web/page.py | def __itersubclasses(cls, _seen=None):
"""
Credit goes to: http://code.activestate.com/recipes/576949-find-all-subclasses-of-a-given-class/
itersubclasses(cls)
Generator over all subclasses of a given class, in depth first order.
>>> list(itersubclasses(int)) == [bool... | def __itersubclasses(cls, _seen=None):
"""
Credit goes to: http://code.activestate.com/recipes/576949-find-all-subclasses-of-a-given-class/
itersubclasses(cls)
Generator over all subclasses of a given class, in depth first order.
>>> list(itersubclasses(int)) == [bool... | [
"Credit",
"goes",
"to",
":",
"http",
":",
"//",
"code",
".",
"activestate",
".",
"com",
"/",
"recipes",
"/",
"576949",
"-",
"find",
"-",
"all",
"-",
"subclasses",
"-",
"of",
"-",
"a",
"-",
"given",
"-",
"class",
"/"
] | wiredrive/wtframework | python | https://github.com/wiredrive/wtframework/blob/ef7f86c4d4cf7fb17745fd627b3cc4a41f4c0216/wtframework/wtf/web/page.py#L330-L371 | [
"def",
"__itersubclasses",
"(",
"cls",
",",
"_seen",
"=",
"None",
")",
":",
"if",
"not",
"isinstance",
"(",
"cls",
",",
"type",
")",
":",
"raise",
"TypeError",
"(",
"u",
"(",
"'Argument ({0}) passed to PageFactory does not appear to be a valid Class.'",
")",
".",
... | ef7f86c4d4cf7fb17745fd627b3cc4a41f4c0216 |
train | PageObjectUtils.check_css_selectors | Returns true if all CSS selectors passed in is found. This can be used
to quickly validate a page.
Args:
webdriver (Webdriver) : Selenium Webdriver instance
selectors (str) : N number of CSS selectors strings to match against the page.
Returns:
True, False... | wtframework/wtf/web/page.py | def check_css_selectors(webdriver, *selectors):
"""Returns true if all CSS selectors passed in is found. This can be used
to quickly validate a page.
Args:
webdriver (Webdriver) : Selenium Webdriver instance
selectors (str) : N number of CSS selectors strings to match ... | def check_css_selectors(webdriver, *selectors):
"""Returns true if all CSS selectors passed in is found. This can be used
to quickly validate a page.
Args:
webdriver (Webdriver) : Selenium Webdriver instance
selectors (str) : N number of CSS selectors strings to match ... | [
"Returns",
"true",
"if",
"all",
"CSS",
"selectors",
"passed",
"in",
"is",
"found",
".",
"This",
"can",
"be",
"used",
"to",
"quickly",
"validate",
"a",
"page",
"."
] | wiredrive/wtframework | python | https://github.com/wiredrive/wtframework/blob/ef7f86c4d4cf7fb17745fd627b3cc4a41f4c0216/wtframework/wtf/web/page.py#L387-L413 | [
"def",
"check_css_selectors",
"(",
"webdriver",
",",
"*",
"selectors",
")",
":",
"for",
"selector",
"in",
"selectors",
":",
"try",
":",
"webdriver",
".",
"find_element_by_css_selector",
"(",
"selector",
")",
"except",
":",
"return",
"False",
"# A selector failed."... | ef7f86c4d4cf7fb17745fd627b3cc4a41f4c0216 |
train | PageUtils.wait_until_page_loaded | Waits until the page is loaded.
Args:
page_obj_class (Class) : PageObject class
Kwargs:
webdriver (Webdriver) : Selenium Webdriver. Default uses WTF_WEBDRIVER_MANAGER's instance.
timeout (number) : Number of seconds to wait to allow the page to load.
sl... | wtframework/wtf/web/page.py | def wait_until_page_loaded(page_obj_class,
webdriver=None,
timeout=WTF_TIMEOUT_MANAGER.NORMAL,
sleep=0.5,
bad_page_classes=[],
message=None,
... | def wait_until_page_loaded(page_obj_class,
webdriver=None,
timeout=WTF_TIMEOUT_MANAGER.NORMAL,
sleep=0.5,
bad_page_classes=[],
message=None,
... | [
"Waits",
"until",
"the",
"page",
"is",
"loaded",
"."
] | wiredrive/wtframework | python | https://github.com/wiredrive/wtframework/blob/ef7f86c4d4cf7fb17745fd627b3cc4a41f4c0216/wtframework/wtf/web/page.py#L422-L510 | [
"def",
"wait_until_page_loaded",
"(",
"page_obj_class",
",",
"webdriver",
"=",
"None",
",",
"timeout",
"=",
"WTF_TIMEOUT_MANAGER",
".",
"NORMAL",
",",
"sleep",
"=",
"0.5",
",",
"bad_page_classes",
"=",
"[",
"]",
",",
"message",
"=",
"None",
",",
"*",
"*",
... | ef7f86c4d4cf7fb17745fd627b3cc4a41f4c0216 |
train | PageUtils.wait_until_page_ready | Waits until document.readyState == Complete (e.g. ready to execute javascript commands)
Args:
page_object (PageObject) : PageObject class
Kwargs:
timeout (number) : timeout period | wtframework/wtf/web/page.py | def wait_until_page_ready(page_object, timeout=WTF_TIMEOUT_MANAGER.NORMAL):
"""Waits until document.readyState == Complete (e.g. ready to execute javascript commands)
Args:
page_object (PageObject) : PageObject class
Kwargs:
timeout (number) : timeout period
"""... | def wait_until_page_ready(page_object, timeout=WTF_TIMEOUT_MANAGER.NORMAL):
"""Waits until document.readyState == Complete (e.g. ready to execute javascript commands)
Args:
page_object (PageObject) : PageObject class
Kwargs:
timeout (number) : timeout period
"""... | [
"Waits",
"until",
"document",
".",
"readyState",
"==",
"Complete",
"(",
"e",
".",
"g",
".",
"ready",
"to",
"execute",
"javascript",
"commands",
")"
] | wiredrive/wtframework | python | https://github.com/wiredrive/wtframework/blob/ef7f86c4d4cf7fb17745fd627b3cc4a41f4c0216/wtframework/wtf/web/page.py#L513-L527 | [
"def",
"wait_until_page_ready",
"(",
"page_object",
",",
"timeout",
"=",
"WTF_TIMEOUT_MANAGER",
".",
"NORMAL",
")",
":",
"try",
":",
"do_until",
"(",
"lambda",
":",
"page_object",
".",
"webdriver",
".",
"execute_script",
"(",
"\"return document.readyState\"",
")",
... | ef7f86c4d4cf7fb17745fd627b3cc4a41f4c0216 |
train | AssetManager.get_asset_path | Get the full system path of a given asset if it exists. Otherwise it throws
an error.
Args:
filename (str) - File name of a file in /assets folder to fetch the path for.
Returns:
str - path to the target file.
Raises:
AssetNotFoundError - if asset... | wtframework/wtf/assets.py | def get_asset_path(self, filename):
"""
Get the full system path of a given asset if it exists. Otherwise it throws
an error.
Args:
filename (str) - File name of a file in /assets folder to fetch the path for.
Returns:
str - path to the target file.
... | def get_asset_path(self, filename):
"""
Get the full system path of a given asset if it exists. Otherwise it throws
an error.
Args:
filename (str) - File name of a file in /assets folder to fetch the path for.
Returns:
str - path to the target file.
... | [
"Get",
"the",
"full",
"system",
"path",
"of",
"a",
"given",
"asset",
"if",
"it",
"exists",
".",
"Otherwise",
"it",
"throws",
"an",
"error",
"."
] | wiredrive/wtframework | python | https://github.com/wiredrive/wtframework/blob/ef7f86c4d4cf7fb17745fd627b3cc4a41f4c0216/wtframework/wtf/assets.py#L47-L70 | [
"def",
"get_asset_path",
"(",
"self",
",",
"filename",
")",
":",
"if",
"os",
".",
"path",
".",
"exists",
"(",
"os",
".",
"path",
".",
"join",
"(",
"self",
".",
"_asset_path",
",",
"filename",
")",
")",
":",
"return",
"os",
".",
"path",
".",
"join",... | ef7f86c4d4cf7fb17745fd627b3cc4a41f4c0216 |
train | WebDriverFactory.create_webdriver | Creates an instance of Selenium webdriver based on config settings.
This should only be called by a shutdown hook. Do not call directly within
a test.
Kwargs:
testname: Optional test name to pass, this gets appended to the test name
sent ... | wtframework/wtf/web/webdriver.py | def create_webdriver(self, testname=None):
'''
Creates an instance of Selenium webdriver based on config settings.
This should only be called by a shutdown hook. Do not call directly within
a test.
Kwargs:
testname: Optional test name to pass, t... | def create_webdriver(self, testname=None):
'''
Creates an instance of Selenium webdriver based on config settings.
This should only be called by a shutdown hook. Do not call directly within
a test.
Kwargs:
testname: Optional test name to pass, t... | [
"Creates",
"an",
"instance",
"of",
"Selenium",
"webdriver",
"based",
"on",
"config",
"settings",
".",
"This",
"should",
"only",
"be",
"called",
"by",
"a",
"shutdown",
"hook",
".",
"Do",
"not",
"call",
"directly",
"within",
"a",
"test",
"."
] | wiredrive/wtframework | python | https://github.com/wiredrive/wtframework/blob/ef7f86c4d4cf7fb17745fd627b3cc4a41f4c0216/wtframework/wtf/web/webdriver.py#L116-L161 | [
"def",
"create_webdriver",
"(",
"self",
",",
"testname",
"=",
"None",
")",
":",
"try",
":",
"driver_type",
"=",
"self",
".",
"_config_reader",
".",
"get",
"(",
"self",
".",
"DRIVER_TYPE_CONFIG",
")",
"except",
":",
"driver_type",
"=",
"self",
".",
"DRIVER_... | ef7f86c4d4cf7fb17745fd627b3cc4a41f4c0216 |
train | WebDriverFactory.__create_driver_from_browser_config | Reads the config value for browser type. | wtframework/wtf/web/webdriver.py | def __create_driver_from_browser_config(self):
'''
Reads the config value for browser type.
'''
try:
browser_type = self._config_reader.get(
WebDriverFactory.BROWSER_TYPE_CONFIG)
except KeyError:
_wtflog("%s missing is missing from config f... | def __create_driver_from_browser_config(self):
'''
Reads the config value for browser type.
'''
try:
browser_type = self._config_reader.get(
WebDriverFactory.BROWSER_TYPE_CONFIG)
except KeyError:
_wtflog("%s missing is missing from config f... | [
"Reads",
"the",
"config",
"value",
"for",
"browser",
"type",
"."
] | wiredrive/wtframework | python | https://github.com/wiredrive/wtframework/blob/ef7f86c4d4cf7fb17745fd627b3cc4a41f4c0216/wtframework/wtf/web/webdriver.py#L163-L195 | [
"def",
"__create_driver_from_browser_config",
"(",
"self",
")",
":",
"try",
":",
"browser_type",
"=",
"self",
".",
"_config_reader",
".",
"get",
"(",
"WebDriverFactory",
".",
"BROWSER_TYPE_CONFIG",
")",
"except",
"KeyError",
":",
"_wtflog",
"(",
"\"%s missing is mis... | ef7f86c4d4cf7fb17745fd627b3cc4a41f4c0216 |
train | WebDriverFactory.__create_safari_driver | Creates an instance of Safari webdriver. | wtframework/wtf/web/webdriver.py | def __create_safari_driver(self):
'''
Creates an instance of Safari webdriver.
'''
# Check for selenium jar env file needed for safari driver.
if not os.getenv(self.__SELENIUM_SERVER_JAR_ENV):
# If not set, check if we have a config setting for it.
try:
... | def __create_safari_driver(self):
'''
Creates an instance of Safari webdriver.
'''
# Check for selenium jar env file needed for safari driver.
if not os.getenv(self.__SELENIUM_SERVER_JAR_ENV):
# If not set, check if we have a config setting for it.
try:
... | [
"Creates",
"an",
"instance",
"of",
"Safari",
"webdriver",
"."
] | wiredrive/wtframework | python | https://github.com/wiredrive/wtframework/blob/ef7f86c4d4cf7fb17745fd627b3cc4a41f4c0216/wtframework/wtf/web/webdriver.py#L198-L214 | [
"def",
"__create_safari_driver",
"(",
"self",
")",
":",
"# Check for selenium jar env file needed for safari driver.",
"if",
"not",
"os",
".",
"getenv",
"(",
"self",
".",
"__SELENIUM_SERVER_JAR_ENV",
")",
":",
"# If not set, check if we have a config setting for it.",
"try",
... | ef7f86c4d4cf7fb17745fd627b3cc4a41f4c0216 |
train | WebDriverFactory.__create_phantom_js_driver | Creates an instance of PhantomJS driver. | wtframework/wtf/web/webdriver.py | def __create_phantom_js_driver(self):
'''
Creates an instance of PhantomJS driver.
'''
try:
return webdriver.PhantomJS(executable_path=self._config_reader.get(self.PHANTOMEJS_EXEC_PATH),
service_args=['--ignore-ssl-errors=true'])
... | def __create_phantom_js_driver(self):
'''
Creates an instance of PhantomJS driver.
'''
try:
return webdriver.PhantomJS(executable_path=self._config_reader.get(self.PHANTOMEJS_EXEC_PATH),
service_args=['--ignore-ssl-errors=true'])
... | [
"Creates",
"an",
"instance",
"of",
"PhantomJS",
"driver",
"."
] | wiredrive/wtframework | python | https://github.com/wiredrive/wtframework/blob/ef7f86c4d4cf7fb17745fd627b3cc4a41f4c0216/wtframework/wtf/web/webdriver.py#L216-L224 | [
"def",
"__create_phantom_js_driver",
"(",
"self",
")",
":",
"try",
":",
"return",
"webdriver",
".",
"PhantomJS",
"(",
"executable_path",
"=",
"self",
".",
"_config_reader",
".",
"get",
"(",
"self",
".",
"PHANTOMEJS_EXEC_PATH",
")",
",",
"service_args",
"=",
"[... | ef7f86c4d4cf7fb17745fd627b3cc4a41f4c0216 |
train | WebDriverFactory.__create_remote_webdriver_from_config | Reads the config value for browser type. | wtframework/wtf/web/webdriver.py | def __create_remote_webdriver_from_config(self, testname=None):
'''
Reads the config value for browser type.
'''
desired_capabilities = self._generate_desired_capabilities(testname)
remote_url = self._config_reader.get(
WebDriverFactory.REMOTE_URL_CONFIG)
... | def __create_remote_webdriver_from_config(self, testname=None):
'''
Reads the config value for browser type.
'''
desired_capabilities = self._generate_desired_capabilities(testname)
remote_url = self._config_reader.get(
WebDriverFactory.REMOTE_URL_CONFIG)
... | [
"Reads",
"the",
"config",
"value",
"for",
"browser",
"type",
"."
] | wiredrive/wtframework | python | https://github.com/wiredrive/wtframework/blob/ef7f86c4d4cf7fb17745fd627b3cc4a41f4c0216/wtframework/wtf/web/webdriver.py#L226-L261 | [
"def",
"__create_remote_webdriver_from_config",
"(",
"self",
",",
"testname",
"=",
"None",
")",
":",
"desired_capabilities",
"=",
"self",
".",
"_generate_desired_capabilities",
"(",
"testname",
")",
"remote_url",
"=",
"self",
".",
"_config_reader",
".",
"get",
"(",
... | ef7f86c4d4cf7fb17745fd627b3cc4a41f4c0216 |
train | WebDriverManager.clean_up_webdrivers | Clean up webdrivers created during execution. | wtframework/wtf/web/webdriver.py | def clean_up_webdrivers(self):
'''
Clean up webdrivers created during execution.
'''
# Quit webdrivers.
_wtflog.info("WebdriverManager: Cleaning up webdrivers")
try:
if self.__use_shutdown_hook:
for key in self.__registered_drivers.keys():
... | def clean_up_webdrivers(self):
'''
Clean up webdrivers created during execution.
'''
# Quit webdrivers.
_wtflog.info("WebdriverManager: Cleaning up webdrivers")
try:
if self.__use_shutdown_hook:
for key in self.__registered_drivers.keys():
... | [
"Clean",
"up",
"webdrivers",
"created",
"during",
"execution",
"."
] | wiredrive/wtframework | python | https://github.com/wiredrive/wtframework/blob/ef7f86c4d4cf7fb17745fd627b3cc4a41f4c0216/wtframework/wtf/web/webdriver.py#L402-L419 | [
"def",
"clean_up_webdrivers",
"(",
"self",
")",
":",
"# Quit webdrivers.",
"_wtflog",
".",
"info",
"(",
"\"WebdriverManager: Cleaning up webdrivers\"",
")",
"try",
":",
"if",
"self",
".",
"__use_shutdown_hook",
":",
"for",
"key",
"in",
"self",
".",
"__registered_dri... | ef7f86c4d4cf7fb17745fd627b3cc4a41f4c0216 |
train | WebDriverManager.close_driver | Close current running instance of Webdriver.
Usage::
driver = WTF_WEBDRIVER_MANAGER.new_driver()
driver.get("http://the-internet.herokuapp.com")
WTF_WEBDRIVER_MANAGER.close_driver() | wtframework/wtf/web/webdriver.py | def close_driver(self):
"""
Close current running instance of Webdriver.
Usage::
driver = WTF_WEBDRIVER_MANAGER.new_driver()
driver.get("http://the-internet.herokuapp.com")
WTF_WEBDRIVER_MANAGER.close_driver()
"""
channel = self.__get_channel... | def close_driver(self):
"""
Close current running instance of Webdriver.
Usage::
driver = WTF_WEBDRIVER_MANAGER.new_driver()
driver.get("http://the-internet.herokuapp.com")
WTF_WEBDRIVER_MANAGER.close_driver()
"""
channel = self.__get_channel... | [
"Close",
"current",
"running",
"instance",
"of",
"Webdriver",
"."
] | wiredrive/wtframework | python | https://github.com/wiredrive/wtframework/blob/ef7f86c4d4cf7fb17745fd627b3cc4a41f4c0216/wtframework/wtf/web/webdriver.py#L421-L453 | [
"def",
"close_driver",
"(",
"self",
")",
":",
"channel",
"=",
"self",
".",
"__get_channel",
"(",
")",
"driver",
"=",
"self",
".",
"__get_driver_for_channel",
"(",
"channel",
")",
"if",
"self",
".",
"__config",
".",
"get",
"(",
"self",
".",
"REUSE_BROWSER",... | ef7f86c4d4cf7fb17745fd627b3cc4a41f4c0216 |
train | WebDriverManager.get_driver | Get an already running instance of Webdriver. If there is none, it will create one.
Returns:
Webdriver - Selenium Webdriver instance.
Usage::
driver = WTF_WEBDRIVER_MANAGER.new_driver()
driver.get("http://the-internet.herokuapp.com")
same_driver = WTF_W... | wtframework/wtf/web/webdriver.py | def get_driver(self):
'''
Get an already running instance of Webdriver. If there is none, it will create one.
Returns:
Webdriver - Selenium Webdriver instance.
Usage::
driver = WTF_WEBDRIVER_MANAGER.new_driver()
driver.get("http://the-internet.herok... | def get_driver(self):
'''
Get an already running instance of Webdriver. If there is none, it will create one.
Returns:
Webdriver - Selenium Webdriver instance.
Usage::
driver = WTF_WEBDRIVER_MANAGER.new_driver()
driver.get("http://the-internet.herok... | [
"Get",
"an",
"already",
"running",
"instance",
"of",
"Webdriver",
".",
"If",
"there",
"is",
"none",
"it",
"will",
"create",
"one",
"."
] | wiredrive/wtframework | python | https://github.com/wiredrive/wtframework/blob/ef7f86c4d4cf7fb17745fd627b3cc4a41f4c0216/wtframework/wtf/web/webdriver.py#L455-L473 | [
"def",
"get_driver",
"(",
"self",
")",
":",
"driver",
"=",
"self",
".",
"__get_driver_for_channel",
"(",
"self",
".",
"__get_channel",
"(",
")",
")",
"if",
"driver",
"is",
"None",
":",
"driver",
"=",
"self",
".",
"new_driver",
"(",
")",
"return",
"driver... | ef7f86c4d4cf7fb17745fd627b3cc4a41f4c0216 |
train | WebDriverManager.new_driver | Used at a start of a test to get a new instance of WebDriver. If the
'resuebrowser' setting is true, it will use a recycled WebDriver instance
with delete_all_cookies() called.
Kwargs:
testname (str) - Optional test name to pass to Selenium Grid. Helpful for
... | wtframework/wtf/web/webdriver.py | def new_driver(self, testname=None):
'''
Used at a start of a test to get a new instance of WebDriver. If the
'resuebrowser' setting is true, it will use a recycled WebDriver instance
with delete_all_cookies() called.
Kwargs:
testname (str) - Optional test name to ... | def new_driver(self, testname=None):
'''
Used at a start of a test to get a new instance of WebDriver. If the
'resuebrowser' setting is true, it will use a recycled WebDriver instance
with delete_all_cookies() called.
Kwargs:
testname (str) - Optional test name to ... | [
"Used",
"at",
"a",
"start",
"of",
"a",
"test",
"to",
"get",
"a",
"new",
"instance",
"of",
"WebDriver",
".",
"If",
"the",
"resuebrowser",
"setting",
"is",
"true",
"it",
"will",
"use",
"a",
"recycled",
"WebDriver",
"instance",
"with",
"delete_all_cookies",
"... | wiredrive/wtframework | python | https://github.com/wiredrive/wtframework/blob/ef7f86c4d4cf7fb17745fd627b3cc4a41f4c0216/wtframework/wtf/web/webdriver.py#L488-L552 | [
"def",
"new_driver",
"(",
"self",
",",
"testname",
"=",
"None",
")",
":",
"channel",
"=",
"self",
".",
"__get_channel",
"(",
")",
"# Get reference for the current driver.",
"driver",
"=",
"self",
".",
"__get_driver_for_channel",
"(",
"channel",
")",
"if",
"self"... | ef7f86c4d4cf7fb17745fd627b3cc4a41f4c0216 |
train | WebDriverManager.__register_driver | Register webdriver to a channel. | wtframework/wtf/web/webdriver.py | def __register_driver(self, channel, webdriver):
"Register webdriver to a channel."
# Add to list of webdrivers to cleanup.
if not self.__registered_drivers.has_key(channel):
self.__registered_drivers[channel] = [] # set to new empty array
self.__registered_drivers[channel... | def __register_driver(self, channel, webdriver):
"Register webdriver to a channel."
# Add to list of webdrivers to cleanup.
if not self.__registered_drivers.has_key(channel):
self.__registered_drivers[channel] = [] # set to new empty array
self.__registered_drivers[channel... | [
"Register",
"webdriver",
"to",
"a",
"channel",
"."
] | wiredrive/wtframework | python | https://github.com/wiredrive/wtframework/blob/ef7f86c4d4cf7fb17745fd627b3cc4a41f4c0216/wtframework/wtf/web/webdriver.py#L555-L565 | [
"def",
"__register_driver",
"(",
"self",
",",
"channel",
",",
"webdriver",
")",
":",
"# Add to list of webdrivers to cleanup.",
"if",
"not",
"self",
".",
"__registered_drivers",
".",
"has_key",
"(",
"channel",
")",
":",
"self",
".",
"__registered_drivers",
"[",
"c... | ef7f86c4d4cf7fb17745fd627b3cc4a41f4c0216 |
train | WebDriverManager.__unregister_driver | Unregister webdriver | wtframework/wtf/web/webdriver.py | def __unregister_driver(self, channel):
"Unregister webdriver"
driver = self.__get_driver_for_channel(channel)
if self.__registered_drivers.has_key(channel) \
and driver in self.__registered_drivers[channel]:
self.__registered_drivers[channel].remove(driver)
... | def __unregister_driver(self, channel):
"Unregister webdriver"
driver = self.__get_driver_for_channel(channel)
if self.__registered_drivers.has_key(channel) \
and driver in self.__registered_drivers[channel]:
self.__registered_drivers[channel].remove(driver)
... | [
"Unregister",
"webdriver"
] | wiredrive/wtframework | python | https://github.com/wiredrive/wtframework/blob/ef7f86c4d4cf7fb17745fd627b3cc4a41f4c0216/wtframework/wtf/web/webdriver.py#L567-L576 | [
"def",
"__unregister_driver",
"(",
"self",
",",
"channel",
")",
":",
"driver",
"=",
"self",
".",
"__get_driver_for_channel",
"(",
"channel",
")",
"if",
"self",
".",
"__registered_drivers",
".",
"has_key",
"(",
"channel",
")",
"and",
"driver",
"in",
"self",
"... | ef7f86c4d4cf7fb17745fd627b3cc4a41f4c0216 |
train | WebDriverManager.__get_channel | Get the channel to register webdriver to. | wtframework/wtf/web/webdriver.py | def __get_channel(self):
"Get the channel to register webdriver to."
if self.__config.get(WebDriverManager.ENABLE_THREADING_SUPPORT, False):
channel = current_thread().ident
else:
channel = 0
return channel | def __get_channel(self):
"Get the channel to register webdriver to."
if self.__config.get(WebDriverManager.ENABLE_THREADING_SUPPORT, False):
channel = current_thread().ident
else:
channel = 0
return channel | [
"Get",
"the",
"channel",
"to",
"register",
"webdriver",
"to",
"."
] | wiredrive/wtframework | python | https://github.com/wiredrive/wtframework/blob/ef7f86c4d4cf7fb17745fd627b3cc4a41f4c0216/wtframework/wtf/web/webdriver.py#L585-L592 | [
"def",
"__get_channel",
"(",
"self",
")",
":",
"if",
"self",
".",
"__config",
".",
"get",
"(",
"WebDriverManager",
".",
"ENABLE_THREADING_SUPPORT",
",",
"False",
")",
":",
"channel",
"=",
"current_thread",
"(",
")",
".",
"ident",
"else",
":",
"channel",
"=... | ef7f86c4d4cf7fb17745fd627b3cc4a41f4c0216 |
train | WebScreenShotUtil.take_screenshot | Captures a screenshot.
Args:
webdriver (WebDriver) - Selenium webdriver.
file_name (str) - File name to save screenshot as. | wtframework/wtf/web/capture.py | def take_screenshot(webdriver, file_name):
"""
Captures a screenshot.
Args:
webdriver (WebDriver) - Selenium webdriver.
file_name (str) - File name to save screenshot as.
"""
folder_location = os.path.join(ProjectUtils.get_project_root(),
... | def take_screenshot(webdriver, file_name):
"""
Captures a screenshot.
Args:
webdriver (WebDriver) - Selenium webdriver.
file_name (str) - File name to save screenshot as.
"""
folder_location = os.path.join(ProjectUtils.get_project_root(),
... | [
"Captures",
"a",
"screenshot",
"."
] | wiredrive/wtframework | python | https://github.com/wiredrive/wtframework/blob/ef7f86c4d4cf7fb17745fd627b3cc4a41f4c0216/wtframework/wtf/web/capture.py#L34-L47 | [
"def",
"take_screenshot",
"(",
"webdriver",
",",
"file_name",
")",
":",
"folder_location",
"=",
"os",
".",
"path",
".",
"join",
"(",
"ProjectUtils",
".",
"get_project_root",
"(",
")",
",",
"WebScreenShotUtil",
".",
"SCREEN_SHOT_LOCATION",
")",
"WebScreenShotUtil",... | ef7f86c4d4cf7fb17745fd627b3cc4a41f4c0216 |
train | WebScreenShotUtil.take_reference_screenshot | Captures a screenshot as a reference screenshot.
Args:
webdriver (WebDriver) - Selenium webdriver.
file_name (str) - File name to save screenshot as. | wtframework/wtf/web/capture.py | def take_reference_screenshot(webdriver, file_name):
"""
Captures a screenshot as a reference screenshot.
Args:
webdriver (WebDriver) - Selenium webdriver.
file_name (str) - File name to save screenshot as.
"""
folder_location = os.path.join(ProjectUtils.... | def take_reference_screenshot(webdriver, file_name):
"""
Captures a screenshot as a reference screenshot.
Args:
webdriver (WebDriver) - Selenium webdriver.
file_name (str) - File name to save screenshot as.
"""
folder_location = os.path.join(ProjectUtils.... | [
"Captures",
"a",
"screenshot",
"as",
"a",
"reference",
"screenshot",
"."
] | wiredrive/wtframework | python | https://github.com/wiredrive/wtframework/blob/ef7f86c4d4cf7fb17745fd627b3cc4a41f4c0216/wtframework/wtf/web/capture.py#L50-L62 | [
"def",
"take_reference_screenshot",
"(",
"webdriver",
",",
"file_name",
")",
":",
"folder_location",
"=",
"os",
".",
"path",
".",
"join",
"(",
"ProjectUtils",
".",
"get_project_root",
"(",
")",
",",
"WebScreenShotUtil",
".",
"REFERENCE_SCREEN_SHOT_LOCATION",
")",
... | ef7f86c4d4cf7fb17745fd627b3cc4a41f4c0216 |
train | WebScreenShotUtil.__capture_screenshot | Capture a screenshot | wtframework/wtf/web/capture.py | def __capture_screenshot(webdriver, folder_location, file_name):
"Capture a screenshot"
# Check folder location exists.
if not os.path.exists(folder_location):
os.makedirs(folder_location)
file_location = os.path.join(folder_location, file_name)
if isinstance(webdri... | def __capture_screenshot(webdriver, folder_location, file_name):
"Capture a screenshot"
# Check folder location exists.
if not os.path.exists(folder_location):
os.makedirs(folder_location)
file_location = os.path.join(folder_location, file_name)
if isinstance(webdri... | [
"Capture",
"a",
"screenshot"
] | wiredrive/wtframework | python | https://github.com/wiredrive/wtframework/blob/ef7f86c4d4cf7fb17745fd627b3cc4a41f4c0216/wtframework/wtf/web/capture.py#L65-L83 | [
"def",
"__capture_screenshot",
"(",
"webdriver",
",",
"folder_location",
",",
"file_name",
")",
":",
"# Check folder location exists.",
"if",
"not",
"os",
".",
"path",
".",
"exists",
"(",
"folder_location",
")",
":",
"os",
".",
"makedirs",
"(",
"folder_location",
... | ef7f86c4d4cf7fb17745fd627b3cc4a41f4c0216 |
train | ProjectUtils.get_project_root | Return path of the project directory. Use this method for getting paths relative to the project.
However, for data, it's recommended you use WTF_DATA_MANAGER and for assets it's recommended
to use WTF_ASSET_MANAGER, which are already singleton instances that manger the /data, and /assets
fold... | wtframework/wtf/utils/project_utils.py | def get_project_root(cls):
'''
Return path of the project directory. Use this method for getting paths relative to the project.
However, for data, it's recommended you use WTF_DATA_MANAGER and for assets it's recommended
to use WTF_ASSET_MANAGER, which are already singleton instances t... | def get_project_root(cls):
'''
Return path of the project directory. Use this method for getting paths relative to the project.
However, for data, it's recommended you use WTF_DATA_MANAGER and for assets it's recommended
to use WTF_ASSET_MANAGER, which are already singleton instances t... | [
"Return",
"path",
"of",
"the",
"project",
"directory",
".",
"Use",
"this",
"method",
"for",
"getting",
"paths",
"relative",
"to",
"the",
"project",
".",
"However",
"for",
"data",
"it",
"s",
"recommended",
"you",
"use",
"WTF_DATA_MANAGER",
"and",
"for",
"asse... | wiredrive/wtframework | python | https://github.com/wiredrive/wtframework/blob/ef7f86c4d4cf7fb17745fd627b3cc4a41f4c0216/wtframework/wtf/utils/project_utils.py#L38-L75 | [
"def",
"get_project_root",
"(",
"cls",
")",
":",
"if",
"(",
"cls",
".",
"__root_folder__",
"!=",
"None",
")",
":",
"return",
"cls",
".",
"__root_folder__",
"# Check for enviornment variable override.",
"try",
":",
"cls",
".",
"__root_folder__",
"=",
"os",
".",
... | ef7f86c4d4cf7fb17745fd627b3cc4a41f4c0216 |
train | do_until | A retry wrapper that'll keep performing the action until it succeeds.
(main differnce between do_until and wait_until is do_until will keep trying
until a value is returned, while wait until will wait until the function
evaluates True.)
Args:
lambda_expr (lambda) : Expression to evaluate.
... | wtframework/wtf/utils/wait_utils.py | def do_until(lambda_expr, timeout=WTF_TIMEOUT_MANAGER.NORMAL, sleep=0.5, message=None):
'''
A retry wrapper that'll keep performing the action until it succeeds.
(main differnce between do_until and wait_until is do_until will keep trying
until a value is returned, while wait until will wait until the ... | def do_until(lambda_expr, timeout=WTF_TIMEOUT_MANAGER.NORMAL, sleep=0.5, message=None):
'''
A retry wrapper that'll keep performing the action until it succeeds.
(main differnce between do_until and wait_until is do_until will keep trying
until a value is returned, while wait until will wait until the ... | [
"A",
"retry",
"wrapper",
"that",
"ll",
"keep",
"performing",
"the",
"action",
"until",
"it",
"succeeds",
".",
"(",
"main",
"differnce",
"between",
"do_until",
"and",
"wait_until",
"is",
"do_until",
"will",
"keep",
"trying",
"until",
"a",
"value",
"is",
"retu... | wiredrive/wtframework | python | https://github.com/wiredrive/wtframework/blob/ef7f86c4d4cf7fb17745fd627b3cc4a41f4c0216/wtframework/wtf/utils/wait_utils.py#L39-L88 | [
"def",
"do_until",
"(",
"lambda_expr",
",",
"timeout",
"=",
"WTF_TIMEOUT_MANAGER",
".",
"NORMAL",
",",
"sleep",
"=",
"0.5",
",",
"message",
"=",
"None",
")",
":",
"__check_condition_parameter_is_function",
"(",
"lambda_expr",
")",
"end_time",
"=",
"datetime",
".... | ef7f86c4d4cf7fb17745fd627b3cc4a41f4c0216 |
train | wait_and_ignore | Waits wrapper that'll wait for the condition to become true, but will
not error if the condition isn't met.
Args:
condition (lambda) - Lambda expression to wait for to evaluate to True.
Kwargs:
timeout (number) : Maximum number of seconds to wait.
sleep (number) : Sleep time to wa... | wtframework/wtf/utils/wait_utils.py | def wait_and_ignore(condition, timeout=WTF_TIMEOUT_MANAGER.NORMAL, sleep=0.5):
'''
Waits wrapper that'll wait for the condition to become true, but will
not error if the condition isn't met.
Args:
condition (lambda) - Lambda expression to wait for to evaluate to True.
Kwargs:
time... | def wait_and_ignore(condition, timeout=WTF_TIMEOUT_MANAGER.NORMAL, sleep=0.5):
'''
Waits wrapper that'll wait for the condition to become true, but will
not error if the condition isn't met.
Args:
condition (lambda) - Lambda expression to wait for to evaluate to True.
Kwargs:
time... | [
"Waits",
"wrapper",
"that",
"ll",
"wait",
"for",
"the",
"condition",
"to",
"become",
"true",
"but",
"will",
"not",
"error",
"if",
"the",
"condition",
"isn",
"t",
"met",
"."
] | wiredrive/wtframework | python | https://github.com/wiredrive/wtframework/blob/ef7f86c4d4cf7fb17745fd627b3cc4a41f4c0216/wtframework/wtf/utils/wait_utils.py#L91-L123 | [
"def",
"wait_and_ignore",
"(",
"condition",
",",
"timeout",
"=",
"WTF_TIMEOUT_MANAGER",
".",
"NORMAL",
",",
"sleep",
"=",
"0.5",
")",
":",
"try",
":",
"return",
"wait_until",
"(",
"condition",
",",
"timeout",
",",
"sleep",
")",
"except",
":",
"pass"
] | ef7f86c4d4cf7fb17745fd627b3cc4a41f4c0216 |
train | wait_until | Waits wrapper that'll wait for the condition to become true.
(main differnce between do_until and wait_until is do_until will keep trying
until a value is returned, while wait until will wait until the function
evaluates True.)
Args:
condition (lambda) - Lambda expression to wait for to evalu... | wtframework/wtf/utils/wait_utils.py | def wait_until(condition, timeout=WTF_TIMEOUT_MANAGER.NORMAL, sleep=0.5, pass_exceptions=False, message=None):
'''
Waits wrapper that'll wait for the condition to become true.
(main differnce between do_until and wait_until is do_until will keep trying
until a value is returned, while wait until will w... | def wait_until(condition, timeout=WTF_TIMEOUT_MANAGER.NORMAL, sleep=0.5, pass_exceptions=False, message=None):
'''
Waits wrapper that'll wait for the condition to become true.
(main differnce between do_until and wait_until is do_until will keep trying
until a value is returned, while wait until will w... | [
"Waits",
"wrapper",
"that",
"ll",
"wait",
"for",
"the",
"condition",
"to",
"become",
"true",
".",
"(",
"main",
"differnce",
"between",
"do_until",
"and",
"wait_until",
"is",
"do_until",
"will",
"keep",
"trying",
"until",
"a",
"value",
"is",
"returned",
"whil... | wiredrive/wtframework | python | https://github.com/wiredrive/wtframework/blob/ef7f86c4d4cf7fb17745fd627b3cc4a41f4c0216/wtframework/wtf/utils/wait_utils.py#L125-L187 | [
"def",
"wait_until",
"(",
"condition",
",",
"timeout",
"=",
"WTF_TIMEOUT_MANAGER",
".",
"NORMAL",
",",
"sleep",
"=",
"0.5",
",",
"pass_exceptions",
"=",
"False",
",",
"message",
"=",
"None",
")",
":",
"__check_condition_parameter_is_function",
"(",
"condition",
... | ef7f86c4d4cf7fb17745fd627b3cc4a41f4c0216 |
train | IMapEmailAccountObject.check_email_exists_by_subject | Searches for Email by Subject. Returns True or False.
Args:
subject (str): Subject to search for.
Kwargs:
match_recipient (str) : Recipient to match exactly. (don't care if not specified)
Returns:
True - email found, False - email not found | wtframework/wtf/email.py | def check_email_exists_by_subject(self, subject, match_recipient=None):
"""
Searches for Email by Subject. Returns True or False.
Args:
subject (str): Subject to search for.
Kwargs:
match_recipient (str) : Recipient to match exactly. (don't care if not specifie... | def check_email_exists_by_subject(self, subject, match_recipient=None):
"""
Searches for Email by Subject. Returns True or False.
Args:
subject (str): Subject to search for.
Kwargs:
match_recipient (str) : Recipient to match exactly. (don't care if not specifie... | [
"Searches",
"for",
"Email",
"by",
"Subject",
".",
"Returns",
"True",
"or",
"False",
"."
] | wiredrive/wtframework | python | https://github.com/wiredrive/wtframework/blob/ef7f86c4d4cf7fb17745fd627b3cc4a41f4c0216/wtframework/wtf/email.py#L65-L89 | [
"def",
"check_email_exists_by_subject",
"(",
"self",
",",
"subject",
",",
"match_recipient",
"=",
"None",
")",
":",
"# Select inbox to fetch the latest mail on server.",
"self",
".",
"_mail",
".",
"select",
"(",
"\"inbox\"",
")",
"try",
":",
"matches",
"=",
"self",
... | ef7f86c4d4cf7fb17745fd627b3cc4a41f4c0216 |
train | IMapEmailAccountObject.find_emails_by_subject | Searches for Email by Subject. Returns email's imap message IDs
as a list if matching subjects is found.
Args:
subject (str) - Subject to search for.
Kwargs:
limit (int) - Limit search to X number of matches, default 50
match_recipient (str) - Recipient to... | wtframework/wtf/email.py | def find_emails_by_subject(self, subject, limit=50, match_recipient=None):
"""
Searches for Email by Subject. Returns email's imap message IDs
as a list if matching subjects is found.
Args:
subject (str) - Subject to search for.
Kwargs:
limit (int) - L... | def find_emails_by_subject(self, subject, limit=50, match_recipient=None):
"""
Searches for Email by Subject. Returns email's imap message IDs
as a list if matching subjects is found.
Args:
subject (str) - Subject to search for.
Kwargs:
limit (int) - L... | [
"Searches",
"for",
"Email",
"by",
"Subject",
".",
"Returns",
"email",
"s",
"imap",
"message",
"IDs",
"as",
"a",
"list",
"if",
"matching",
"subjects",
"is",
"found",
"."
] | wiredrive/wtframework | python | https://github.com/wiredrive/wtframework/blob/ef7f86c4d4cf7fb17745fd627b3cc4a41f4c0216/wtframework/wtf/email.py#L91-L113 | [
"def",
"find_emails_by_subject",
"(",
"self",
",",
"subject",
",",
"limit",
"=",
"50",
",",
"match_recipient",
"=",
"None",
")",
":",
"# Select inbox to fetch the latest mail on server.",
"self",
".",
"_mail",
".",
"select",
"(",
"\"inbox\"",
")",
"matching_uids",
... | ef7f86c4d4cf7fb17745fd627b3cc4a41f4c0216 |
train | IMapEmailAccountObject.get_email_message | Fetch contents of email.
Args:
message_uid (int): IMAP Message UID number.
Kwargs:
message_type: Can be 'text' or 'html' | wtframework/wtf/email.py | def get_email_message(self, message_uid, message_type="text/plain"):
"""
Fetch contents of email.
Args:
message_uid (int): IMAP Message UID number.
Kwargs:
message_type: Can be 'text' or 'html'
"""
self._mail.select("inbox")
result = sel... | def get_email_message(self, message_uid, message_type="text/plain"):
"""
Fetch contents of email.
Args:
message_uid (int): IMAP Message UID number.
Kwargs:
message_type: Can be 'text' or 'html'
"""
self._mail.select("inbox")
result = sel... | [
"Fetch",
"contents",
"of",
"email",
"."
] | wiredrive/wtframework | python | https://github.com/wiredrive/wtframework/blob/ef7f86c4d4cf7fb17745fd627b3cc4a41f4c0216/wtframework/wtf/email.py#L115-L137 | [
"def",
"get_email_message",
"(",
"self",
",",
"message_uid",
",",
"message_type",
"=",
"\"text/plain\"",
")",
":",
"self",
".",
"_mail",
".",
"select",
"(",
"\"inbox\"",
")",
"result",
"=",
"self",
".",
"_mail",
".",
"uid",
"(",
"'fetch'",
",",
"message_ui... | ef7f86c4d4cf7fb17745fd627b3cc4a41f4c0216 |
train | IMapEmailAccountObject.raw_search | Find the a set of emails matching each regular expression passed in against the (RFC822) content.
Args:
*args: list of regular expressions.
Kwargs:
limit (int) - Limit to how many of the most resent emails to search through.
date (datetime) - If specified, it will f... | wtframework/wtf/email.py | def raw_search(self, *args, **kwargs):
"""
Find the a set of emails matching each regular expression passed in against the (RFC822) content.
Args:
*args: list of regular expressions.
Kwargs:
limit (int) - Limit to how many of the most resent emails to search thr... | def raw_search(self, *args, **kwargs):
"""
Find the a set of emails matching each regular expression passed in against the (RFC822) content.
Args:
*args: list of regular expressions.
Kwargs:
limit (int) - Limit to how many of the most resent emails to search thr... | [
"Find",
"the",
"a",
"set",
"of",
"emails",
"matching",
"each",
"regular",
"expression",
"passed",
"in",
"against",
"the",
"(",
"RFC822",
")",
"content",
"."
] | wiredrive/wtframework | python | https://github.com/wiredrive/wtframework/blob/ef7f86c4d4cf7fb17745fd627b3cc4a41f4c0216/wtframework/wtf/email.py#L139-L188 | [
"def",
"raw_search",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"limit",
"=",
"50",
"try",
":",
"limit",
"=",
"kwargs",
"[",
"'limit'",
"]",
"except",
"KeyError",
":",
"pass",
"# Get first X messages.",
"self",
".",
"_mail",
".",... | ef7f86c4d4cf7fb17745fd627b3cc4a41f4c0216 |
train | IMapEmailAccountObject.__search_email_by_subject | Get a list of message numbers | wtframework/wtf/email.py | def __search_email_by_subject(self, subject, match_recipient):
"Get a list of message numbers"
if match_recipient is None:
_, data = self._mail.uid('search',
None,
'(HEADER SUBJECT "{subject}")'
... | def __search_email_by_subject(self, subject, match_recipient):
"Get a list of message numbers"
if match_recipient is None:
_, data = self._mail.uid('search',
None,
'(HEADER SUBJECT "{subject}")'
... | [
"Get",
"a",
"list",
"of",
"message",
"numbers"
] | wiredrive/wtframework | python | https://github.com/wiredrive/wtframework/blob/ef7f86c4d4cf7fb17745fd627b3cc4a41f4c0216/wtframework/wtf/email.py#L190-L219 | [
"def",
"__search_email_by_subject",
"(",
"self",
",",
"subject",
",",
"match_recipient",
")",
":",
"if",
"match_recipient",
"is",
"None",
":",
"_",
",",
"data",
"=",
"self",
".",
"_mail",
".",
"uid",
"(",
"'search'",
",",
"None",
",",
"'(HEADER SUBJECT \"{su... | ef7f86c4d4cf7fb17745fd627b3cc4a41f4c0216 |
train | ConfigReader.get | Gets the value from the yaml config based on the key.
No type casting is performed, any type casting should be
performed by the caller.
Args:
key (str) - Config setting key.
Kwargs:
default_value - Default value to return if config is not specified.
R... | wtframework/wtf/config.py | def get(self, key, default_value=__NoDefaultSpecified__):
'''
Gets the value from the yaml config based on the key.
No type casting is performed, any type casting should be
performed by the caller.
Args:
key (str) - Config setting key.
Kwargs:
... | def get(self, key, default_value=__NoDefaultSpecified__):
'''
Gets the value from the yaml config based on the key.
No type casting is performed, any type casting should be
performed by the caller.
Args:
key (str) - Config setting key.
Kwargs:
... | [
"Gets",
"the",
"value",
"from",
"the",
"yaml",
"config",
"based",
"on",
"the",
"key",
"."
] | wiredrive/wtframework | python | https://github.com/wiredrive/wtframework/blob/ef7f86c4d4cf7fb17745fd627b3cc4a41f4c0216/wtframework/wtf/config.py#L82-L124 | [
"def",
"get",
"(",
"self",
",",
"key",
",",
"default_value",
"=",
"__NoDefaultSpecified__",
")",
":",
"# First attempt to get the var from OS enviornment.",
"os_env_string",
"=",
"ConfigReader",
".",
"ENV_PREFIX",
"+",
"key",
"os_env_string",
"=",
"os_env_string",
".",
... | ef7f86c4d4cf7fb17745fd627b3cc4a41f4c0216 |
train | generate_page_object | Generate page object from URL | wtframework/wtf/_devtools_/page_object_tools.py | def generate_page_object(page_name, url):
"Generate page object from URL"
# Attempt to extract partial URL for verification.
url_with_path = u('^.*//[^/]+([^?]+)?|$')
try:
match = re.match(url_with_path, url)
partial_url = match.group(1)
print("Using partial URL for location ver... | def generate_page_object(page_name, url):
"Generate page object from URL"
# Attempt to extract partial URL for verification.
url_with_path = u('^.*//[^/]+([^?]+)?|$')
try:
match = re.match(url_with_path, url)
partial_url = match.group(1)
print("Using partial URL for location ver... | [
"Generate",
"page",
"object",
"from",
"URL"
] | wiredrive/wtframework | python | https://github.com/wiredrive/wtframework/blob/ef7f86c4d4cf7fb17745fd627b3cc4a41f4c0216/wtframework/wtf/_devtools_/page_object_tools.py#L139-L177 | [
"def",
"generate_page_object",
"(",
"page_name",
",",
"url",
")",
":",
"# Attempt to extract partial URL for verification.",
"url_with_path",
"=",
"u",
"(",
"'^.*//[^/]+([^?]+)?|$'",
")",
"try",
":",
"match",
"=",
"re",
".",
"match",
"(",
"url_with_path",
",",
"url"... | ef7f86c4d4cf7fb17745fd627b3cc4a41f4c0216 |
train | DataManager.get_data_path | Get data path.
Args:
filename (string) : Name of file inside of /data folder to retrieve.
Kwargs:
env_prefix (string) : Name of subfolder, ex: 'qa' will find files in /data/qa
Returns:
String - path to file.
Usage::
open(WTF_DATA_MANAG... | wtframework/wtf/data/data_management.py | def get_data_path(self, filename, env_prefix=None):
"""
Get data path.
Args:
filename (string) : Name of file inside of /data folder to retrieve.
Kwargs:
env_prefix (string) : Name of subfolder, ex: 'qa' will find files in /data/qa
Returns:
... | def get_data_path(self, filename, env_prefix=None):
"""
Get data path.
Args:
filename (string) : Name of file inside of /data folder to retrieve.
Kwargs:
env_prefix (string) : Name of subfolder, ex: 'qa' will find files in /data/qa
Returns:
... | [
"Get",
"data",
"path",
"."
] | wiredrive/wtframework | python | https://github.com/wiredrive/wtframework/blob/ef7f86c4d4cf7fb17745fd627b3cc4a41f4c0216/wtframework/wtf/data/data_management.py#L65-L94 | [
"def",
"get_data_path",
"(",
"self",
",",
"filename",
",",
"env_prefix",
"=",
"None",
")",
":",
"if",
"env_prefix",
"==",
"None",
":",
"target_file",
"=",
"filename",
"else",
":",
"target_file",
"=",
"os",
".",
"path",
".",
"join",
"(",
"env_prefix",
","... | ef7f86c4d4cf7fb17745fd627b3cc4a41f4c0216 |
train | CsvReader.next | Gets next entry as a dictionary.
Returns:
object - Object key/value pair representing a row.
{key1: value1, key2: value2, ...} | wtframework/wtf/data/data_management.py | def next(self):
"""
Gets next entry as a dictionary.
Returns:
object - Object key/value pair representing a row.
{key1: value1, key2: value2, ...}
"""
try:
entry = {}
row = self._csv_reader.next()
for i in range(0, le... | def next(self):
"""
Gets next entry as a dictionary.
Returns:
object - Object key/value pair representing a row.
{key1: value1, key2: value2, ...}
"""
try:
entry = {}
row = self._csv_reader.next()
for i in range(0, le... | [
"Gets",
"next",
"entry",
"as",
"a",
"dictionary",
"."
] | wiredrive/wtframework | python | https://github.com/wiredrive/wtframework/blob/ef7f86c4d4cf7fb17745fd627b3cc4a41f4c0216/wtframework/wtf/data/data_management.py#L133-L152 | [
"def",
"next",
"(",
"self",
")",
":",
"try",
":",
"entry",
"=",
"{",
"}",
"row",
"=",
"self",
".",
"_csv_reader",
".",
"next",
"(",
")",
"for",
"i",
"in",
"range",
"(",
"0",
",",
"len",
"(",
"row",
")",
")",
":",
"entry",
"[",
"self",
".",
... | ef7f86c4d4cf7fb17745fd627b3cc4a41f4c0216 |
train | WebElementSelector.find_element_by_selectors | Utility method makes it easier to find an element using multiple selectors. This is
useful for problematic elements what might works with one browser, but fail in another.
(Like different page elements being served up for different browsers)
Args:
selectors - var arg if N number of... | wtframework/wtf/web/webelement.py | def find_element_by_selectors(webdriver, *selectors):
"""
Utility method makes it easier to find an element using multiple selectors. This is
useful for problematic elements what might works with one browser, but fail in another.
(Like different page elements being served up for differe... | def find_element_by_selectors(webdriver, *selectors):
"""
Utility method makes it easier to find an element using multiple selectors. This is
useful for problematic elements what might works with one browser, but fail in another.
(Like different page elements being served up for differe... | [
"Utility",
"method",
"makes",
"it",
"easier",
"to",
"find",
"an",
"element",
"using",
"multiple",
"selectors",
".",
"This",
"is",
"useful",
"for",
"problematic",
"elements",
"what",
"might",
"works",
"with",
"one",
"browser",
"but",
"fail",
"in",
"another",
... | wiredrive/wtframework | python | https://github.com/wiredrive/wtframework/blob/ef7f86c4d4cf7fb17745fd627b3cc4a41f4c0216/wtframework/wtf/web/webelement.py#L33-L70 | [
"def",
"find_element_by_selectors",
"(",
"webdriver",
",",
"*",
"selectors",
")",
":",
"# perform initial check to verify selectors are valid by statements.",
"for",
"selector",
"in",
"selectors",
":",
"(",
"by_method",
",",
"value",
")",
"=",
"selector",
"if",
"not",
... | ef7f86c4d4cf7fb17745fd627b3cc4a41f4c0216 |
train | WebElementUtils.wait_until_element_not_visible | Wait for a WebElement to disappear.
Args:
webdriver (Webdriver) - Selenium Webdriver
locator (lambda) - Locator lambda expression.
Kwargs:
timeout (number) - timeout period
sleep (number) - sleep period between intervals. | wtframework/wtf/web/webelement.py | def wait_until_element_not_visible(webdriver, locator_lambda_expression,
timeout=WTF_TIMEOUT_MANAGER.NORMAL, sleep=0.5):
"""
Wait for a WebElement to disappear.
Args:
webdriver (Webdriver) - Selenium Webdriver
locator (lambda) - Loc... | def wait_until_element_not_visible(webdriver, locator_lambda_expression,
timeout=WTF_TIMEOUT_MANAGER.NORMAL, sleep=0.5):
"""
Wait for a WebElement to disappear.
Args:
webdriver (Webdriver) - Selenium Webdriver
locator (lambda) - Loc... | [
"Wait",
"for",
"a",
"WebElement",
"to",
"disappear",
"."
] | wiredrive/wtframework | python | https://github.com/wiredrive/wtframework/blob/ef7f86c4d4cf7fb17745fd627b3cc4a41f4c0216/wtframework/wtf/web/webelement.py#L89-L114 | [
"def",
"wait_until_element_not_visible",
"(",
"webdriver",
",",
"locator_lambda_expression",
",",
"timeout",
"=",
"WTF_TIMEOUT_MANAGER",
".",
"NORMAL",
",",
"sleep",
"=",
"0.5",
")",
":",
"# Wait for loading progress indicator to go away.",
"try",
":",
"stoptime",
"=",
... | ef7f86c4d4cf7fb17745fd627b3cc4a41f4c0216 |
train | WebElementUtils.is_image_loaded | Check if an image (in an image tag) is loaded.
Note: This call will not work against background images. Only Images in <img> tags.
Args:
webelement (WebElement) - WebDriver web element to validate. | wtframework/wtf/web/webelement.py | def is_image_loaded(webdriver, webelement):
'''
Check if an image (in an image tag) is loaded.
Note: This call will not work against background images. Only Images in <img> tags.
Args:
webelement (WebElement) - WebDriver web element to validate.
'''
script ... | def is_image_loaded(webdriver, webelement):
'''
Check if an image (in an image tag) is loaded.
Note: This call will not work against background images. Only Images in <img> tags.
Args:
webelement (WebElement) - WebDriver web element to validate.
'''
script ... | [
"Check",
"if",
"an",
"image",
"(",
"in",
"an",
"image",
"tag",
")",
"is",
"loaded",
".",
"Note",
":",
"This",
"call",
"will",
"not",
"work",
"against",
"background",
"images",
".",
"Only",
"Images",
"in",
"<img",
">",
"tags",
"."
] | wiredrive/wtframework | python | https://github.com/wiredrive/wtframework/blob/ef7f86c4d4cf7fb17745fd627b3cc4a41f4c0216/wtframework/wtf/web/webelement.py#L117-L131 | [
"def",
"is_image_loaded",
"(",
"webdriver",
",",
"webelement",
")",
":",
"script",
"=",
"(",
"u",
"(",
"\"return arguments[0].complete && type of arguments[0].naturalWidth != \\\"undefined\\\" \"",
")",
"+",
"u",
"(",
"\"&& arguments[0].naturalWidth > 0\"",
")",
")",
"try",... | ef7f86c4d4cf7fb17745fd627b3cc4a41f4c0216 |
train | generate_timestamped_string | Generate time-stamped string. Format as follows...
`2013-01-31_14:12:23_SubjectString_a3Zg`
Kwargs:
subject (str): String to use as subject.
number_of_random_chars (int) : Number of random characters to append.
This method is helpful for creating unique names with timestamps in them so ... | wtframework/wtf/utils/data_utils.py | def generate_timestamped_string(subject="test", number_of_random_chars=4):
"""
Generate time-stamped string. Format as follows...
`2013-01-31_14:12:23_SubjectString_a3Zg`
Kwargs:
subject (str): String to use as subject.
number_of_random_chars (int) : Number of random characters to app... | def generate_timestamped_string(subject="test", number_of_random_chars=4):
"""
Generate time-stamped string. Format as follows...
`2013-01-31_14:12:23_SubjectString_a3Zg`
Kwargs:
subject (str): String to use as subject.
number_of_random_chars (int) : Number of random characters to app... | [
"Generate",
"time",
"-",
"stamped",
"string",
".",
"Format",
"as",
"follows",
"..."
] | wiredrive/wtframework | python | https://github.com/wiredrive/wtframework/blob/ef7f86c4d4cf7fb17745fd627b3cc4a41f4c0216/wtframework/wtf/utils/data_utils.py#L28-L51 | [
"def",
"generate_timestamped_string",
"(",
"subject",
"=",
"\"test\"",
",",
"number_of_random_chars",
"=",
"4",
")",
":",
"random_str",
"=",
"generate_random_string",
"(",
"number_of_random_chars",
")",
"timestamp",
"=",
"generate_timestamp",
"(",
")",
"return",
"u\"{... | ef7f86c4d4cf7fb17745fd627b3cc4a41f4c0216 |
train | generate_random_string | Generate a series of random characters.
Kwargs:
number_of_random_chars (int) : Number of characters long
character_set (str): Specify a character set. Default is ASCII | wtframework/wtf/utils/data_utils.py | def generate_random_string(number_of_random_chars=8, character_set=string.ascii_letters):
"""
Generate a series of random characters.
Kwargs:
number_of_random_chars (int) : Number of characters long
character_set (str): Specify a character set. Default is ASCII
"""
return u('').joi... | def generate_random_string(number_of_random_chars=8, character_set=string.ascii_letters):
"""
Generate a series of random characters.
Kwargs:
number_of_random_chars (int) : Number of characters long
character_set (str): Specify a character set. Default is ASCII
"""
return u('').joi... | [
"Generate",
"a",
"series",
"of",
"random",
"characters",
"."
] | wiredrive/wtframework | python | https://github.com/wiredrive/wtframework/blob/ef7f86c4d4cf7fb17745fd627b3cc4a41f4c0216/wtframework/wtf/utils/data_utils.py#L65-L74 | [
"def",
"generate_random_string",
"(",
"number_of_random_chars",
"=",
"8",
",",
"character_set",
"=",
"string",
".",
"ascii_letters",
")",
":",
"return",
"u",
"(",
"''",
")",
".",
"join",
"(",
"random",
".",
"choice",
"(",
"character_set",
")",
"for",
"_",
... | ef7f86c4d4cf7fb17745fd627b3cc4a41f4c0216 |
train | convert_weka_to_py_date_pattern | Converts the date format pattern used by Weka to the date format pattern used by Python's datetime.strftime(). | weka/arff.py | def convert_weka_to_py_date_pattern(p):
"""
Converts the date format pattern used by Weka to the date format pattern used by Python's datetime.strftime().
"""
# https://docs.python.org/2/library/datetime.html#strftime-strptime-behavior
# https://www.cs.waikato.ac.nz/ml/weka/arff.html
p = p.repla... | def convert_weka_to_py_date_pattern(p):
"""
Converts the date format pattern used by Weka to the date format pattern used by Python's datetime.strftime().
"""
# https://docs.python.org/2/library/datetime.html#strftime-strptime-behavior
# https://www.cs.waikato.ac.nz/ml/weka/arff.html
p = p.repla... | [
"Converts",
"the",
"date",
"format",
"pattern",
"used",
"by",
"Weka",
"to",
"the",
"date",
"format",
"pattern",
"used",
"by",
"Python",
"s",
"datetime",
".",
"strftime",
"()",
"."
] | chrisspen/weka | python | https://github.com/chrisspen/weka/blob/c86fc4b8eef1afd56f89ec28283bdf9e2fdc453b/weka/arff.py#L87-L99 | [
"def",
"convert_weka_to_py_date_pattern",
"(",
"p",
")",
":",
"# https://docs.python.org/2/library/datetime.html#strftime-strptime-behavior",
"# https://www.cs.waikato.ac.nz/ml/weka/arff.html",
"p",
"=",
"p",
".",
"replace",
"(",
"'yyyy'",
",",
"r'%Y'",
")",
"p",
"=",
"p",
... | c86fc4b8eef1afd56f89ec28283bdf9e2fdc453b |
train | ArffFile.get_attribute_value | Returns the value associated with the given value index
of the attribute with the given name.
This is only applicable for nominal and string types. | weka/arff.py | def get_attribute_value(self, name, index):
"""
Returns the value associated with the given value index
of the attribute with the given name.
This is only applicable for nominal and string types.
"""
if index == MISSING:
return
elif self.attri... | def get_attribute_value(self, name, index):
"""
Returns the value associated with the given value index
of the attribute with the given name.
This is only applicable for nominal and string types.
"""
if index == MISSING:
return
elif self.attri... | [
"Returns",
"the",
"value",
"associated",
"with",
"the",
"given",
"value",
"index",
"of",
"the",
"attribute",
"with",
"the",
"given",
"name",
".",
"This",
"is",
"only",
"applicable",
"for",
"nominal",
"and",
"string",
"types",
"."
] | chrisspen/weka | python | https://github.com/chrisspen/weka/blob/c86fc4b8eef1afd56f89ec28283bdf9e2fdc453b/weka/arff.py#L320-L342 | [
"def",
"get_attribute_value",
"(",
"self",
",",
"name",
",",
"index",
")",
":",
"if",
"index",
"==",
"MISSING",
":",
"return",
"elif",
"self",
".",
"attribute_types",
"[",
"name",
"]",
"in",
"NUMERIC_TYPES",
":",
"at",
"=",
"self",
".",
"attribute_types",
... | c86fc4b8eef1afd56f89ec28283bdf9e2fdc453b |
train | ArffFile.load | Load an ARFF File from a file. | weka/arff.py | def load(cls, filename, schema_only=False):
"""
Load an ARFF File from a file.
"""
o = open(filename)
s = o.read()
a = cls.parse(s, schema_only=schema_only)
if not schema_only:
a._filename = filename
o.close()
return a | def load(cls, filename, schema_only=False):
"""
Load an ARFF File from a file.
"""
o = open(filename)
s = o.read()
a = cls.parse(s, schema_only=schema_only)
if not schema_only:
a._filename = filename
o.close()
return a | [
"Load",
"an",
"ARFF",
"File",
"from",
"a",
"file",
"."
] | chrisspen/weka | python | https://github.com/chrisspen/weka/blob/c86fc4b8eef1afd56f89ec28283bdf9e2fdc453b/weka/arff.py#L357-L367 | [
"def",
"load",
"(",
"cls",
",",
"filename",
",",
"schema_only",
"=",
"False",
")",
":",
"o",
"=",
"open",
"(",
"filename",
")",
"s",
"=",
"o",
".",
"read",
"(",
")",
"a",
"=",
"cls",
".",
"parse",
"(",
"s",
",",
"schema_only",
"=",
"schema_only",... | c86fc4b8eef1afd56f89ec28283bdf9e2fdc453b |
train | ArffFile.parse | Parse an ARFF File already loaded into a string. | weka/arff.py | def parse(cls, s, schema_only=False):
"""
Parse an ARFF File already loaded into a string.
"""
a = cls()
a.state = 'comment'
a.lineno = 1
for l in s.splitlines():
a.parseline(l)
a.lineno += 1
if schema_only and a.state == 'data'... | def parse(cls, s, schema_only=False):
"""
Parse an ARFF File already loaded into a string.
"""
a = cls()
a.state = 'comment'
a.lineno = 1
for l in s.splitlines():
a.parseline(l)
a.lineno += 1
if schema_only and a.state == 'data'... | [
"Parse",
"an",
"ARFF",
"File",
"already",
"loaded",
"into",
"a",
"string",
"."
] | chrisspen/weka | python | https://github.com/chrisspen/weka/blob/c86fc4b8eef1afd56f89ec28283bdf9e2fdc453b/weka/arff.py#L370-L383 | [
"def",
"parse",
"(",
"cls",
",",
"s",
",",
"schema_only",
"=",
"False",
")",
":",
"a",
"=",
"cls",
"(",
")",
"a",
".",
"state",
"=",
"'comment'",
"a",
".",
"lineno",
"=",
"1",
"for",
"l",
"in",
"s",
".",
"splitlines",
"(",
")",
":",
"a",
".",... | c86fc4b8eef1afd56f89ec28283bdf9e2fdc453b |
train | ArffFile.copy | Creates a deepcopy of the instance.
If schema_only is True, the data will be excluded from the copy. | weka/arff.py | def copy(self, schema_only=False):
"""
Creates a deepcopy of the instance.
If schema_only is True, the data will be excluded from the copy.
"""
o = type(self)()
o.relation = self.relation
o.attributes = list(self.attributes)
o.attribute_types = self.attrib... | def copy(self, schema_only=False):
"""
Creates a deepcopy of the instance.
If schema_only is True, the data will be excluded from the copy.
"""
o = type(self)()
o.relation = self.relation
o.attributes = list(self.attributes)
o.attribute_types = self.attrib... | [
"Creates",
"a",
"deepcopy",
"of",
"the",
"instance",
".",
"If",
"schema_only",
"is",
"True",
"the",
"data",
"will",
"be",
"excluded",
"from",
"the",
"copy",
"."
] | chrisspen/weka | python | https://github.com/chrisspen/weka/blob/c86fc4b8eef1afd56f89ec28283bdf9e2fdc453b/weka/arff.py#L385-L398 | [
"def",
"copy",
"(",
"self",
",",
"schema_only",
"=",
"False",
")",
":",
"o",
"=",
"type",
"(",
"self",
")",
"(",
")",
"o",
".",
"relation",
"=",
"self",
".",
"relation",
"o",
".",
"attributes",
"=",
"list",
"(",
"self",
".",
"attributes",
")",
"o... | c86fc4b8eef1afd56f89ec28283bdf9e2fdc453b |
train | ArffFile.open_stream | Save an arff structure to a file, leaving the file object
open for writing of new data samples.
This prevents you from directly accessing the data via Python,
but when generating a huge file, this prevents all your data
from being stored in memory. | weka/arff.py | def open_stream(self, class_attr_name=None, fn=None):
"""
Save an arff structure to a file, leaving the file object
open for writing of new data samples.
This prevents you from directly accessing the data via Python,
but when generating a huge file, this prevents all your data
... | def open_stream(self, class_attr_name=None, fn=None):
"""
Save an arff structure to a file, leaving the file object
open for writing of new data samples.
This prevents you from directly accessing the data via Python,
but when generating a huge file, this prevents all your data
... | [
"Save",
"an",
"arff",
"structure",
"to",
"a",
"file",
"leaving",
"the",
"file",
"object",
"open",
"for",
"writing",
"of",
"new",
"data",
"samples",
".",
"This",
"prevents",
"you",
"from",
"directly",
"accessing",
"the",
"data",
"via",
"Python",
"but",
"whe... | chrisspen/weka | python | https://github.com/chrisspen/weka/blob/c86fc4b8eef1afd56f89ec28283bdf9e2fdc453b/weka/arff.py#L404-L422 | [
"def",
"open_stream",
"(",
"self",
",",
"class_attr_name",
"=",
"None",
",",
"fn",
"=",
"None",
")",
":",
"if",
"fn",
":",
"self",
".",
"fout_fn",
"=",
"fn",
"else",
":",
"fd",
",",
"self",
".",
"fout_fn",
"=",
"tempfile",
".",
"mkstemp",
"(",
")",... | c86fc4b8eef1afd56f89ec28283bdf9e2fdc453b |
train | ArffFile.close_stream | Terminates an open stream and returns the filename
of the file containing the streamed data. | weka/arff.py | def close_stream(self):
"""
Terminates an open stream and returns the filename
of the file containing the streamed data.
"""
if self.fout:
fout = self.fout
fout_fn = self.fout_fn
self.fout.flush()
self.fout.close()
self.... | def close_stream(self):
"""
Terminates an open stream and returns the filename
of the file containing the streamed data.
"""
if self.fout:
fout = self.fout
fout_fn = self.fout_fn
self.fout.flush()
self.fout.close()
self.... | [
"Terminates",
"an",
"open",
"stream",
"and",
"returns",
"the",
"filename",
"of",
"the",
"file",
"containing",
"the",
"streamed",
"data",
"."
] | chrisspen/weka | python | https://github.com/chrisspen/weka/blob/c86fc4b8eef1afd56f89ec28283bdf9e2fdc453b/weka/arff.py#L424-L436 | [
"def",
"close_stream",
"(",
"self",
")",
":",
"if",
"self",
".",
"fout",
":",
"fout",
"=",
"self",
".",
"fout",
"fout_fn",
"=",
"self",
".",
"fout_fn",
"self",
".",
"fout",
".",
"flush",
"(",
")",
"self",
".",
"fout",
".",
"close",
"(",
")",
"sel... | c86fc4b8eef1afd56f89ec28283bdf9e2fdc453b |
train | ArffFile.save | Save an arff structure to a file. | weka/arff.py | def save(self, filename=None):
"""
Save an arff structure to a file.
"""
filename = filename or self._filename
o = open(filename, 'w')
o.write(self.write())
o.close() | def save(self, filename=None):
"""
Save an arff structure to a file.
"""
filename = filename or self._filename
o = open(filename, 'w')
o.write(self.write())
o.close() | [
"Save",
"an",
"arff",
"structure",
"to",
"a",
"file",
"."
] | chrisspen/weka | python | https://github.com/chrisspen/weka/blob/c86fc4b8eef1afd56f89ec28283bdf9e2fdc453b/weka/arff.py#L438-L445 | [
"def",
"save",
"(",
"self",
",",
"filename",
"=",
"None",
")",
":",
"filename",
"=",
"filename",
"or",
"self",
".",
"_filename",
"o",
"=",
"open",
"(",
"filename",
",",
"'w'",
")",
"o",
".",
"write",
"(",
"self",
".",
"write",
"(",
")",
")",
"o",... | c86fc4b8eef1afd56f89ec28283bdf9e2fdc453b |
train | ArffFile.write_line | Converts a single data line to a string. | weka/arff.py | def write_line(self, d, fmt=SPARSE):
"""
Converts a single data line to a string.
"""
def smart_quote(s):
if isinstance(s, basestring) and ' ' in s and s[0] != '"':
s = '"%s"' % s
return s
if fmt == DENSE:
#TOD... | def write_line(self, d, fmt=SPARSE):
"""
Converts a single data line to a string.
"""
def smart_quote(s):
if isinstance(s, basestring) and ' ' in s and s[0] != '"':
s = '"%s"' % s
return s
if fmt == DENSE:
#TOD... | [
"Converts",
"a",
"single",
"data",
"line",
"to",
"a",
"string",
"."
] | chrisspen/weka | python | https://github.com/chrisspen/weka/blob/c86fc4b8eef1afd56f89ec28283bdf9e2fdc453b/weka/arff.py#L447-L532 | [
"def",
"write_line",
"(",
"self",
",",
"d",
",",
"fmt",
"=",
"SPARSE",
")",
":",
"def",
"smart_quote",
"(",
"s",
")",
":",
"if",
"isinstance",
"(",
"s",
",",
"basestring",
")",
"and",
"' '",
"in",
"s",
"and",
"s",
"[",
"0",
"]",
"!=",
"'\"'",
"... | c86fc4b8eef1afd56f89ec28283bdf9e2fdc453b |
train | ArffFile.write | Write an arff structure to a string. | weka/arff.py | def write(self,
fout=None,
fmt=SPARSE,
schema_only=False,
data_only=False):
"""
Write an arff structure to a string.
"""
assert not (schema_only and data_only), 'Make up your mind.'
assert fmt in FORMATS, 'Invalid format "%s". Should be one of: %s'... | def write(self,
fout=None,
fmt=SPARSE,
schema_only=False,
data_only=False):
"""
Write an arff structure to a string.
"""
assert not (schema_only and data_only), 'Make up your mind.'
assert fmt in FORMATS, 'Invalid format "%s". Should be one of: %s'... | [
"Write",
"an",
"arff",
"structure",
"to",
"a",
"string",
"."
] | chrisspen/weka | python | https://github.com/chrisspen/weka/blob/c86fc4b8eef1afd56f89ec28283bdf9e2fdc453b/weka/arff.py#L559-L584 | [
"def",
"write",
"(",
"self",
",",
"fout",
"=",
"None",
",",
"fmt",
"=",
"SPARSE",
",",
"schema_only",
"=",
"False",
",",
"data_only",
"=",
"False",
")",
":",
"assert",
"not",
"(",
"schema_only",
"and",
"data_only",
")",
",",
"'Make up your mind.'",
"asse... | c86fc4b8eef1afd56f89ec28283bdf9e2fdc453b |
train | ArffFile.define_attribute | Define a new attribute. atype has to be one of 'integer', 'real', 'numeric', 'string', 'date' or 'nominal'.
For nominal attributes, pass the possible values as data.
For date attributes, pass the format as data. | weka/arff.py | def define_attribute(self, name, atype, data=None):
"""
Define a new attribute. atype has to be one of 'integer', 'real', 'numeric', 'string', 'date' or 'nominal'.
For nominal attributes, pass the possible values as data.
For date attributes, pass the format as data.
"""
... | def define_attribute(self, name, atype, data=None):
"""
Define a new attribute. atype has to be one of 'integer', 'real', 'numeric', 'string', 'date' or 'nominal'.
For nominal attributes, pass the possible values as data.
For date attributes, pass the format as data.
"""
... | [
"Define",
"a",
"new",
"attribute",
".",
"atype",
"has",
"to",
"be",
"one",
"of",
"integer",
"real",
"numeric",
"string",
"date",
"or",
"nominal",
".",
"For",
"nominal",
"attributes",
"pass",
"the",
"possible",
"values",
"as",
"data",
".",
"For",
"date",
... | chrisspen/weka | python | https://github.com/chrisspen/weka/blob/c86fc4b8eef1afd56f89ec28283bdf9e2fdc453b/weka/arff.py#L592-L601 | [
"def",
"define_attribute",
"(",
"self",
",",
"name",
",",
"atype",
",",
"data",
"=",
"None",
")",
":",
"self",
".",
"attributes",
".",
"append",
"(",
"name",
")",
"assert",
"atype",
"in",
"TYPES",
",",
"\"Unknown type '%s'. Must be one of: %s\"",
"%",
"(",
... | c86fc4b8eef1afd56f89ec28283bdf9e2fdc453b |
train | ArffFile.dump | Print an overview of the ARFF file. | weka/arff.py | def dump(self):
"""Print an overview of the ARFF file."""
print("Relation " + self.relation)
print(" With attributes")
for n in self.attributes:
if self.attribute_types[n] != TYPE_NOMINAL:
print(" %s of type %s" % (n, self.attribute_types[n]))
... | def dump(self):
"""Print an overview of the ARFF file."""
print("Relation " + self.relation)
print(" With attributes")
for n in self.attributes:
if self.attribute_types[n] != TYPE_NOMINAL:
print(" %s of type %s" % (n, self.attribute_types[n]))
... | [
"Print",
"an",
"overview",
"of",
"the",
"ARFF",
"file",
"."
] | chrisspen/weka | python | https://github.com/chrisspen/weka/blob/c86fc4b8eef1afd56f89ec28283bdf9e2fdc453b/weka/arff.py#L722-L732 | [
"def",
"dump",
"(",
"self",
")",
":",
"print",
"(",
"\"Relation \"",
"+",
"self",
".",
"relation",
")",
"print",
"(",
"\" With attributes\"",
")",
"for",
"n",
"in",
"self",
".",
"attributes",
":",
"if",
"self",
".",
"attribute_types",
"[",
"n",
"]",
"... | c86fc4b8eef1afd56f89ec28283bdf9e2fdc453b |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.