output
stringlengths
1
928k
instruction
stringlengths
7
928k
system
stringlengths
0
104k
def ServiceWorker_unregister(self, scopeURL): """ Function path: ServiceWorker.unregister Domain: ServiceWorker Method name: unregister Parameters: Required arguments: 'scopeURL' (type: string) -> No description No return value. """ assert isinstance(scopeURL, (str,) ), "Argumen...
Can you write a function in Python 3 where it functions path : ServiceWorker. unregister Domain : ServiceWorker Method name : unregister Parameters arguments : ServiceWorker Parameter type : str
You are a Python code analyst, evaluating scripts for potential improvements.
Function path : ServiceWorker. updateRegistration
Explain what the following Python 3 code does def ServiceWorker_updateRegistration(self, scopeURL): assert isinstance(scopeURL, (str,) ), "Argument 'scopeURL' must be of type '['str']'. Received type: '%s'" % type( scopeURL) subdom_funcs = self.synchronous_command('ServiceWorker.updateRegistration', ...
You are a Python code architect, reviewing and designing scalable and efficient code
def ServiceWorker_startWorker(self, scopeURL): """ Function path: ServiceWorker.startWorker Domain: ServiceWorker Method name: startWorker Parameters: Required arguments: 'scopeURL' (type: string) -> No description No return value. """ assert isinstance(scopeURL, (str,) ), "Argu...
How would you implement a function in Python 3 that functions path: ServiceWorker.startWorker Domain: ServiceWorker Method name: startWorker Parameters: Required arguments: 'scopeURL' (type: string) -> No description No return value.
As a Python code composer, you craft elegant and concise scripts.
def ServiceWorker_skipWaiting(self, scopeURL): """ Function path: ServiceWorker.skipWaiting Domain: ServiceWorker Method name: skipWaiting Parameters: Required arguments: 'scopeURL' (type: string) -> No description No return value. """ assert isinstance(scopeURL, (str,) ), "Argu...
Write a Python 3 function that can function path: ServiceWorker.skipWaiting Domain: ServiceWorker Method name: skipWaiting Parameters: Required arguments: 'scopeURL' (type: string) -> No description No return value.
As a Python code translator, you convert algorithms and pseudocode into Python.
This method is used to stop the Worker with the given versionId.
Can you generate a brief explanation for the following Python 3 code def ServiceWorker_stopWorker(self, versionId): assert isinstance(versionId, (str,) ), "Argument 'versionId' must be of type '['str']'. Received type: '%s'" % type( versionId) subdom_funcs = self.synchronous_command('ServiceWorker.stopW...
As a Python code translator, you convert algorithms and pseudocode into Python.
def ServiceWorker_inspectWorker(self, versionId): """ Function path: ServiceWorker.inspectWorker Domain: ServiceWorker Method name: inspectWorker Parameters: Required arguments: 'versionId' (type: string) -> No description No return value. """ assert isinstance(versionId, (str,) ...
Implement a Python 3 function for functioning path: ServiceWorker.inspectWorker Domain: ServiceWorker Method name: inspectWorker Parameters: Required arguments: 'versionId' (type: string) -> No description No return value.
You are a Python code architect, reviewing and designing scalable and efficient code
def ServiceWorker_setForceUpdateOnPageLoad(self, forceUpdateOnPageLoad): """ Function path: ServiceWorker.setForceUpdateOnPageLoad Domain: ServiceWorker Method name: setForceUpdateOnPageLoad Parameters: Required arguments: 'forceUpdateOnPageLoad' (type: boolean) -> No description No return v...
Write a Python 3 function that can function path: ServiceWorker.setForceUpdateOnPageLoad Domain: ServiceWorker Method name: setForceUpdateOnPageLoad Parameters: Required arguments: 'forceUpdateOnPageLoad' (type: boolean) -> No description No return value.
You are a Python code analyst, evaluating scripts for potential improvements.
This method is used to deliver a push message to the specified registrationId.
Explain what the following Python 3 code does def ServiceWorker_deliverPushMessage(self, origin, registrationId, data): assert isinstance(origin, (str,) ), "Argument 'origin' must be of type '['str']'. Received type: '%s'" % type( origin) assert isinstance(registrationId, (str,) ), "Argument 'regi...
You are a Python code analyst, evaluating scripts for potential improvements.
def ServiceWorker_dispatchSyncEvent(self, origin, registrationId, tag, lastChance): """ Function path: ServiceWorker.dispatchSyncEvent Domain: ServiceWorker Method name: dispatchSyncEvent Parameters: Required arguments: 'origin' (type: string) -> No description 'registrationId' (type:...
Write a Python 3 function that can function path: ServiceWorker.dispatchSyncEvent Domain: ServiceWorker Method name: dispatchSyncEvent Parameters: Required arguments: 'origin' (type: string) -> No description 'registrationId' (type: string) -> No description 'tag' (type: string) -> No description 'lastChance' (type: bo...
You are a Python code architect, reviewing and designing scalable and efficient code
This command is used to set ignore input events.
Here you have a function in Python 3, explain what it does def Input_setIgnoreInputEvents(self, ignore): assert isinstance(ignore, (bool,) ), "Argument 'ignore' must be of type '['bool']'. Received type: '%s'" % type( ignore) subdom_funcs = self.synchronous_command('Input.setIgnoreInputEvents', ig...
You are a Python code architect, reviewing and designing scalable and efficient code
Input. dispatchMouseEvent - Dispatches a mouse event to the page.
Explain what the following Python 3 code does def Input_dispatchMouseEvent(self, type, x, y, **kwargs): assert isinstance(type, (str,) ), "Argument 'type' must be of type '['str']'. Received type: '%s'" % type( type) assert isinstance(x, (float, int) ), "Argument 'x' must be of type '['float', 'in...
As a Python code analyst, you investigate and solve complex coding mysteries
def Input_dispatchTouchEvent(self, type, touchPoints, **kwargs): """ Function path: Input.dispatchTouchEvent Domain: Input Method name: dispatchTouchEvent WARNING: This function is marked 'Experimental'! Parameters: Required arguments: 'type' (type: string) -> Type of the touch event. Tou...
Can you write a function in Python 3 where it functions path: Input.dispatchTouchEvent Domain: Input Method name: dispatchTouchEvent WARNING: This function is marked 'Experimental'! Parameters: Required arguments: 'type' (type: string) -> Type of the touch event. TouchEnd and TouchCancel must not contain any touch poin...
You are a Python code generator, capable of creating scripts from specifications.
Input. synthesizePinchGesture - Synthesizes a pinch gesture over a time period.
How would you explain what the following Python 3 function does def Input_synthesizePinchGesture(self, x, y, scaleFactor, **kwargs): assert isinstance(x, (float, int) ), "Argument 'x' must be of type '['float', 'int']'. Received type: '%s'" % type( x) assert isinstance(y, (float, int) ), "Argument...
You are a Python code generator, capable of creating scripts from specifications.
def LayerTree_loadSnapshot(self, tiles): """ Function path: LayerTree.loadSnapshot Domain: LayerTree Method name: loadSnapshot Parameters: Required arguments: 'tiles' (type: array) -> An array of tiles composing the snapshot. Returns: 'snapshotId' (type: SnapshotId) -> The id of the snap...
How would you implement a function in Python 3 that layers Tree load snapshot operation.
As a Python code translator, you convert algorithms and pseudocode into Python.
Trace. recordClockSyncMarker - Record a clock sync marker in the trace.
How would you explain what the following Python 3 function does def Tracing_recordClockSyncMarker(self, syncId): assert isinstance(syncId, (str,) ), "Argument 'syncId' must be of type '['str']'. Received type: '%s'" % type( syncId) subdom_funcs = self.synchronous_command('Tracing.recordClockSyncMarker',...
You are a Python code analyst, evaluating scripts for potential improvements.
def Animation_setPlaybackRate(self, playbackRate): """ Function path: Animation.setPlaybackRate Domain: Animation Method name: setPlaybackRate Parameters: Required arguments: 'playbackRate' (type: number) -> Playback rate for animations on page No return value. Description: Sets the pl...
Write a Python 3 function that can function path: Animation.setPlaybackRate Domain: Animation Method name: setPlaybackRate Parameters: Required arguments: 'playbackRate' (type: number) -> Playback rate for animations on page No return value. Description: Sets the playback rate of the document timeline.
You are a Python code generator, capable of creating scripts from specifications.
Animation. getCurrentTime - Returns the current time of the animation.
Make a summary of the following Python 3 code def Animation_getCurrentTime(self, id): assert isinstance(id, (str,) ), "Argument 'id' must be of type '['str']'. Received type: '%s'" % type( id) subdom_funcs = self.synchronous_command('Animation.getCurrentTime', id=id) return subdom_funcs
As a Python code translator, you convert algorithms and pseudocode into Python.
This method is used to set the paused state of a set of animations.
Can you generate a brief explanation for the following Python 3 code def Animation_setPaused(self, animations, paused): assert isinstance(animations, (list, tuple) ), "Argument 'animations' must be of type '['list', 'tuple']'. Received type: '%s'" % type( animations) assert isinstance(paused, (bool,) ...
You are a Python code generator, capable of creating scripts from specifications.
This method is used to set the timing of an animation node.
Make a summary of the following Python 3 code def Animation_setTiming(self, animationId, duration, delay): assert isinstance(animationId, (str,) ), "Argument 'animationId' must be of type '['str']'. Received type: '%s'" % type( animationId) assert isinstance(duration, (float, int) ), "Argument 'du...
As a python code expert, you are capable of creating scripts from specifications.
This method is used to seek an animation to a particular time.
Here you have a function in Python 3, explain what it does def Animation_seekAnimations(self, animations, currentTime): assert isinstance(animations, (list, tuple) ), "Argument 'animations' must be of type '['list', 'tuple']'. Received type: '%s'" % type( animations) assert isinstance(currentTime, (floa...
As a python code expert, you are capable of creating scripts from specifications.
def Animation_releaseAnimations(self, animations): """ Function path: Animation.releaseAnimations Domain: Animation Method name: releaseAnimations Parameters: Required arguments: 'animations' (type: array) -> List of animation ids to seek. No return value. Description: Releases a set o...
How would you implement a function in Python 3 that functions path: Animation.releaseAnimations Domain: Animation Method name: releaseAnimations Parameters: Required arguments: 'animations' (type: array) -> List of animation ids to seek. No return value. Description: Releases a set of animations to no longer be manipul...
As a Python code translator, you convert algorithms and pseudocode into Python.
This method returns the remote object of the Animation with the given id.
Given the following Python 3 function, write the documentation def Animation_resolveAnimation(self, animationId): assert isinstance(animationId, (str,) ), "Argument 'animationId' must be of type '['str']'. Received type: '%s'" % type( animationId) subdom_funcs = self.synchronous_command('Animation.resol...
As a Python code composer, you craft elegant and concise scripts.
This method clears storage for the specified origin.
Here you have a function in Python 3, explain what it does def Storage_clearDataForOrigin(self, origin, storageTypes): assert isinstance(origin, (str,) ), "Argument 'origin' must be of type '['str']'. Received type: '%s'" % type( origin) assert isinstance(storageTypes, (str,) ), "Argument 'storage...
As a python code expert, you are capable of creating scripts from specifications.
This method returns the usage and quota in bytes.
How would you explain what the following Python 3 function does def Storage_getUsageAndQuota(self, origin): assert isinstance(origin, (str,) ), "Argument 'origin' must be of type '['str']'. Received type: '%s'" % type( origin) subdom_funcs = self.synchronous_command('Storage.getUsageAndQuota', ori...
You are a Python code architect, reviewing and designing scalable and efficient code
This method is used to track the state of a cache storage list for a given origin.
Make a summary of the following Python 3 code def Storage_trackCacheStorageForOrigin(self, origin): assert isinstance(origin, (str,) ), "Argument 'origin' must be of type '['str']'. Received type: '%s'" % type( origin) subdom_funcs = self.synchronous_command('Storage.trackCacheStorageForOrigin', o...
As a Python code translator, you convert algorithms and pseudocode into Python.
This method unregisters a cache storage origin from receiving notifications for cache storage.
Explain what the following Python 3 code does def Storage_untrackCacheStorageForOrigin(self, origin): assert isinstance(origin, (str,) ), "Argument 'origin' must be of type '['str']'. Received type: '%s'" % type( origin) subdom_funcs = self.synchronous_command( 'Storage.untrackCacheStorageForOrigi...
You are a Python code analyst, evaluating scripts for potential improvements.
def Log_startViolationsReport(self, config): """ Function path: Log.startViolationsReport Domain: Log Method name: startViolationsReport Parameters: Required arguments: 'config' (type: array) -> Configuration for violations. No return value. Description: start violation reporting. ""...
Write a Python 3 script for functioning path: Log.startViolationsReport Domain: Log Method name: startViolationsReport Parameters: Required arguments: 'config' (type: array) -> Configuration for violations. No return value. Description: start violation reporting.
As a Python code analyst, you investigate and solve complex coding mysteries
def Tethering_bind(self, port): """ Function path: Tethering.bind Domain: Tethering Method name: bind Parameters: Required arguments: 'port' (type: integer) -> Port number to bind. No return value. Description: Request browser port binding. """ assert isinstance(port, (int,) ...
Write a Python 3 function for functioning path: Tethering.bind Domain: Tethering Method name: bind Parameters: Required arguments: 'port' (type: integer) -> Port number to bind. No return value. Description: Request browser port binding.
You are a Python code generator, capable of creating scripts from specifications.
def Tethering_unbind(self, port): """ Function path: Tethering.unbind Domain: Tethering Method name: unbind Parameters: Required arguments: 'port' (type: integer) -> Port number to unbind. No return value. Description: Request browser port unbinding. """ assert isinstance(port, (in...
Implement a Python 3 function for functioning path: Tethering.unbind Domain: Tethering Method name: unbind Parameters: Required arguments: 'port' (type: integer) -> Port number to unbind. No return value. Description: Request browser port unbinding.
As a Python code analyst, you investigate and solve complex coding mysteries
def Browser_setWindowBounds(self, windowId, bounds): """ Function path: Browser.setWindowBounds Domain: Browser Method name: setWindowBounds Parameters: Required arguments: 'windowId' (type: WindowID) -> Browser window id. 'bounds' (type: Bounds) -> New window bounds. The 'minimized', 'max...
Can you write a function in Python 3 where it functions path: Browser.setWindowBounds Domain: Browser Method name: setWindowBounds Parameters: Required arguments: 'windowId' (type: WindowID) -> Browser window id. 'bounds' (type: Bounds) -> New window bounds. The 'minimized', 'maximized' and 'fullscreen' states cannot b...
As a python code expert, you are capable of creating scripts from specifications.
def Runtime_evaluate(self, expression, **kwargs): """ Function path: Runtime.evaluate Domain: Runtime Method name: evaluate Parameters: Required arguments: 'expression' (type: string) -> Expression to evaluate. Optional arguments: 'objectGroup' (type: string) -> Symbolic group name tha...
How would you code a function in Python 3 to function path: Runtime.evaluate Domain: Runtime Method name: evaluate Parameters: Required arguments: 'expression' (type: string) -> Expression to evaluate. Optional arguments: 'objectGroup' (type: string) -> Symbolic group name that can be used to release multiple objects. ...
You are a Python code analyst, evaluating scripts for potential improvements.
def Runtime_callFunctionOn(self, functionDeclaration, **kwargs): """ Function path: Runtime.callFunctionOn Domain: Runtime Method name: callFunctionOn Parameters: Required arguments: 'functionDeclaration' (type: string) -> Declaration of the function to call. Optional arguments: 'objec...
Implement a function in Python 3 to function path: Runtime.callFunctionOn Domain: Runtime Method name: callFunctionOn Parameters: Required arguments: 'functionDeclaration' (type: string) -> Declaration of the function to call. Optional arguments: 'objectId' (type: RemoteObjectId) -> Identifier of the object to call fun...
You are a Python code generator, capable of creating scripts from specifications.
def Runtime_releaseObjectGroup(self, objectGroup): """ Function path: Runtime.releaseObjectGroup Domain: Runtime Method name: releaseObjectGroup Parameters: Required arguments: 'objectGroup' (type: string) -> Symbolic object group name. No return value. Description: Releases all remote...
Can you create a Python 3 function that functions path: Runtime.releaseObjectGroup Domain: Runtime Method name: releaseObjectGroup Parameters: Required arguments: 'objectGroup' (type: string) -> Symbolic object group name. No return value. Description: Releases all remote objects that belong to a given group.
As a python code expert, you are capable of creating scripts from specifications.
def Runtime_setCustomObjectFormatterEnabled(self, enabled): """ Function path: Runtime.setCustomObjectFormatterEnabled Domain: Runtime Method name: setCustomObjectFormatterEnabled WARNING: This function is marked 'Experimental'! Parameters: Required arguments: 'enabled' (type: boolean) ->...
Write a Python 3 script to function path: Runtime.setCustomObjectFormatterEnabled Domain: Runtime Method name: setCustomObjectFormatterEnabled WARNING: This function is marked 'Experimental'! Parameters: Required arguments: 'enabled' (type: boolean) -> No description No return value.
As a Python code composer, you craft elegant and concise scripts.
Runtime. compileScript - Executes a script.
Explain what the following Python 3 code does def Runtime_compileScript(self, expression, sourceURL, persistScript, **kwargs ): """ Function path: Runtime.compileScript Domain: Runtime Method name: compileScript Parameters: Required arguments: 'expression' (type: string) -> Expression to c...
As a python code expert, you are capable of creating scripts from specifications.
Runtime. runScript - Runs a script in a given context.
Can you generate the documentation for the following Python 3 function def Runtime_runScript(self, scriptId, **kwargs): if 'objectGroup' in kwargs: assert isinstance(kwargs['objectGroup'], (str,) ), "Optional argument 'objectGroup' must be of type '['str']'. Received type: '%s'" % type( kwargs['objec...
As a Python code composer, you craft elegant and concise scripts.
This method is used to set the active state of all breakpoints on the page.
Can you generate a brief explanation for the following Python 3 code def Debugger_setBreakpointsActive(self, active): assert isinstance(active, (bool,) ), "Argument 'active' must be of type '['bool']'. Received type: '%s'" % type( active) subdom_funcs = self.synchronous_command('Debugger.setBreakpointsA...
You are a Python code generator, capable of creating scripts from specifications.
This method is used to set the skip pauses of all pages.
Explain what the following Python 3 code does def Debugger_setSkipAllPauses(self, skip): assert isinstance(skip, (bool,) ), "Argument 'skip' must be of type '['bool']'. Received type: '%s'" % type( skip) subdom_funcs = self.synchronous_command('Debugger.setSkipAllPauses', skip =skip) return subd...
As a Python code analyst, you investigate and solve complex coding mysteries
def Debugger_setScriptSource(self, scriptId, scriptSource, **kwargs): """ Function path: Debugger.setScriptSource Domain: Debugger Method name: setScriptSource Parameters: Required arguments: 'scriptId' (type: Runtime.ScriptId) -> Id of the script to edit. 'scriptSource' (type: string) -> ...
How would you implement a function in Python 3 that functions path: Debugger.setScriptSource Domain: Debugger Method name: setScriptSource Parameters: Required arguments: 'scriptId' (type: Runtime.ScriptId) -> Id of the script to edit. 'scriptSource' (type: string) -> New content of the script. Optional arguments: 'dry...
You are a Python code generator, capable of creating scripts from specifications.
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...
How would you implement a function in Python 3 that functions 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 ...
As a Python code translator, you convert algorithms and pseudocode into Python.
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...
Create a Python 3 function to 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 ...
You are a Python code analyst, evaluating scripts for potential improvements.
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...
Write a Python 3 script to 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 r...
You are a Python code analyst, evaluating scripts for potential improvements.
This function is used to set patterns in the script url for blackboxing.
Given the following Python 3 function, write the documentation def Debugger_setBlackboxPatterns(self, patterns): assert isinstance(patterns, (list, tuple) ), "Argument 'patterns' must be of type '['list', 'tuple']'. Received type: '%s'" % type( patterns) subdom_funcs = self.synchronous_command('Debugger...
You are a Python code generator, capable of creating scripts from specifications.
This method is used to set blackboxed ranges in a script.
How would you explain what the following Python 3 function does def Debugger_setBlackboxedRanges(self, scriptId, positions): assert isinstance(positions, (list, tuple) ), "Argument 'positions' must be of type '['list', 'tuple']'. Received type: '%s'" % type( positions) subdom_funcs = self.synchronous_co...
You are a Python code analyst, evaluating scripts for potential improvements.
This method is used to change CPU profiler sampling interval in microseconds.
How would you explain what the following Python 3 function does def Profiler_setSamplingInterval(self, interval): assert isinstance(interval, (int,) ), "Argument 'interval' must be of type '['int']'. Received type: '%s'" % type( interval) subdom_funcs = self.synchronous_command('Profiler.setSamplingInte...
You are a Python code architect, reviewing and designing scalable and efficient code
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 ...
Implement a function in Python 3 to give 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...
As a Python code analyst, you investigate and solve complex coding mysteries
Return the cookies from the remote browser.
Can you tell what is the following Python 3 function doing 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 = sel...
You are a Python code generator, capable of creating scripts from specifications.
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: ...
Write a Python 3 script for setting a cookie on the remote chromium instance.
You are a Python code generator, capable of creating scripts from specifications.
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...
Write a Python 3 function for getting the URL of the current window.
As a Python code composer, you craft elegant and concise scripts.
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...
Can you create a Python 3 function that gets the title and current url from the remote session.
As a Python code analyst, you investigate and solve complex coding mysteries
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
Create a Python 3 function for executing a javascript string in the context of the browser tab.
As a Python code analyst, you investigate and solve complex coding mysteries
This method searches the DOM tree for a given search string.
Can you generate the documentation for the following Python 3 function def find_element(self, search): ''' DOM_performSearch(self, query, includeUserAgentShadowDOM) Python Function: DOM_performSearch Domain: DOM Method name: performSearch WARNING: This function is marked 'Experimen...
You are a Python code analyst, evaluating scripts for potential improvements.
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...
Write a Python 3 function for getting the response body from Network_getResponseBody and return it as a dict.
As a Python code composer, you craft elegant and concise scripts.
This method is called when the page location has changed.
Can you generate a brief explanation for the following Python 3 code 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 lo...
As a Python code analyst, you investigate and solve complex coding mysteries
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...
Create a Python 3 function for doing 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...
You are a Python code generator, capable of creating scripts from specifications.
Get the rendered HTML markup for the current page.
Can you tell what is the following Python 3 function doing 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 ...
As a Python code translator, you convert algorithms and pseudocode into Python.
Take a screenshot of the virtual viewport content.
Given the following Python 3 function, write the documentation 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.b...
As a Python code composer, you craft elegant and concise scripts.
This method is used to send a blocking navigate command to url.
Here you have a function in Python 3, explain what it does 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 jav...
You are a Python code generator, capable of creating scripts from specifications.
Get a chromium tab from the pool optionally one that has an association with a specific netloc and URL.
Here you have a function in Python 3, explain what it does 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 `e...
You are a Python code architect, reviewing and designing scalable and efficient code
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...
How would you code a function in Python 3 to return a function to be run when the parent process dies
As a python code expert, you are capable of creating scripts from specifications.
A context manager for conveniently handling the lifetime of a chrome instance.
How would you explain what the following Python 3 function does 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 fo...
You are a Python code architect, reviewing and designing scalable and efficient code
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 ...
Write a Python 3 function for forwarding 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 ...
You are a Python code analyst, evaluating scripts for potential improvements.
Drain the transport connection.
Here you have a function in Python 3, explain what it does 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 ...
As a Python code translator, you convert algorithms and pseudocode into Python.
This function is a HACK! This function is a HACK! This function is a HACK! This function is a HACK! This function is a HACK! This function is a HACK! This function is a HACK! This function is a HACK! This function is a HACK! This function is a HACK! This function is a HACK! This function is a HACK! This function is a H...
How would you explain what the following Python 3 function does 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 ...
You are a Python code generator, capable of creating scripts from specifications.
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...
Can you write a function in Python 3 where it emits a record to the output stream.
You are a Python code generator, capable of creating scripts from specifications.
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: ...
Create a Python 3 function to emit a record. If the stream was not opened because 'delay' was specified in the constructor, open it before calling the superclass's emit.
As a python code expert, you are capable of creating scripts from specifications.
This is the version from Django 1. 7.
Explain what the following Python 3 code does def run_suite(self, suite, **kwargs): return self.test_runner( verbosity=self.verbosity, failfast=self.failfast, no_colour=self.no_colour, ).run(suite)
You are a Python code architect, reviewing and designing scalable and efficient code
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...
How would you implement a function in Python 3 that generates a private key of key_length bits and attaches it to the object as the private_key variable.
As a Python code translator, you convert algorithms and pseudocode into Python.
def generate_public_key(self): """ Generates public key. :return: void :rtype: void """ self.public_key = pow(self.generator, self.__private_key, self.prime)
Can you implement a function in Python 3 that generates public key. :return: void :rtype: void
You are a Python code analyst, evaluating scripts for potential improvements.
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...
Write a Python 3 script to generate a shared secret from the other party s public key.
You are a Python code analyst, evaluating scripts for potential improvements.
Decorator for functions that require a public key to be defined.
Make a summary of the following Python 3 code def requires_public_key(func): def func_wrapper(self, *args, **kwargs): if hasattr(self, "public_key"): func(self, *args, **kwargs) else: self.generate_public_key() func(self, *args, **kwargs) return func_wrapper
As a Python code translator, you convert algorithms and pseudocode into Python.
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)
How would you code a function in Python 3 to print the debug flag if set to True in the config. yaml file.
As a Python code translator, you convert algorithms and pseudocode into Python.
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: ...
Implement a Python 3 function for printing the current elapsed time.
You are a Python code analyst, evaluating scripts for potential improvements.
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) ...
Can you create a Python 3 function that checks if resource at URL is fetchable.
You are a Python code analyst, evaluating scripts for potential improvements.
Get the current base URL.
Here you have a function in Python 3, explain what it does def get_base_url(webdriver): current_url = webdriver.current_url try: return re.findall("^[^/]+//[^/$]+", current_url)[0] except: raise RuntimeError( u("Unable to process base url: {0}").format(cur...
As a Python code composer, you craft elegant and concise scripts.
Get the current date and time on the web browser as a Python datetime object.
Here you have a function in Python 3, explain what it does def get_browser_datetime(webdriver): js_stmt = """ var wtf_get_date = new Date(); return {'month':wtf_get_date.getMonth(), 'day':wtf_get_date.getDate(), 'year':wtf_get_date.getFullYear(),...
You are a Python code analyst, evaluating scripts for potential improvements.
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...
Implement a function in Python 3 to check if a web driver is mobile
As a Python code analyst, you investigate and solve complex coding mysteries
Check if a web driver is iOS
Here you have a function in Python 3, explain what it does def is_webdriver_ios(webdriver): browser = webdriver.capabilities['browserName'] if (browser == u('iPhone') or browser == u('iPad')): return True else: return False
As a Python code analyst, you investigate and solve complex coding mysteries
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...
Can you write a function in Python 3 where it converts a row into a dictionary of key - value pairs.
As a Python code composer, you craft elegant and concise scripts.
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...
Write a Python 3 script for creating an instance of BrowserStandBy and immediately return a running instance.
As a Python code translator, you convert algorithms and pseudocode into Python.
Start standing by. A periodic command like 'current_url' will be sent to the webdriver instance to prevent it from timing out.
Can you generate a brief explanation for the following Python 3 code def start(self): self._end_time = datetime.now() + timedelta(seconds=self._max_time) self._thread = Thread(target=lambda: self.__stand_by_loop()) self._keep_running = True self._thread.start() return self
As a Python code translator, you convert algorithms and pseudocode into Python.
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_...
Write a Python 3 script to get a temp path.
You are a Python code generator, capable of creating scripts from specifications.
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...
Can you create a Python 3 function that creates a temporary file with the given name.
You are a Python code generator, capable of creating scripts from specifications.
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...
Implement a Python 3 function for downloading a URL contents to a tempfile.
You are a Python code architect, reviewing and designing scalable and efficient code
Class method short cut to call PageFactory. create_page on itself using a webdriver.
Here you have a function in Python 3, explain what it does def create_page(cls, webdriver=None, **kwargs): if not webdriver: webdriver = WTF_WEBDRIVER_MANAGER.get_driver() return PageFactory.create_page(cls, webdriver=webdriver, **kwargs)
As a python code expert, you are capable of creating scripts from specifications.
Instantiate a Page object from a given class or interface.
How would you explain what the following Python 3 function does 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): PageOb...
You are a Python code analyst, evaluating scripts for potential improvements.
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...
Implement a Python 3 function for attempting to instantiate a page object.
You are a Python code analyst, evaluating scripts for potential improvements.
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...
Write a Python 3 function that can iterate over all subclasses of a given class.
As a python code expert, you are capable of creating scripts from specifications.
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 ...
Implement a Python 3 function for checking if all CSS selectors passed in are found.
You are a Python code analyst, evaluating scripts for potential improvements.
Waits until a page is loaded.
Explain what the following Python 3 code does def wait_until_page_loaded(page_obj_class, webdriver=None, timeout=WTF_TIMEOUT_MANAGER.NORMAL, sleep=0.5, bad_page_classes=[], ...
As a Python code composer, you craft elegant and concise scripts.
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 """...
Implement a Python 3 function for waiting until the page is ready.
You are a Python code architect, reviewing and designing scalable and efficient code
Get the full system path of a given asset.
Can you tell what is the following Python 3 function doing def get_asset_path(self, filename): if os.path.exists(os.path.join(self._asset_path, filename)): return os.path.join(self._asset_path, filename) else: raise AssetNotFoundError( u("Cannot find asset: {0}")....
As a Python code translator, you convert algorithms and pseudocode into Python.
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...
Write a Python 3 script to create a Selenium WebDriver instance based on config settings.
You are a Python code architect, reviewing and designing scalable and efficient code
Reads the config value for browser type.
Can you generate a brief explanation for the following Python 3 code 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) exce...
As a Python code composer, you craft elegant and concise scripts.
Creates an instance of Safari webdriver.
How would you explain what the following Python 3 function does 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 se...
You are a Python code architect, reviewing and designing scalable and efficient code
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']) ...
How would you code a function in Python 3 to create an instance of PhantomJS driver.
You are a Python code analyst, evaluating scripts for potential improvements.
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) ...
Implement a Python 3 function for creating a remote webdriver instance from the config file.
You are a Python code generator, capable of creating scripts from specifications.
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(): ...
Can you write a function in Python 3 where it cleans up webdrivers created during execution.
As a Python code composer, you craft elegant and concise scripts.
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...
Create a Python 3 function to close current running instance of Webdriver.
As a Python code analyst, you investigate and solve complex coding mysteries
Get an already running instance of Webdriver.
Can you generate a brief explanation for the following Python 3 code 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_M...
As a Python code composer, you craft elegant and concise scripts.