INSTRUCTION
stringlengths
1
8.43k
RESPONSE
stringlengths
75
104k
Makes a texture consisting on a grid of hexagons.
def make_hex_texture(grid_size = 2, resolution=1): """Makes a texture consisting on a grid of hexagons. Args: grid_size (int): the number of hexagons along each dimension of the grid resolution (int): the number of midpoints along the line of each hexagon Returns: A texture. ...
Makes a surface by generating random noise and blurring it.
def make_noise_surface(dims=DEFAULT_DIMS, blur=10, seed=None): """Makes a surface by generating random noise and blurring it. Args: dims (pair): the dimensions of the surface to create blur (float): the amount of Gaussian blur to apply seed (int): a random seed to use (optional) ...
Makes a pair of gradients to generate textures from numpy primitives.
def make_gradients(dims=DEFAULT_DIMS): """Makes a pair of gradients to generate textures from numpy primitives. Args: dims (pair): the dimensions of the surface to create Returns: pair: A pair of surfaces. """ return np.meshgrid( np.linspace(0.0, 1.0, dims[0]), np.l...
Makes a surface from the 3D sine function.
def make_sine_surface(dims=DEFAULT_DIMS, offset=0.5, scale=1.0): """Makes a surface from the 3D sine function. Args: dims (pair): the dimensions of the surface to create offset (float): an offset applied to the function scale (float): a scale applied to the sine frequency Returns: ...
Makes a surface from the product of sine functions on each axis.
def make_bubble_surface(dims=DEFAULT_DIMS, repeat=3): """Makes a surface from the product of sine functions on each axis. Args: dims (pair): the dimensions of the surface to create repeat (int): the frequency of the waves is set to ensure this many repetitions of the function ...
Solve a path using or - tools Vehicle Routing Problem solver. Params: path_graph the PathGraph representing the problem initial_solution a solution to start with ( list of indices not including the origin ) runtime_seconds how long to search before returning
def vrp_solver(path_graph, initial_solution=None, runtime_seconds=60): """Solve a path using or-tools' Vehicle Routing Problem solver. Params: path_graph the PathGraph representing the problem initial_solution a solution to start with (list of indices, not inclu...
Initialize a controller.
def init_controller(url): """Initialize a controller. Provides a single global controller for applications that can't do this themselves """ # pylint: disable=global-statement global _VERA_CONTROLLER created = False if _VERA_CONTROLLER is None: _VERA_CONTROLLER = VeraController(...
Perform a data_request and return the result.
def data_request(self, payload, timeout=TIMEOUT): """Perform a data_request and return the result.""" request_url = self.base_url + "/data_request" return requests.get(request_url, timeout=timeout, params=payload)
Get basic device info from Vera.
def get_simple_devices_info(self): """Get basic device info from Vera.""" j = self.data_request({'id': 'sdata'}).json() self.scenes = [] items = j.get('scenes') for item in items: self.scenes.append(VeraScene(item, self)) if j.get('temperature'): ...
Search the list of connected devices by name.
def get_device_by_name(self, device_name): """Search the list of connected devices by name. device_name param is the string name of the device """ # Find the device for the vera device name we are interested in found_device = None for device in self.get_devices(): ...
Search the list of connected devices by ID.
def get_device_by_id(self, device_id): """Search the list of connected devices by ID. device_id param is the integer ID of the device """ # Find the device for the vera device name we are interested in found_device = None for device in self.get_devices(): if...
Get list of connected devices.
def get_devices(self, category_filter=''): """Get list of connected devices. category_filter param is an array of strings """ # pylint: disable=too-many-branches # the Vera rest API is a bit rough so we need to make 2 calls to get # all the info e need self.get_...
Refresh data from Vera device.
def refresh_data(self): """Refresh data from Vera device.""" j = self.data_request({'id': 'sdata'}).json() self.temperature_units = j.get('temperature', 'C') self.model = j.get('model') self.version = j.get('version') self.serial_number = j.get('serial_number') ...
Get full Vera device service info.
def map_services(self): """Get full Vera device service info.""" # the Vera rest API is a bit rough so we need to make 2 calls # to get all the info e need self.get_simple_devices_info() j = self.data_request({'id': 'status', 'output_format': 'json'}).json() service_map...
Get data since last timestamp.
def get_changed_devices(self, timestamp): """Get data since last timestamp. This is done via a blocking call, pass NONE for initial state. """ if timestamp is None: payload = {} else: payload = { 'timeout': SUBSCRIPTION_WAIT, ...
Perfom a vera_request for this device.
def vera_request(self, **kwargs): """Perfom a vera_request for this device.""" request_payload = { 'output_format': 'json', 'DeviceNum': self.device_id, } request_payload.update(kwargs) return self.vera_controller.data_request(request_payload)
Set a variable on the vera device.
def set_service_value(self, service_id, set_name, parameter_name, value): """Set a variable on the vera device. This will call the Vera api to change device state. """ payload = { 'id': 'lu_action', 'action': 'Set' + set_name, 'serviceId': service_id,...
Call a Vera service.
def call_service(self, service_id, action): """Call a Vera service. This will call the Vera api to change device state. """ result = self.vera_request(id='action', serviceId=service_id, action=action) logger.debug("call_service: " ...
Set a variable in the local state dictionary.
def set_cache_value(self, name, value): """Set a variable in the local state dictionary. This does not change the physical device. Useful if you want the device state to refect a new value which has not yet updated drom Vera. """ dev_info = self.json_state.get('deviceInf...
Set a variable in the local complex state dictionary.
def set_cache_complex_value(self, name, value): """Set a variable in the local complex state dictionary. This does not change the physical device. Useful if you want the device state to refect a new value which has not yet updated from Vera. """ for item in self.json_sta...
Get a value from the service dictionaries.
def get_complex_value(self, name): """Get a value from the service dictionaries. It's best to use get_value if it has the data you require since the vera subscription only updates data in dev_info. """ for item in self.json_state.get('states'): if item.get('variable'...
Get a case - sensitive keys value from the dev_info area.
def get_strict_value(self, name): """Get a case-sensitive keys value from the dev_info area. """ dev_info = self.json_state.get('deviceInfo') return dev_info.get(name, None)
Refresh a value from the service dictionaries.
def refresh_complex_value(self, name): """Refresh a value from the service dictionaries. It's best to use get_value / refresh if it has the data you need. """ for item in self.json_state.get('states'): if item.get('variable') == name: service_id = item.get('s...
Refresh the dev_info data used by get_value.
def refresh(self): """Refresh the dev_info data used by get_value. Only needed if you're not using subscriptions. """ j = self.vera_request(id='sdata', output_format='json').json() devices = j.get('devices') for device_data in devices: if device_data.get('id'...
Update the dev_info data from a dictionary.
def update(self, params): """Update the dev_info data from a dictionary. Only updates if it already exists in the device. """ dev_info = self.json_state.get('deviceInfo') dev_info.update({k: params[k] for k in params if dev_info.get(k)})
Get level from vera.
def level(self): """Get level from vera.""" # Used for dimmers, curtains # Have seen formats of 10, 0.0 and "0%"! level = self.get_value('level') try: return int(float(level)) except (TypeError, ValueError): pass try: return int...
Set the switch state also update local state.
def set_switch_state(self, state): """Set the switch state, also update local state.""" self.set_service_value( self.switch_service, 'Target', 'newTargetValue', state) self.set_cache_value('Status', state)
Get dimmer state.
def is_switched_on(self, refresh=False): """Get dimmer state. Refresh data from Vera if refresh is True, otherwise use local cache. Refresh is only needed if you're not using subscriptions. """ if refresh: self.refresh() return self.get_brightness(ref...
Get dimmer brightness.
def get_brightness(self, refresh=False): """Get dimmer brightness. Refresh data from Vera if refresh is True, otherwise use local cache. Refresh is only needed if you're not using subscriptions. Converts the Vera level property for dimmable lights from a percentage to the 0 - 25...
Set dimmer brightness.
def set_brightness(self, brightness): """Set dimmer brightness. Converts the Vera level property for dimmable lights from a percentage to the 0 - 255 scale used by HA. """ percent = 0 if brightness > 0: percent = round(brightness / 2.55) self.set_ser...
Get color index.
def get_color_index(self, colors, refresh=False): """Get color index. Refresh data from Vera if refresh is True, otherwise use local cache. """ if refresh: self.refresh_complex_value('SupportedColors') sup = self.get_complex_value('SupportedColors') if sup i...
Get color.
def get_color(self, refresh=False): """Get color. Refresh data from Vera if refresh is True, otherwise use local cache. """ if refresh: self.refresh_complex_value('CurrentColor') ci = self.get_color_index(['R', 'G', 'B'], refresh) cur = self.get_complex_valu...
Set dimmer color.
def set_color(self, rgb): """Set dimmer color. """ target = ','.join([str(c) for c in rgb]) self.set_service_value( self.color_service, 'ColorRGB', 'newColorRGBTarget', target) rgbi = self.get_color_index(['R', 'G', 'B']) ...
Set the armed state also update local state.
def set_armed_state(self, state): """Set the armed state, also update local state.""" self.set_service_value( self.security_sensor_service, 'Armed', 'newArmedValue', state) self.set_cache_value('Armed', state)
Get armed state.
def is_switched_on(self, refresh=False): """Get armed state. Refresh data from Vera if refresh is True, otherwise use local cache. Refresh is only needed if you're not using subscriptions. """ if refresh: self.refresh() val = self.get_value('Armed') r...
Get curtains state.
def is_open(self, refresh=False): """Get curtains state. Refresh data from Vera if refresh is True, otherwise use local cache. Refresh is only needed if you're not using subscriptions. """ if refresh: self.refresh() return self.get_level(refresh) > 0
Set open level of the curtains.
def set_level(self, level): """Set open level of the curtains. Scale is 0-100 """ self.set_service_value( self.dimmer_service, 'LoadLevelTarget', 'newLoadlevelTarget', level) self.set_cache_value('level', level)
Get the last used PIN user id
def get_last_user(self, refresh=False): """Get the last used PIN user id""" if refresh: self.refresh_complex_value('sl_UserCode') val = self.get_complex_value("sl_UserCode") # Syntax string: UserID="<pin_slot>" UserName="<pin_code_name>" # See http://wiki.micasaverde....
Get the list of PIN codes
def get_pin_codes(self, refresh=False): """Get the list of PIN codes Codes can also be found with self.get_complex_value('PinCodes') """ if refresh: self.refresh() val = self.get_value("pincodes") # val syntax string: <VERSION=3>next_available_user_code_id\t...
Set current goal temperature/ setpoint
def set_temperature(self, temp): """Set current goal temperature / setpoint""" self.set_service_value( self.thermostat_setpoint, 'CurrentSetpoint', 'NewCurrentSetpoint', temp) self.set_cache_value('setpoint', temp)
Get current goal temperature/ setpoint
def get_current_goal_temperature(self, refresh=False): """Get current goal temperature / setpoint""" if refresh: self.refresh() try: return float(self.get_value('setpoint')) except (TypeError, ValueError): return None
Get current temperature
def get_current_temperature(self, refresh=False): """Get current temperature""" if refresh: self.refresh() try: return float(self.get_value('temperature')) except (TypeError, ValueError): return None
Set the hvac mode
def set_hvac_mode(self, mode): """Set the hvac mode""" self.set_service_value( self.thermostat_operating_service, 'ModeTarget', 'NewModeTarget', mode) self.set_cache_value('mode', mode)
Set the fan mode
def set_fan_mode(self, mode): """Set the fan mode""" self.set_service_value( self.thermostat_fan_service, 'Mode', 'NewMode', mode) self.set_cache_value('fanmode', mode)
Get last scene id.
def get_last_scene_id(self, refresh=False): """Get last scene id. Refresh data from Vera if refresh is True, otherwise use local cache. Refresh is only needed if you're not using subscriptions. """ if refresh: self.refresh_complex_value('LastSceneID') sel...
Get last scene time.
def get_last_scene_time(self, refresh=False): """Get last scene time. Refresh data from Vera if refresh is True, otherwise use local cache. Refresh is only needed if you're not using subscriptions. """ if refresh: self.refresh_complex_value('LastSceneTime') v...
Perfom a vera_request for this scene.
def vera_request(self, **kwargs): """Perfom a vera_request for this scene.""" request_payload = { 'output_format': 'json', 'SceneNum': self.scene_id, } request_payload.update(kwargs) return self.vera_controller.data_request(request_payload)
Activate a Vera scene.
def activate(self): """Activate a Vera scene. This will call the Vera api to activate a scene. """ payload = { 'id': 'lu_action', 'action': 'RunScene', 'serviceId': self.scene_service } result = self.vera_request(**payload) log...
Refresh the data used by get_value.
def refresh(self): """Refresh the data used by get_value. Only needed if you're not using subscriptions. """ j = self.vera_request(id='sdata', output_format='json').json() scenes = j.get('scenes') for scene_data in scenes: if scene_data.get('id') == self.scen...
Register a callback.
def register(self, device, callback): """Register a callback. device: device to be updated by subscription callback: callback for notification of changes """ if not device: logger.error("Received an invalid device: %r", device) return logger.debu...
Remove a registered a callback.
def unregister(self, device, callback): """Remove a registered a callback. device: device that has the subscription callback: callback used in original registration """ if not device: logger.error("Received an invalid device: %r", device) return ...
Start a thread to handle Vera blocked polling.
def start(self): """Start a thread to handle Vera blocked polling.""" self._poll_thread = threading.Thread(target=self._run_poll_server, name='Vera Poll Thread') self._poll_thread.deamon = True self._poll_thread.start()
Format the UTC timestamp for Elasticsearch eg. 2014 - 07 - 09T08: 37: 18. 000Z
def format_timestamp(ts): """ Format the UTC timestamp for Elasticsearch eg. 2014-07-09T08:37:18.000Z @see https://docs.python.org/2/library/time.html#time.strftime """ tz_info = tz.tzutc() return datetime.fromtimestamp(ts, tz=tz_info).strftime("%Y-%m-%dT%H:%M:%S....
Choose between small medium large... depending on the amount specified.
def _pick_level(cls, btc_amount): """ Choose between small, medium, large, ... depending on the amount specified. """ for size, level in cls.TICKER_LEVEL: if btc_amount < size: return level return cls.TICKER_LEVEL[-1][1]
Render a single line for TSV file with data flow described
def format_tsv_line(source, edge, target, value=None, metadata=None): """ Render a single line for TSV file with data flow described :type source str :type edge str :type target str :type value float :type metadata str :rtype: str """ return '{source}\t{edge}\t{target}\t{value}\...
Render a. dot file with graph definition from a given set of data
def format_graphviz_lines(lines): """ Render a .dot file with graph definition from a given set of data :type lines list[dict] :rtype: str """ # first, prepare the unique list of all nodes (sources and targets) lines_nodes = set() for line in lines: lines_nodes.add(line['source...
: type logs str []: type _map ( list ) - > str: type _reduce ( list ) - > obj
def logs_map_and_reduce(logs, _map, _reduce): """ :type logs str[] :type _map (list) -> str :type _reduce (list) -> obj """ keys = [] mapped_count = Counter() mapped = defaultdict(list) # first map all entries for log in logs: key = _map(log) mapped[key].append(l...
Close the remote chromium instance.
def close_chromium(self): ''' Close the remote chromium instance. This command is normally executed as part of the class destructor. It can be called early without issue, but calling ANY class functions after the remote chromium instance is shut down will have unknown effects. Note that if you are rapidly...
Open a websocket connection to remote browser determined by self. host and self. port. Each tab has it s own websocket endpoint.
def connect(self, tab_key): """ Open a websocket connection to remote browser, determined by self.host and self.port. Each tab has it's own websocket endpoint. """ assert self.tablist is not None tab_idx = self._get_tab_idx_for_key(tab_key) if not self.tablist: self.tablist = self.fetch_tablist(...
Close websocket connection to remote browser.
def close_websockets(self): """ Close websocket connection to remote browser.""" self.log.info("Websocket Teardown called") for key in list(self.soclist.keys()): if self.soclist[key]: self.soclist[key].close() self.soclist.pop(key)
Connect to host: port and request list of tabs return list of dicts of data about open tabs.
def fetch_tablist(self): """Connect to host:port and request list of tabs return list of dicts of data about open tabs.""" # find websocket endpoint try: response = requests.get("http://%s:%s/json" % (self.host, self.port)) except requests.exceptions.ConnectionError: raise cr_exceptions.ChromeConnectF...
Synchronously execute command command with params params in the remote chrome instance returning the response from the chrome instance.
def synchronous_command(self, command, tab_key, **params): """ Synchronously execute command `command` with params `params` in the remote chrome instance, returning the response from the chrome instance. """ self.log.debug("Synchronous_command to tab %s (%s):", tab_key, self._get_cr_tab_meta_for_key(tab_key)...
Send command command with optional parameters params to the remote chrome instance.
def send(self, command, tab_key, params=None): ''' Send command `command` with optional parameters `params` to the remote chrome instance. The command `id` is automatically added to the outgoing message. return value is the command id, which can be used to match a command to it's associated response. ''...
Receive a filtered message using the callable keycheck to filter received messages for content.
def recv_filtered(self, keycheck, tab_key, timeout=30, message=None): ''' Receive a filtered message, using the callable `keycheck` to filter received messages for content. `keycheck` is expected to be a callable that takes a single parameter (the decoded response from chromium), and returns a boolean (true,...
Receive a all messages matching a filter using the callable keycheck to filter received messages for content.
def recv_all_filtered(self, keycheck, tab_key, timeout=0.5): ''' Receive a all messages matching a filter, using the callable `keycheck` to filter received messages for content. This function will *ALWAY* block for at least `timeout` seconds. If chromium is for some reason continuously streaming responses, ...
Recieve a message optionally filtering for a specified message id.
def recv(self, tab_key, message_id=None, timeout=30): ''' Recieve a message, optionally filtering for a specified message id. If `message_id` is none, the first command in the receive queue is returned. If `message_id` is not none, the command waits untill a message is received with the specified id, or it t...
Return all messages in waiting for the websocket connection.
def drain(self, tab_key): ''' Return all messages in waiting for the websocket connection. ''' self.log.debug("Draining transport") ret = [] while len(self.messages[tab_key]): ret.append(self.messages[tab_key].pop(0)) self.log.debug("Polling socket") tmp = self.___recv(tab_key) while tmp is not N...
ChromeController
def cli(verbose, silent): ''' ChromeController \b Usage: python3 -m ChromeController [-s | --silent] [-v | --verbose] python3 -m ChromeController fetch <url> [--binary <bin_name>] [--outfile <out_file_name>] python3 -m ChromeController update python3 -m ChromeController (-h | --help) python3 -m ChromeControll...
Fetch a specified URL s content and output it to the console.
def fetch(url, binary, outfile, noprint, rendered): ''' Fetch a specified URL's content, and output it to the console. ''' with chrome_context.ChromeContext(binary=binary) as cr: resp = cr.blocking_navigate_and_get_source(url) if rendered: resp['content'] = cr.get_rendered_page_source() resp['binary'] = F...
Function path: Memory. setPressureNotificationsSuppressed Domain: Memory Method name: setPressureNotificationsSuppressed Parameters: Required arguments: suppressed ( type: boolean ) - > If true memory pressure notifications will be suppressed. No return value. Description: Enable/ disable suppressing memory pressure no...
def Memory_setPressureNotificationsSuppressed(self, suppressed): """ Function path: Memory.setPressureNotificationsSuppressed Domain: Memory Method name: setPressureNotificationsSuppressed Parameters: Required arguments: 'suppressed' (type: boolean) -> If true, memory pressure notifications wil...
Function path: Page. addScriptToEvaluateOnLoad Domain: Page Method name: addScriptToEvaluateOnLoad WARNING: This function is marked Experimental ! Parameters: Required arguments: scriptSource ( type: string ) - > No description Returns: identifier ( type: ScriptIdentifier ) - > Identifier of the added script. Descripti...
def Page_addScriptToEvaluateOnLoad(self, scriptSource): """ Function path: Page.addScriptToEvaluateOnLoad Domain: Page Method name: addScriptToEvaluateOnLoad WARNING: This function is marked 'Experimental'! Parameters: Required arguments: 'scriptSource' (type: string) -> No description ...
Function path: Page. addScriptToEvaluateOnNewDocument Domain: Page Method name: addScriptToEvaluateOnNewDocument WARNING: This function is marked Experimental ! Parameters: Required arguments: source ( type: string ) - > No description Returns: identifier ( type: ScriptIdentifier ) - > Identifier of the added script. D...
def Page_addScriptToEvaluateOnNewDocument(self, source): """ Function path: Page.addScriptToEvaluateOnNewDocument Domain: Page Method name: addScriptToEvaluateOnNewDocument WARNING: This function is marked 'Experimental'! Parameters: Required arguments: 'source' (type: string) -> No descr...
Function path: Page. setAutoAttachToCreatedPages Domain: Page Method name: setAutoAttachToCreatedPages WARNING: This function is marked Experimental ! Parameters: Required arguments: autoAttach ( type: boolean ) - > If true browser will open a new inspector window for every page created from this one. No return value. ...
def Page_setAutoAttachToCreatedPages(self, autoAttach): """ Function path: Page.setAutoAttachToCreatedPages Domain: Page Method name: setAutoAttachToCreatedPages WARNING: This function is marked 'Experimental'! Parameters: Required arguments: 'autoAttach' (type: boolean) -> If true, brows...
Function path: Page. setAdBlockingEnabled Domain: Page Method name: setAdBlockingEnabled WARNING: This function is marked Experimental ! Parameters: Required arguments: enabled ( type: boolean ) - > Whether to block ads. No return value. Description: Enable Chrome s experimental ad filter on all sites.
def Page_setAdBlockingEnabled(self, enabled): """ Function path: Page.setAdBlockingEnabled Domain: Page Method name: setAdBlockingEnabled WARNING: This function is marked 'Experimental'! Parameters: Required arguments: 'enabled' (type: boolean) -> Whether to block ads. No return value....
Function path: Page. navigateToHistoryEntry Domain: Page Method name: navigateToHistoryEntry WARNING: This function is marked Experimental ! Parameters: Required arguments: entryId ( type: integer ) - > Unique id of the entry to navigate to. No return value. Description: Navigates current page to the given history entr...
def Page_navigateToHistoryEntry(self, entryId): """ Function path: Page.navigateToHistoryEntry Domain: Page Method name: navigateToHistoryEntry WARNING: This function is marked 'Experimental'! Parameters: Required arguments: 'entryId' (type: integer) -> Unique id of the entry to navigate ...
Function path: Page. deleteCookie Domain: Page Method name: deleteCookie WARNING: This function is marked Experimental ! Parameters: Required arguments: cookieName ( type: string ) - > Name of the cookie to remove. url ( type: string ) - > URL to match cooke domain and path. No return value. Description: Deletes browse...
def Page_deleteCookie(self, cookieName, url): """ Function path: Page.deleteCookie Domain: Page Method name: deleteCookie WARNING: This function is marked 'Experimental'! Parameters: Required arguments: 'cookieName' (type: string) -> Name of the cookie to remove. 'url' (type: string)...
Function path: Page. getResourceContent Domain: Page Method name: getResourceContent WARNING: This function is marked Experimental ! Parameters: Required arguments: frameId ( type: FrameId ) - > Frame id to get resource for. url ( type: string ) - > URL of the resource to get content for. Returns: content ( type: strin...
def Page_getResourceContent(self, frameId, url): """ Function path: Page.getResourceContent Domain: Page Method name: getResourceContent WARNING: This function is marked 'Experimental'! Parameters: Required arguments: 'frameId' (type: FrameId) -> Frame id to get resource for. 'url' (...
Function path: Page. searchInResource Domain: Page Method name: searchInResource WARNING: This function is marked Experimental ! Parameters: Required arguments: frameId ( type: FrameId ) - > Frame id for resource to search in. url ( type: string ) - > URL of the resource to search in. query ( type: string ) - > String ...
def Page_searchInResource(self, frameId, url, query, **kwargs): """ Function path: Page.searchInResource Domain: Page Method name: searchInResource WARNING: This function is marked 'Experimental'! Parameters: Required arguments: 'frameId' (type: FrameId) -> Frame id for resource to search...
Function path: Page. setDocumentContent Domain: Page Method name: setDocumentContent WARNING: This function is marked Experimental ! Parameters: Required arguments: frameId ( type: FrameId ) - > Frame id to set HTML for. html ( type: string ) - > HTML content to set. No return value. Description: Sets given markup as t...
def Page_setDocumentContent(self, frameId, html): """ Function path: Page.setDocumentContent Domain: Page Method name: setDocumentContent WARNING: This function is marked 'Experimental'! Parameters: Required arguments: 'frameId' (type: FrameId) -> Frame id to set HTML for. 'html' (ty...
Function path: Page. setDeviceMetricsOverride Domain: Page Method name: setDeviceMetricsOverride WARNING: This function is marked Experimental ! Parameters: Required arguments: width ( type: integer ) - > Overriding width value in pixels ( minimum 0 maximum 10000000 ). 0 disables the override. height ( type: integer ) ...
def Page_setDeviceMetricsOverride(self, width, height, deviceScaleFactor, mobile, **kwargs): """ Function path: Page.setDeviceMetricsOverride Domain: Page Method name: setDeviceMetricsOverride WARNING: This function is marked 'Experimental'! Parameters: Required arguments: 'width' (t...
Function path: Page. setDeviceOrientationOverride Domain: Page Method name: setDeviceOrientationOverride WARNING: This function is marked Experimental ! Parameters: Required arguments: alpha ( type: number ) - > Mock alpha beta ( type: number ) - > Mock beta gamma ( type: number ) - > Mock gamma No return value. Descri...
def Page_setDeviceOrientationOverride(self, alpha, beta, gamma): """ Function path: Page.setDeviceOrientationOverride Domain: Page Method name: setDeviceOrientationOverride WARNING: This function is marked 'Experimental'! Parameters: Required arguments: 'alpha' (type: number) -> Mock alph...
Function path: Page. screencastFrameAck Domain: Page Method name: screencastFrameAck WARNING: This function is marked Experimental ! Parameters: Required arguments: sessionId ( type: integer ) - > Frame number. No return value. Description: Acknowledges that a screencast frame has been received by the frontend.
def Page_screencastFrameAck(self, sessionId): """ Function path: Page.screencastFrameAck Domain: Page Method name: screencastFrameAck WARNING: This function is marked 'Experimental'! Parameters: Required arguments: 'sessionId' (type: integer) -> Frame number. No return value. Des...
Function path: Overlay. setShowPaintRects Domain: Overlay Method name: setShowPaintRects Parameters: Required arguments: result ( type: boolean ) - > True for showing paint rectangles No return value. Description: Requests that backend shows paint rectangles
def Overlay_setShowPaintRects(self, result): """ Function path: Overlay.setShowPaintRects Domain: Overlay Method name: setShowPaintRects Parameters: Required arguments: 'result' (type: boolean) -> True for showing paint rectangles No return value. Description: Requests that backend sho...
Function path: Overlay. setShowDebugBorders Domain: Overlay Method name: setShowDebugBorders Parameters: Required arguments: show ( type: boolean ) - > True for showing debug borders No return value. Description: Requests that backend shows debug borders on layers
def Overlay_setShowDebugBorders(self, show): """ Function path: Overlay.setShowDebugBorders Domain: Overlay Method name: setShowDebugBorders Parameters: Required arguments: 'show' (type: boolean) -> True for showing debug borders No return value. Description: Requests that backend show...
Function path: Overlay. setShowFPSCounter Domain: Overlay Method name: setShowFPSCounter Parameters: Required arguments: show ( type: boolean ) - > True for showing the FPS counter No return value. Description: Requests that backend shows the FPS counter
def Overlay_setShowFPSCounter(self, show): """ Function path: Overlay.setShowFPSCounter Domain: Overlay Method name: setShowFPSCounter Parameters: Required arguments: 'show' (type: boolean) -> True for showing the FPS counter No return value. Description: Requests that backend shows th...
Function path: Overlay. setShowScrollBottleneckRects Domain: Overlay Method name: setShowScrollBottleneckRects Parameters: Required arguments: show ( type: boolean ) - > True for showing scroll bottleneck rects No return value. Description: Requests that backend shows scroll bottleneck rects
def Overlay_setShowScrollBottleneckRects(self, show): """ Function path: Overlay.setShowScrollBottleneckRects Domain: Overlay Method name: setShowScrollBottleneckRects Parameters: Required arguments: 'show' (type: boolean) -> True for showing scroll bottleneck rects No return value. De...
Function path: Overlay. setShowViewportSizeOnResize Domain: Overlay Method name: setShowViewportSizeOnResize Parameters: Required arguments: show ( type: boolean ) - > Whether to paint size or not. No return value. Description: Paints viewport size upon main frame resize.
def Overlay_setShowViewportSizeOnResize(self, show): """ Function path: Overlay.setShowViewportSizeOnResize Domain: Overlay Method name: setShowViewportSizeOnResize Parameters: Required arguments: 'show' (type: boolean) -> Whether to paint size or not. No return value. Description: Pai...
Function path: Overlay. setSuspended Domain: Overlay Method name: setSuspended Parameters: Required arguments: suspended ( type: boolean ) - > Whether overlay should be suspended and not consume any resources until resumed. No return value.
def Overlay_setSuspended(self, suspended): """ Function path: Overlay.setSuspended Domain: Overlay Method name: setSuspended Parameters: Required arguments: 'suspended' (type: boolean) -> Whether overlay should be suspended and not consume any resources until resumed. No return value. "...
Function path: Overlay. setInspectMode Domain: Overlay Method name: setInspectMode Parameters: Required arguments: mode ( type: InspectMode ) - > Set an inspection mode. Optional arguments: highlightConfig ( type: HighlightConfig ) - > A descriptor for the highlight appearance of hovered - over nodes. May be omitted if...
def Overlay_setInspectMode(self, mode, **kwargs): """ Function path: Overlay.setInspectMode Domain: Overlay Method name: setInspectMode Parameters: Required arguments: 'mode' (type: InspectMode) -> Set an inspection mode. Optional arguments: 'highlightConfig' (type: HighlightConfig) ->...
Function path: Overlay. highlightRect Domain: Overlay Method name: highlightRect Parameters: Required arguments: x ( type: integer ) - > X coordinate y ( type: integer ) - > Y coordinate width ( type: integer ) - > Rectangle width height ( type: integer ) - > Rectangle height Optional arguments: color ( type: DOM. RGBA...
def Overlay_highlightRect(self, x, y, width, height, **kwargs): """ Function path: Overlay.highlightRect Domain: Overlay Method name: highlightRect Parameters: Required arguments: 'x' (type: integer) -> X coordinate 'y' (type: integer) -> Y coordinate 'width' (type: integer) -> Rectan...
Function path: Overlay. highlightQuad Domain: Overlay Method name: highlightQuad Parameters: Required arguments: quad ( type: DOM. Quad ) - > Quad to highlight Optional arguments: color ( type: DOM. RGBA ) - > The highlight fill color ( default: transparent ). outlineColor ( type: DOM. RGBA ) - > The highlight outline ...
def Overlay_highlightQuad(self, quad, **kwargs): """ Function path: Overlay.highlightQuad Domain: Overlay Method name: highlightQuad Parameters: Required arguments: 'quad' (type: DOM.Quad) -> Quad to highlight Optional arguments: 'color' (type: DOM.RGBA) -> The highlight fill color (de...
Function path: Overlay. highlightNode Domain: Overlay Method name: highlightNode Parameters: Required arguments: highlightConfig ( type: HighlightConfig ) - > A descriptor for the highlight appearance. Optional arguments: nodeId ( type: DOM. NodeId ) - > Identifier of the node to highlight. backendNodeId ( type: DOM. B...
def Overlay_highlightNode(self, highlightConfig, **kwargs): """ Function path: Overlay.highlightNode Domain: Overlay Method name: highlightNode Parameters: Required arguments: 'highlightConfig' (type: HighlightConfig) -> A descriptor for the highlight appearance. Optional arguments: 'n...
Function path: Overlay. highlightFrame Domain: Overlay Method name: highlightFrame Parameters: Required arguments: frameId ( type: Page. FrameId ) - > Identifier of the frame to highlight. Optional arguments: contentColor ( type: DOM. RGBA ) - > The content box highlight fill color ( default: transparent ). contentOutl...
def Overlay_highlightFrame(self, frameId, **kwargs): """ Function path: Overlay.highlightFrame Domain: Overlay Method name: highlightFrame Parameters: Required arguments: 'frameId' (type: Page.FrameId) -> Identifier of the frame to highlight. Optional arguments: 'contentColor' (type: D...
Function path: Emulation. setPageScaleFactor Domain: Emulation Method name: setPageScaleFactor WARNING: This function is marked Experimental ! Parameters: Required arguments: pageScaleFactor ( type: number ) - > Page scale factor. No return value. Description: Sets a specified page scale factor.
def Emulation_setPageScaleFactor(self, pageScaleFactor): """ Function path: Emulation.setPageScaleFactor Domain: Emulation Method name: setPageScaleFactor WARNING: This function is marked 'Experimental'! Parameters: Required arguments: 'pageScaleFactor' (type: number) -> Page scale factor...
Function path: Emulation. setVisibleSize Domain: Emulation Method name: setVisibleSize WARNING: This function is marked Experimental ! Parameters: Required arguments: width ( type: integer ) - > Frame width ( DIP ). height ( type: integer ) - > Frame height ( DIP ). No return value. Description: Resizes the frame/ view...
def Emulation_setVisibleSize(self, width, height): """ Function path: Emulation.setVisibleSize Domain: Emulation Method name: setVisibleSize WARNING: This function is marked 'Experimental'! Parameters: Required arguments: 'width' (type: integer) -> Frame width (DIP). 'height' (type: ...
Function path: Emulation. setScriptExecutionDisabled Domain: Emulation Method name: setScriptExecutionDisabled WARNING: This function is marked Experimental ! Parameters: Required arguments: value ( type: boolean ) - > Whether script execution should be disabled in the page. No return value. Description: Switches scrip...
def Emulation_setScriptExecutionDisabled(self, value): """ Function path: Emulation.setScriptExecutionDisabled Domain: Emulation Method name: setScriptExecutionDisabled WARNING: This function is marked 'Experimental'! Parameters: Required arguments: 'value' (type: boolean) -> Whether scri...
Function path: Emulation. setEmulatedMedia Domain: Emulation Method name: setEmulatedMedia Parameters: Required arguments: media ( type: string ) - > Media type to emulate. Empty string disables the override. No return value. Description: Emulates the given media for CSS media queries.
def Emulation_setEmulatedMedia(self, media): """ Function path: Emulation.setEmulatedMedia Domain: Emulation Method name: setEmulatedMedia Parameters: Required arguments: 'media' (type: string) -> Media type to emulate. Empty string disables the override. No return value. Description: ...
Function path: Emulation. setCPUThrottlingRate Domain: Emulation Method name: setCPUThrottlingRate WARNING: This function is marked Experimental ! Parameters: Required arguments: rate ( type: number ) - > Throttling rate as a slowdown factor ( 1 is no throttle 2 is 2x slowdown etc ). No return value. Description: Enabl...
def Emulation_setCPUThrottlingRate(self, rate): """ Function path: Emulation.setCPUThrottlingRate Domain: Emulation Method name: setCPUThrottlingRate WARNING: This function is marked 'Experimental'! Parameters: Required arguments: 'rate' (type: number) -> Throttling rate as a slowdown fac...
Function path: Emulation. setVirtualTimePolicy Domain: Emulation Method name: setVirtualTimePolicy WARNING: This function is marked Experimental ! Parameters: Required arguments: policy ( type: VirtualTimePolicy ) - > No description Optional arguments: budget ( type: integer ) - > If set after this many virtual millise...
def Emulation_setVirtualTimePolicy(self, policy, **kwargs): """ Function path: Emulation.setVirtualTimePolicy Domain: Emulation Method name: setVirtualTimePolicy WARNING: This function is marked 'Experimental'! Parameters: Required arguments: 'policy' (type: VirtualTimePolicy) -> No descr...
Function path: Emulation. setNavigatorOverrides Domain: Emulation Method name: setNavigatorOverrides WARNING: This function is marked Experimental ! Parameters: Required arguments: platform ( type: string ) - > The platform navigator. platform should return. No return value. Description: Overrides value returned by the...
def Emulation_setNavigatorOverrides(self, platform): """ Function path: Emulation.setNavigatorOverrides Domain: Emulation Method name: setNavigatorOverrides WARNING: This function is marked 'Experimental'! Parameters: Required arguments: 'platform' (type: string) -> The platform navigator...