code
stringlengths
75
104k
docstring
stringlengths
1
46.9k
text
stringlengths
164
112k
def load(self, callback=None, errback=None, reload=False): """ Load record data from the API. """ if not reload and self.data: raise RecordException('record already loaded') def success(result, *args): self._parseModel(result) if callback: ...
Load record data from the API.
Below is the the instruction that describes the task: ### Input: Load record data from the API. ### Response: def load(self, callback=None, errback=None, reload=False): """ Load record data from the API. """ if not reload and self.data: raise RecordException('record alre...
def parse_args(argString=None): """Parses the command line options and arguments. :returns: A :py:class:`argparse.Namespace` object created by the :py:mod:`argparse` module. It contains the values of the different options. ====================== ====== =========================...
Parses the command line options and arguments. :returns: A :py:class:`argparse.Namespace` object created by the :py:mod:`argparse` module. It contains the values of the different options. ====================== ====== ================================ Options Typ...
Below is the the instruction that describes the task: ### Input: Parses the command line options and arguments. :returns: A :py:class:`argparse.Namespace` object created by the :py:mod:`argparse` module. It contains the values of the different options. ====================== ==...
def replace_product_by_id(cls, product_id, product, **kwargs): """Replace Product Replace all attributes of Product This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async=True >>> thread = api.replace_product_by_id(produc...
Replace Product Replace all attributes of Product This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async=True >>> thread = api.replace_product_by_id(product_id, product, async=True) >>> result = thread.get() :par...
Below is the the instruction that describes the task: ### Input: Replace Product Replace all attributes of Product This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async=True >>> thread = api.replace_product_by_id(product_id,...
def compact_elements(elements): """ Create a string (with ranges) given a list of element numbers For example, [1, 2, 3, 6, 7, 8, 10] will return "H-Li,C-O,Ne" """ if len(elements) == 0: return # We have to convert to integers for this function elements = [int(el) for el in element...
Create a string (with ranges) given a list of element numbers For example, [1, 2, 3, 6, 7, 8, 10] will return "H-Li,C-O,Ne"
Below is the the instruction that describes the task: ### Input: Create a string (with ranges) given a list of element numbers For example, [1, 2, 3, 6, 7, 8, 10] will return "H-Li,C-O,Ne" ### Response: def compact_elements(elements): """ Create a string (with ranges) given a list of element numbers ...
def lint(cls, document, is_saved, flags=''): """Plugin interface to pyls linter. Args: document: The document to be linted. is_saved: Whether or not the file has been saved to disk. flags: Additional flags to pass to pylint. Not exposed to pyls_lint, ...
Plugin interface to pyls linter. Args: document: The document to be linted. is_saved: Whether or not the file has been saved to disk. flags: Additional flags to pass to pylint. Not exposed to pyls_lint, but used for testing. Returns: A li...
Below is the the instruction that describes the task: ### Input: Plugin interface to pyls linter. Args: document: The document to be linted. is_saved: Whether or not the file has been saved to disk. flags: Additional flags to pass to pylint. Not exposed to ...
def _find_resource_id_from_path(path): """ Get a folder id from a path on the server. Warning: This is NOT efficient at all. The schema for this path is: path := "/users/<name>/" | "/communities/<name>" , {<subfolder>/} name := <firstname> , "_" , <lastname> :param path: The virtual path ...
Get a folder id from a path on the server. Warning: This is NOT efficient at all. The schema for this path is: path := "/users/<name>/" | "/communities/<name>" , {<subfolder>/} name := <firstname> , "_" , <lastname> :param path: The virtual path on the server. :type path: string :returns:...
Below is the the instruction that describes the task: ### Input: Get a folder id from a path on the server. Warning: This is NOT efficient at all. The schema for this path is: path := "/users/<name>/" | "/communities/<name>" , {<subfolder>/} name := <firstname> , "_" , <lastname> :param path:...
def range_request(numbytes): """Streams n random bytes generated with given seed, at given chunk size per packet. --- tags: - Dynamic data parameters: - in: path name: numbytes type: int produces: - application/octet-stream responses: 200: descript...
Streams n random bytes generated with given seed, at given chunk size per packet. --- tags: - Dynamic data parameters: - in: path name: numbytes type: int produces: - application/octet-stream responses: 200: description: Bytes.
Below is the the instruction that describes the task: ### Input: Streams n random bytes generated with given seed, at given chunk size per packet. --- tags: - Dynamic data parameters: - in: path name: numbytes type: int produces: - application/octet-stream respo...
def create_report(self, report_type, account_id, term_id=None, params={}): """ Generates a report instance for the canvas account id. https://canvas.instructure.com/doc/api/account_reports.html#method.account_reports.create """ if term_id is not None: params["enrollm...
Generates a report instance for the canvas account id. https://canvas.instructure.com/doc/api/account_reports.html#method.account_reports.create
Below is the the instruction that describes the task: ### Input: Generates a report instance for the canvas account id. https://canvas.instructure.com/doc/api/account_reports.html#method.account_reports.create ### Response: def create_report(self, report_type, account_id, term_id=None, params={}): ...
def make_error_response(self, validation_error, expose_errors): """ Return an appropriate ``HttpResponse`` on authentication failure. In case of an error, the specification only details the inclusion of the ``WWW-Authenticate`` header. Additionally, when allowed by the specification, we respond with er...
Return an appropriate ``HttpResponse`` on authentication failure. In case of an error, the specification only details the inclusion of the ``WWW-Authenticate`` header. Additionally, when allowed by the specification, we respond with error details formatted in JSON in the body of the response. For more ...
Below is the the instruction that describes the task: ### Input: Return an appropriate ``HttpResponse`` on authentication failure. In case of an error, the specification only details the inclusion of the ``WWW-Authenticate`` header. Additionally, when allowed by the specification, we respond with error...
def check(self, item_id): """Check if an analysis is complete :type item_id: int :param item_id: task_id to check. :rtype: bool :return: Boolean indicating if a report is done or not. """ response = self._request("tasks/view/{id}".format(id=item_id)) ...
Check if an analysis is complete :type item_id: int :param item_id: task_id to check. :rtype: bool :return: Boolean indicating if a report is done or not.
Below is the the instruction that describes the task: ### Input: Check if an analysis is complete :type item_id: int :param item_id: task_id to check. :rtype: bool :return: Boolean indicating if a report is done or not. ### Response: def check(self, item_id): """Check if...
def write_all(filename, jobjects): """ Serializes the list of objects to disk. JavaObject instances get automatically unwrapped. :param filename: the file to serialize the object to :type filename: str :param jobjects: the list of objects to serialize :type jobjects: list """ array = ja...
Serializes the list of objects to disk. JavaObject instances get automatically unwrapped. :param filename: the file to serialize the object to :type filename: str :param jobjects: the list of objects to serialize :type jobjects: list
Below is the the instruction that describes the task: ### Input: Serializes the list of objects to disk. JavaObject instances get automatically unwrapped. :param filename: the file to serialize the object to :type filename: str :param jobjects: the list of objects to serialize :type jobjects: list ...
def get_digital_channels(channel_list): """Goes through channel list and returns digital channels with ids Dev1/port0/line08, Dev1/port0/line09... Dev1/port0/line30.""" dig_ids = digital_channel_ids() dig_channels = [] for ln in dig_ids: for ch in channel_list: if ch.dct['id'] ==...
Goes through channel list and returns digital channels with ids Dev1/port0/line08, Dev1/port0/line09... Dev1/port0/line30.
Below is the the instruction that describes the task: ### Input: Goes through channel list and returns digital channels with ids Dev1/port0/line08, Dev1/port0/line09... Dev1/port0/line30. ### Response: def get_digital_channels(channel_list): """Goes through channel list and returns digital channels with id...
def platform(self, with_prompt, platforms=None): """Return the platform name based on the prompt matching.""" if platforms is None: platforms = self._dict['generic']['prompt_detection'] for platform in platforms: pattern = self.pattern(platform, 'prompt') res...
Return the platform name based on the prompt matching.
Below is the the instruction that describes the task: ### Input: Return the platform name based on the prompt matching. ### Response: def platform(self, with_prompt, platforms=None): """Return the platform name based on the prompt matching.""" if platforms is None: platforms = self._dic...
def GetEntries(self, parser_mediator, match=None, **unused_kwargs): """Extracts relevant Volume Configuration Spotlight entries. Args: parser_mediator (ParserMediator): mediates interactions between parsers and other components, such as storage and dfvfs. match (Optional[dict[str: object]...
Extracts relevant Volume Configuration Spotlight entries. Args: parser_mediator (ParserMediator): mediates interactions between parsers and other components, such as storage and dfvfs. match (Optional[dict[str: object]]): keys extracted from PLIST_KEYS.
Below is the the instruction that describes the task: ### Input: Extracts relevant Volume Configuration Spotlight entries. Args: parser_mediator (ParserMediator): mediates interactions between parsers and other components, such as storage and dfvfs. match (Optional[dict[str: object]]): ke...
def extract_object_names_from_docs(filename): """Add matches from the text blocks (must be full names!)""" text = split_code_and_text_blocks(filename)[1] text = '\n'.join(t[1] for t in text if t[0] == 'text') regex = re.compile(r':(?:' r'func(?:tion)?|' r'me...
Add matches from the text blocks (must be full names!)
Below is the the instruction that describes the task: ### Input: Add matches from the text blocks (must be full names!) ### Response: def extract_object_names_from_docs(filename): """Add matches from the text blocks (must be full names!)""" text = split_code_and_text_blocks(filename)[1] text = '\n'.joi...
def get_presig(self, target, source, env): """Return the signature contents of this action list. Simple concatenation of the signatures of the elements. """ return b"".join([bytes(x.get_contents(target, source, env)) for x in self.list])
Return the signature contents of this action list. Simple concatenation of the signatures of the elements.
Below is the the instruction that describes the task: ### Input: Return the signature contents of this action list. Simple concatenation of the signatures of the elements. ### Response: def get_presig(self, target, source, env): """Return the signature contents of this action list. Simple...
def select_catalogue(self, valid_id): ''' Method to post-process the catalogue based on the selection options :param numpy.ndarray valid_id: Boolean vector indicating whether each event is selected (True) or not (False) :returns: Catalogue of selecte...
Method to post-process the catalogue based on the selection options :param numpy.ndarray valid_id: Boolean vector indicating whether each event is selected (True) or not (False) :returns: Catalogue of selected events as instance of openquake.hmtk.seismic...
Below is the the instruction that describes the task: ### Input: Method to post-process the catalogue based on the selection options :param numpy.ndarray valid_id: Boolean vector indicating whether each event is selected (True) or not (False) :returns: Catalogue...
def open(self, mode=MODE_READ): """ Opens this repo in the specified mode. TODO: figure out the correct semantics of this and document the intended future behaviour as well as the current transitional behaviour. """ if mode not in [MODE_READ, MODE_WRITE]: ...
Opens this repo in the specified mode. TODO: figure out the correct semantics of this and document the intended future behaviour as well as the current transitional behaviour.
Below is the the instruction that describes the task: ### Input: Opens this repo in the specified mode. TODO: figure out the correct semantics of this and document the intended future behaviour as well as the current transitional behaviour. ### Response: def open(self, mode=MODE_READ): ...
def get_current_hgnc_id(hgnc_name): """Return the HGNC ID(s) corresponding to a current or outdate HGNC symbol. Parameters ---------- hgnc_name : str The HGNC symbol to be converted, possibly an outdated symbol. Returns ------- str or list of str or None If there is a singl...
Return the HGNC ID(s) corresponding to a current or outdate HGNC symbol. Parameters ---------- hgnc_name : str The HGNC symbol to be converted, possibly an outdated symbol. Returns ------- str or list of str or None If there is a single HGNC ID corresponding to the given curren...
Below is the the instruction that describes the task: ### Input: Return the HGNC ID(s) corresponding to a current or outdate HGNC symbol. Parameters ---------- hgnc_name : str The HGNC symbol to be converted, possibly an outdated symbol. Returns ------- str or list of str or None ...
def get_edited_color_scheme(self): """ Get the values of the last edited color scheme to be used in an instant preview in the preview editor, without using `apply`. """ color_scheme = {} scheme_name = self.last_used_scheme for key in self.widgets[scheme_name]: ...
Get the values of the last edited color scheme to be used in an instant preview in the preview editor, without using `apply`.
Below is the the instruction that describes the task: ### Input: Get the values of the last edited color scheme to be used in an instant preview in the preview editor, without using `apply`. ### Response: def get_edited_color_scheme(self): """ Get the values of the last edited color scheme ...
def _set_params(self, v, load=False): """ Setter method for params, mapped from YANG variable /overlay_gateway/site/bfd/params (container) If this variable is read-only (config: false) in the source YANG file, then _set_params is considered as a private method. Backends looking to populate this vari...
Setter method for params, mapped from YANG variable /overlay_gateway/site/bfd/params (container) If this variable is read-only (config: false) in the source YANG file, then _set_params is considered as a private method. Backends looking to populate this variable should do so via calling thisObj._set_par...
Below is the the instruction that describes the task: ### Input: Setter method for params, mapped from YANG variable /overlay_gateway/site/bfd/params (container) If this variable is read-only (config: false) in the source YANG file, then _set_params is considered as a private method. Backends looking to...
def parsed(self): """Get the code object which represents the compiled Python file. This property is cached and only parses the content once. """ if not self._parsed: self._parsed = compile(self.content, self.path, 'exec') return self._parsed
Get the code object which represents the compiled Python file. This property is cached and only parses the content once.
Below is the the instruction that describes the task: ### Input: Get the code object which represents the compiled Python file. This property is cached and only parses the content once. ### Response: def parsed(self): """Get the code object which represents the compiled Python file. This ...
def recommendations(self, **kwargs): """ Get a list of recommended movies for a movie. Args: language: (optional) ISO 639-1 code. page: (optional) Minimum value of 1. Expected value is an integer. Returns: A dict representation of the JSON returned ...
Get a list of recommended movies for a movie. Args: language: (optional) ISO 639-1 code. page: (optional) Minimum value of 1. Expected value is an integer. Returns: A dict representation of the JSON returned from the API.
Below is the the instruction that describes the task: ### Input: Get a list of recommended movies for a movie. Args: language: (optional) ISO 639-1 code. page: (optional) Minimum value of 1. Expected value is an integer. Returns: A dict representation of the JS...
def _patch_static_handler(handler): """Patch in support for static files serving if supported and enabled. """ if django.VERSION[:2] < (1, 3): return from django.contrib.staticfiles.handlers import StaticFilesHandler return StaticFilesHandler(handler)
Patch in support for static files serving if supported and enabled.
Below is the the instruction that describes the task: ### Input: Patch in support for static files serving if supported and enabled. ### Response: def _patch_static_handler(handler): """Patch in support for static files serving if supported and enabled. """ if django.VERSION[:2] < (1, 3): retu...
def get_instance_by_bin_uuid(model, bin_uuid): """Get an instance by binary uuid. :param model: a string, model name in rio.models. :param bin_uuid: a 16-bytes binary string. :return: None or a SQLAlchemy instance. """ try: model = get_model(model) except ImportError: return...
Get an instance by binary uuid. :param model: a string, model name in rio.models. :param bin_uuid: a 16-bytes binary string. :return: None or a SQLAlchemy instance.
Below is the the instruction that describes the task: ### Input: Get an instance by binary uuid. :param model: a string, model name in rio.models. :param bin_uuid: a 16-bytes binary string. :return: None or a SQLAlchemy instance. ### Response: def get_instance_by_bin_uuid(model, bin_uuid): """Get ...
def getInferenceTypeFromLabel(cls, label): """ Extracts the PredictionKind (temporal vs. nontemporal) from the given metric label. :param label: (string) for a metric spec generated by :meth:`getMetricLabel` :returns: (:class:`~nupic.frameworks.opf.opf_utils.InferenceType`) """ ...
Extracts the PredictionKind (temporal vs. nontemporal) from the given metric label. :param label: (string) for a metric spec generated by :meth:`getMetricLabel` :returns: (:class:`~nupic.frameworks.opf.opf_utils.InferenceType`)
Below is the the instruction that describes the task: ### Input: Extracts the PredictionKind (temporal vs. nontemporal) from the given metric label. :param label: (string) for a metric spec generated by :meth:`getMetricLabel` :returns: (:class:`~nupic.frameworks.opf.opf_utils.InferenceType...
def unsubscribe(self, code_list, subtype_list): """ 取消订阅 :param code_list: 取消订阅的股票代码列表 :param subtype_list: 取消订阅的类型,参见SubType :return: (ret, err_message) ret == RET_OK err_message为None ret != RET_OK err_message为错误描述字符串 """ ret, m...
取消订阅 :param code_list: 取消订阅的股票代码列表 :param subtype_list: 取消订阅的类型,参见SubType :return: (ret, err_message) ret == RET_OK err_message为None ret != RET_OK err_message为错误描述字符串
Below is the the instruction that describes the task: ### Input: 取消订阅 :param code_list: 取消订阅的股票代码列表 :param subtype_list: 取消订阅的类型,参见SubType :return: (ret, err_message) ret == RET_OK err_message为None ret != RET_OK err_message为错误描述字符串 ### Response: def unsubsc...
def from_pyfile(self, filename: str) -> None: """Load values from a Python file.""" globals_ = {} # type: Dict[str, Any] locals_ = {} # type: Dict[str, Any] with open(filename, "rb") as f: exec(compile(f.read(), filename, 'exec'), globals_, locals_) for key, value ...
Load values from a Python file.
Below is the the instruction that describes the task: ### Input: Load values from a Python file. ### Response: def from_pyfile(self, filename: str) -> None: """Load values from a Python file.""" globals_ = {} # type: Dict[str, Any] locals_ = {} # type: Dict[str, Any] with open(fil...
def create_host_template(resource_root, name, cluster_name): """ Create a host template. @param resource_root: The root Resource object. @param name: Host template name @param cluster_name: Cluster name @return: An ApiHostTemplate object for the created host template. @since: API v3 """ apitemplate = ...
Create a host template. @param resource_root: The root Resource object. @param name: Host template name @param cluster_name: Cluster name @return: An ApiHostTemplate object for the created host template. @since: API v3
Below is the the instruction that describes the task: ### Input: Create a host template. @param resource_root: The root Resource object. @param name: Host template name @param cluster_name: Cluster name @return: An ApiHostTemplate object for the created host template. @since: API v3 ### Response: def cre...
def launch_minecraft(port, installdir="MalmoPlatform", replaceable=False): """Launch Minecraft listening for malmoenv connections. Args: port: the TCP port to listen on. installdir: the install dir name. Defaults to MalmoPlatform. Must be same as given (or defaulted) in download call if...
Launch Minecraft listening for malmoenv connections. Args: port: the TCP port to listen on. installdir: the install dir name. Defaults to MalmoPlatform. Must be same as given (or defaulted) in download call if used. replaceable: whether or not to automatically restart Minecraft (def...
Below is the the instruction that describes the task: ### Input: Launch Minecraft listening for malmoenv connections. Args: port: the TCP port to listen on. installdir: the install dir name. Defaults to MalmoPlatform. Must be same as given (or defaulted) in download call if used. ...
def colRowIsOnSciencePixelList(self, col, row, padding=DEFAULT_PADDING): """similar to colRowIsOnSciencePixelList() but takes lists as input""" out = np.ones(len(col), dtype=bool) col_arr = np.array(col) row_arr = np.array(row) mask = np.bitwise_or(col_arr < 12. - padding, col_ar...
similar to colRowIsOnSciencePixelList() but takes lists as input
Below is the the instruction that describes the task: ### Input: similar to colRowIsOnSciencePixelList() but takes lists as input ### Response: def colRowIsOnSciencePixelList(self, col, row, padding=DEFAULT_PADDING): """similar to colRowIsOnSciencePixelList() but takes lists as input""" out = np.on...
def stop_watching(self): """Stop watching for files. Stop the observer started by watch function and finish thread life. """ self._watch = False if self._observer: self._logger.info('Stopping watcher') self._observer.stop() self._logg...
Stop watching for files. Stop the observer started by watch function and finish thread life.
Below is the the instruction that describes the task: ### Input: Stop watching for files. Stop the observer started by watch function and finish thread life. ### Response: def stop_watching(self): """Stop watching for files. Stop the observer started by watch function and finish ...
def _write_max_norm(self, norms:[])->None: "Writes the maximum norm of the gradients to Tensorboard." max_norm = max(norms) self._add_gradient_scalar('max_norm', scalar_value=max_norm)
Writes the maximum norm of the gradients to Tensorboard.
Below is the the instruction that describes the task: ### Input: Writes the maximum norm of the gradients to Tensorboard. ### Response: def _write_max_norm(self, norms:[])->None: "Writes the maximum norm of the gradients to Tensorboard." max_norm = max(norms) self._add_gradient_scalar('max_...
def framesFromTransTmpl(transaction: 'TransTmpl', wordWidth: int, maxFrameLen: Union[int, float]=inf, maxPaddingWords: Union[int, float]=inf, trimPaddingWordsOnStart: bool=False, t...
Convert transaction template into FrameTmpls :param transaction: transaction template used which are FrameTmpls created from :param wordWidth: width of data signal in target interface where frames will be used :param maxFrameLen: maximum length of frame in bits, ...
Below is the the instruction that describes the task: ### Input: Convert transaction template into FrameTmpls :param transaction: transaction template used which are FrameTmpls created from :param wordWidth: width of data signal in target interface where frames will be used ...
def process_notice(self, notice): """ This method is called on notices that need processing. Here, we call ``on_object`` and ``on_account`` slots. """ id = notice["id"] _a, _b, _ = id.split(".") if id in self.subscription_objects: self.on_object(notice) ...
This method is called on notices that need processing. Here, we call ``on_object`` and ``on_account`` slots.
Below is the the instruction that describes the task: ### Input: This method is called on notices that need processing. Here, we call ``on_object`` and ``on_account`` slots. ### Response: def process_notice(self, notice): """ This method is called on notices that need processing. Here, ...
def shot_remove_asset(self, *args, **kwargs): """Remove the, in the asset table view selected, asset. :returns: None :rtype: None :raises: None """ if not self.cur_shot: return i = self.shot_asset_treev.currentIndex() item = i.internalPointer(...
Remove the, in the asset table view selected, asset. :returns: None :rtype: None :raises: None
Below is the the instruction that describes the task: ### Input: Remove the, in the asset table view selected, asset. :returns: None :rtype: None :raises: None ### Response: def shot_remove_asset(self, *args, **kwargs): """Remove the, in the asset table view selected, asset. ...
def match_stops_to_nodes(gtfs, walk_network): """ Parameters ---------- gtfs : a GTFS object walk_network : networkx.Graph Returns ------- stop_I_to_node: dict maps stop_I to closest walk_network node stop_I_to_dist: dict maps stop_I to the distance to the closest wa...
Parameters ---------- gtfs : a GTFS object walk_network : networkx.Graph Returns ------- stop_I_to_node: dict maps stop_I to closest walk_network node stop_I_to_dist: dict maps stop_I to the distance to the closest walk_network node
Below is the the instruction that describes the task: ### Input: Parameters ---------- gtfs : a GTFS object walk_network : networkx.Graph Returns ------- stop_I_to_node: dict maps stop_I to closest walk_network node stop_I_to_dist: dict maps stop_I to the distance to the...
def transfer(self, payment_id, data={}, **kwargs): """" Create Transfer for given Payment Id Args: payment_id : Id for which payment object has to be transfered Returns: Payment dict after getting transfered """ url = "{}/{}/transfers".format(sel...
Create Transfer for given Payment Id Args: payment_id : Id for which payment object has to be transfered Returns: Payment dict after getting transfered
Below is the the instruction that describes the task: ### Input: Create Transfer for given Payment Id Args: payment_id : Id for which payment object has to be transfered Returns: Payment dict after getting transfered ### Response: def transfer(self, payment_id, data={}, **...
def init(redis_address=None, num_cpus=None, num_gpus=None, resources=None, object_store_memory=None, redis_max_memory=None, log_to_driver=True, node_ip_address=None, object_id_seed=None, local_mode=False, redirect_worker_output=No...
Connect to an existing Ray cluster or start one and connect to it. This method handles two cases. Either a Ray cluster already exists and we just attach this driver to it, or we start all of the processes associated with a Ray cluster and attach to the newly started cluster. To start Ray and all of th...
Below is the the instruction that describes the task: ### Input: Connect to an existing Ray cluster or start one and connect to it. This method handles two cases. Either a Ray cluster already exists and we just attach this driver to it, or we start all of the processes associated with a Ray cluster and...
def get(self, sid): """ Constructs a CredentialListMappingContext :param sid: A string that identifies the resource to fetch :returns: twilio.rest.api.v2010.account.sip.domain.credential_list_mapping.CredentialListMappingContext :rtype: twilio.rest.api.v2010.account.sip.domain....
Constructs a CredentialListMappingContext :param sid: A string that identifies the resource to fetch :returns: twilio.rest.api.v2010.account.sip.domain.credential_list_mapping.CredentialListMappingContext :rtype: twilio.rest.api.v2010.account.sip.domain.credential_list_mapping.CredentialListMa...
Below is the the instruction that describes the task: ### Input: Constructs a CredentialListMappingContext :param sid: A string that identifies the resource to fetch :returns: twilio.rest.api.v2010.account.sip.domain.credential_list_mapping.CredentialListMappingContext :rtype: twilio.rest....
def set_as_object(self, index = None, value= None): """ Sets a new value to array element specified by its index. When the index is not defined, it resets the entire array value. This method has double purpose because method overrides are not supported in JavaScript. :param inde...
Sets a new value to array element specified by its index. When the index is not defined, it resets the entire array value. This method has double purpose because method overrides are not supported in JavaScript. :param index: (optional) an index of the element to set :param value: a ne...
Below is the the instruction that describes the task: ### Input: Sets a new value to array element specified by its index. When the index is not defined, it resets the entire array value. This method has double purpose because method overrides are not supported in JavaScript. :param index: ...
def main(): """ NAME lsq_redo.py DESCRIPTION converts a tab delimited LSQ format to PmagPy redo file and edits the magic_measurements table to mark "bad" measurements. SYNTAX lsq_redo.py [-h] [command line options] OPTIONS -h: prints help message and quits ...
NAME lsq_redo.py DESCRIPTION converts a tab delimited LSQ format to PmagPy redo file and edits the magic_measurements table to mark "bad" measurements. SYNTAX lsq_redo.py [-h] [command line options] OPTIONS -h: prints help message and quits -f FILE: specify LSQ inp...
Below is the the instruction that describes the task: ### Input: NAME lsq_redo.py DESCRIPTION converts a tab delimited LSQ format to PmagPy redo file and edits the magic_measurements table to mark "bad" measurements. SYNTAX lsq_redo.py [-h] [command line options] OPTIONS ...
def enable_peer_bfd(self, **kwargs): """BFD enable for each specified peer. Args: rbridge_id (str): Rbridge to configure. (1, 225, etc) peer_ip (str): Peer IPv4 address for BFD setting. delete (bool): True if BFD configuration should be deleted. Defa...
BFD enable for each specified peer. Args: rbridge_id (str): Rbridge to configure. (1, 225, etc) peer_ip (str): Peer IPv4 address for BFD setting. delete (bool): True if BFD configuration should be deleted. Default value will be False if not specified. ...
Below is the the instruction that describes the task: ### Input: BFD enable for each specified peer. Args: rbridge_id (str): Rbridge to configure. (1, 225, etc) peer_ip (str): Peer IPv4 address for BFD setting. delete (bool): True if BFD configuration should be deleted....
def add(x, y, context=None): """ Return ``x`` + ``y``. """ return _apply_function_in_current_context( BigFloat, mpfr.mpfr_add, ( BigFloat._implicit_convert(x), BigFloat._implicit_convert(y), ), context, )
Return ``x`` + ``y``.
Below is the the instruction that describes the task: ### Input: Return ``x`` + ``y``. ### Response: def add(x, y, context=None): """ Return ``x`` + ``y``. """ return _apply_function_in_current_context( BigFloat, mpfr.mpfr_add, ( BigFloat._implicit_convert(x), ...
def main(*argv): """ main driver of program """ try: # Inputs # adminUsername = argv[0] adminPassword = argv[1] siteURL = argv[2] username = argv[3] subFolders = argv[4].lower() == "true" # Logic # sh = arcrest.AGOLTokenSecurity...
main driver of program
Below is the the instruction that describes the task: ### Input: main driver of program ### Response: def main(*argv): """ main driver of program """ try: # Inputs # adminUsername = argv[0] adminPassword = argv[1] siteURL = argv[2] username = argv[3] ...
def resolve_invite_link(link): """ Resolves the given invite link. Returns a tuple of ``(link creator user id, global chat id, random int)``. Note that for broadcast channels, the link creator user ID will be zero to protect their identity. Normal chats and megagroup channels will have such ID....
Resolves the given invite link. Returns a tuple of ``(link creator user id, global chat id, random int)``. Note that for broadcast channels, the link creator user ID will be zero to protect their identity. Normal chats and megagroup channels will have such ID. Note that the chat ID may not be accu...
Below is the the instruction that describes the task: ### Input: Resolves the given invite link. Returns a tuple of ``(link creator user id, global chat id, random int)``. Note that for broadcast channels, the link creator user ID will be zero to protect their identity. Normal chats and megagroup c...
def set_attribute(name, value): """ Decorator factory for setting attributes on a function. Doesn't change the behavior of the wrapped function. Examples -------- >>> @set_attribute('__name__', 'foo') ... def bar(): ... return 3 ... >>> bar() 3 >>> bar.__name__ ...
Decorator factory for setting attributes on a function. Doesn't change the behavior of the wrapped function. Examples -------- >>> @set_attribute('__name__', 'foo') ... def bar(): ... return 3 ... >>> bar() 3 >>> bar.__name__ 'foo'
Below is the the instruction that describes the task: ### Input: Decorator factory for setting attributes on a function. Doesn't change the behavior of the wrapped function. Examples -------- >>> @set_attribute('__name__', 'foo') ... def bar(): ... return 3 ... >>> bar() 3 ...
def load_from_stream(self, stream, container, **options): """ Load data from given stream 'stream'. :param stream: Stream provides configuration data :param container: callble to make a container object :param options: keyword options passed to '_load_from_stream_fn' :r...
Load data from given stream 'stream'. :param stream: Stream provides configuration data :param container: callble to make a container object :param options: keyword options passed to '_load_from_stream_fn' :return: container object holding the configuration data
Below is the the instruction that describes the task: ### Input: Load data from given stream 'stream'. :param stream: Stream provides configuration data :param container: callble to make a container object :param options: keyword options passed to '_load_from_stream_fn' :return: co...
def on_builder_inited(app): """ Hooks into Sphinx's ``builder-inited`` event. Builds out the ReST API source. """ config = app.builder.config target_directory = ( pathlib.Path(app.builder.env.srcdir) / config.uqbar_api_directory_name ) initial_source_paths: List[str] = [] ...
Hooks into Sphinx's ``builder-inited`` event. Builds out the ReST API source.
Below is the the instruction that describes the task: ### Input: Hooks into Sphinx's ``builder-inited`` event. Builds out the ReST API source. ### Response: def on_builder_inited(app): """ Hooks into Sphinx's ``builder-inited`` event. Builds out the ReST API source. """ config = app.build...
def with_metaclass(meta, *bases): """A Python 2/3 compatible way of declaring a metaclass. Taken from `Jinja 2 <https://github.com/mitsuhiko/jinja2/blob/master/jinja2 /_compat.py>`_ via `python-future <http://python-future.org>`_. License: BSD. Use it like this:: class MyClass(with_metacla...
A Python 2/3 compatible way of declaring a metaclass. Taken from `Jinja 2 <https://github.com/mitsuhiko/jinja2/blob/master/jinja2 /_compat.py>`_ via `python-future <http://python-future.org>`_. License: BSD. Use it like this:: class MyClass(with_metaclass(MyMetaClass, BaseClass)): ...
Below is the the instruction that describes the task: ### Input: A Python 2/3 compatible way of declaring a metaclass. Taken from `Jinja 2 <https://github.com/mitsuhiko/jinja2/blob/master/jinja2 /_compat.py>`_ via `python-future <http://python-future.org>`_. License: BSD. Use it like this:: ...
def get_int_noerr(self, arg): """Eval arg and it is an integer return the value. Otherwise return None""" if self.curframe: g = self.curframe.f_globals l = self.curframe.f_locals else: g = globals() l = locals() pass try...
Eval arg and it is an integer return the value. Otherwise return None
Below is the the instruction that describes the task: ### Input: Eval arg and it is an integer return the value. Otherwise return None ### Response: def get_int_noerr(self, arg): """Eval arg and it is an integer return the value. Otherwise return None""" if self.curframe: ...
def _flatten_subclass_tree(cls): """Return the set of all child classes of `cls`. Parameters ---------- cls : Type Returns ------- frozenset[Type] """ subclasses = frozenset(cls.__subclasses__()) children = frozenset(toolz.concat(map(_flatten_subclass_tree, subclasses))) re...
Return the set of all child classes of `cls`. Parameters ---------- cls : Type Returns ------- frozenset[Type]
Below is the the instruction that describes the task: ### Input: Return the set of all child classes of `cls`. Parameters ---------- cls : Type Returns ------- frozenset[Type] ### Response: def _flatten_subclass_tree(cls): """Return the set of all child classes of `cls`. Paramete...
def _uniq(self): """ Get list of unique detections. Works in place. .. rubric:: Example >>> family = Family( ... template=Template(name='a'), detections=[ ... Detection(template_name='a', detect_time=UTCDateTime(0), ... no_chans=8, ...
Get list of unique detections. Works in place. .. rubric:: Example >>> family = Family( ... template=Template(name='a'), detections=[ ... Detection(template_name='a', detect_time=UTCDateTime(0), ... no_chans=8, detect_val=4.2, threshold=1.2, ...
Below is the the instruction that describes the task: ### Input: Get list of unique detections. Works in place. .. rubric:: Example >>> family = Family( ... template=Template(name='a'), detections=[ ... Detection(template_name='a', detect_time=UTCDateTime(0), ...
def end_block(self, request_end_block): """Calculate block hash using transaction ids and previous block hash to be stored in the next block. Args: height (int): new height of the chain. """ self.abort_if_abci_chain_is_not_synced() chain_shift = 0 if self.c...
Calculate block hash using transaction ids and previous block hash to be stored in the next block. Args: height (int): new height of the chain.
Below is the the instruction that describes the task: ### Input: Calculate block hash using transaction ids and previous block hash to be stored in the next block. Args: height (int): new height of the chain. ### Response: def end_block(self, request_end_block): """Calculate bl...
def fromkeys(cls, iterable, value=None): '''OD.fromkeys(S[, v]) -> New ordered dictionary with keys from S. If not specified, the value defaults to None. ''' self = cls() for key in iterable: self[key] = value return self
OD.fromkeys(S[, v]) -> New ordered dictionary with keys from S. If not specified, the value defaults to None.
Below is the the instruction that describes the task: ### Input: OD.fromkeys(S[, v]) -> New ordered dictionary with keys from S. If not specified, the value defaults to None. ### Response: def fromkeys(cls, iterable, value=None): '''OD.fromkeys(S[, v]) -> New ordered dictionary with keys from S. ...
def batch_update(self, pk=None, **kwargs): """Update all related inventory sources of the given inventory. Note global option --format is not available here, as the output would always be JSON-formatted. =====API DOCS===== Update all related inventory sources of the given inventory. ...
Update all related inventory sources of the given inventory. Note global option --format is not available here, as the output would always be JSON-formatted. =====API DOCS===== Update all related inventory sources of the given inventory. :param pk: Primary key of the given inventory. ...
Below is the the instruction that describes the task: ### Input: Update all related inventory sources of the given inventory. Note global option --format is not available here, as the output would always be JSON-formatted. =====API DOCS===== Update all related inventory sources of the give...
def force_clear_lock(self): '''Kick out whoever currently owns the namespace global lock. This is intended as purely a last-resort tool. If another process has managed to get the global lock for a very long time, or if it requested the lock with a long expiration and then crash...
Kick out whoever currently owns the namespace global lock. This is intended as purely a last-resort tool. If another process has managed to get the global lock for a very long time, or if it requested the lock with a long expiration and then crashed, this can make the system functional...
Below is the the instruction that describes the task: ### Input: Kick out whoever currently owns the namespace global lock. This is intended as purely a last-resort tool. If another process has managed to get the global lock for a very long time, or if it requested the lock with a long exp...
def untranscribed_batch_gen(self): """ A batch generator for all the untranscribed data. """ feat_fns = self.corpus.get_untranscribed_fns() fn_batches = self.make_batches(feat_fns) for fn_batch in fn_batches: batch_inputs, batch_inputs_lens = utils.load_batch_x(fn_batch, ...
A batch generator for all the untranscribed data.
Below is the the instruction that describes the task: ### Input: A batch generator for all the untranscribed data. ### Response: def untranscribed_batch_gen(self): """ A batch generator for all the untranscribed data. """ feat_fns = self.corpus.get_untranscribed_fns() fn_batches = self.mak...
def create_hooks(config: dict, model: AbstractModel, dataset: AbstractDataset, output_dir: str) -> Iterable[AbstractHook]: """ Create hooks specified in ``config['hooks']`` list. Hook config entries may be one of the following types: .. code-block:: yaml :caption: A hook with ...
Create hooks specified in ``config['hooks']`` list. Hook config entries may be one of the following types: .. code-block:: yaml :caption: A hook with default args specified only by its name as a string; e.g. hooks: - LogVariables - cxflow_tensorflow.WriteTensorBoard ....
Below is the the instruction that describes the task: ### Input: Create hooks specified in ``config['hooks']`` list. Hook config entries may be one of the following types: .. code-block:: yaml :caption: A hook with default args specified only by its name as a string; e.g. hooks: ...
def build_client_schema( introspection: Dict, assume_valid: bool = False ) -> GraphQLSchema: """Build a GraphQLSchema for use by client tools. Given the result of a client running the introspection query, creates and returns a GraphQLSchema instance which can be then used with all GraphQL-core-next too...
Build a GraphQLSchema for use by client tools. Given the result of a client running the introspection query, creates and returns a GraphQLSchema instance which can be then used with all GraphQL-core-next tools, but cannot be used to execute a query, as introspection does not represent the "resolver", "...
Below is the the instruction that describes the task: ### Input: Build a GraphQLSchema for use by client tools. Given the result of a client running the introspection query, creates and returns a GraphQLSchema instance which can be then used with all GraphQL-core-next tools, but cannot be used to execu...
def get_container_service(access_token, subscription_id, resource_group, service_name): '''Get details about an Azure Container Server Args: access_token (str): A valid Azure authentication token. subscription_id (str): Azure subscription id. resource_group (str): Azure resource group n...
Get details about an Azure Container Server Args: access_token (str): A valid Azure authentication token. subscription_id (str): Azure subscription id. resource_group (str): Azure resource group name. service_name (str): Name of container service. Returns: HTTP response...
Below is the the instruction that describes the task: ### Input: Get details about an Azure Container Server Args: access_token (str): A valid Azure authentication token. subscription_id (str): Azure subscription id. resource_group (str): Azure resource group name. service_name ...
def buffer_typechecks(self, call_id, payload): """Adds typecheck events to the buffer""" if self.currently_buffering_typechecks: for note in payload['notes']: self.buffered_notes.append(note)
Adds typecheck events to the buffer
Below is the the instruction that describes the task: ### Input: Adds typecheck events to the buffer ### Response: def buffer_typechecks(self, call_id, payload): """Adds typecheck events to the buffer""" if self.currently_buffering_typechecks: for note in payload['notes']: ...
def pos_to_linecol(text, pos): """Return a tuple of line and column for offset pos in text. Lines are one-based, columns zero-based. This is how Jedi wants it. Don't ask me why. """ line_start = text.rfind("\n", 0, pos) + 1 line = text.count("\n", 0, line_start) + 1 col = pos - line_start...
Return a tuple of line and column for offset pos in text. Lines are one-based, columns zero-based. This is how Jedi wants it. Don't ask me why.
Below is the the instruction that describes the task: ### Input: Return a tuple of line and column for offset pos in text. Lines are one-based, columns zero-based. This is how Jedi wants it. Don't ask me why. ### Response: def pos_to_linecol(text, pos): """Return a tuple of line and column for offset...
def get_default_configs(self): """ returns default configs list, from /etc, home dir and package_data""" # initialize basic defaults configs = [resource_filename(__name__, 'config/00-base.ini')] try: conf_files = sorted(os.listdir(self.baseconfigs_location)) for f...
returns default configs list, from /etc, home dir and package_data
Below is the the instruction that describes the task: ### Input: returns default configs list, from /etc, home dir and package_data ### Response: def get_default_configs(self): """ returns default configs list, from /etc, home dir and package_data""" # initialize basic defaults configs = [r...
def on_remove_vrf_conf(self, evt): """Removes VRF table associated with given `vrf_conf`. Cleans up other links to this table as well. """ vrf_conf = evt.value # Detach VrfConf change listener. vrf_conf.remove_listener(VrfConf.VRF_CHG_EVT, self.on_chg_vrf_conf) ...
Removes VRF table associated with given `vrf_conf`. Cleans up other links to this table as well.
Below is the the instruction that describes the task: ### Input: Removes VRF table associated with given `vrf_conf`. Cleans up other links to this table as well. ### Response: def on_remove_vrf_conf(self, evt): """Removes VRF table associated with given `vrf_conf`. Cleans up other links t...
def add_samples(self, samples, reverse=False): """ Concatenate the given new samples to the current audio data. This function initializes the memory if no audio data is present already. If ``reverse`` is ``True``, the new samples will be reversed and then concatenated. ...
Concatenate the given new samples to the current audio data. This function initializes the memory if no audio data is present already. If ``reverse`` is ``True``, the new samples will be reversed and then concatenated. :param samples: the new samples to be concatenated ...
Below is the the instruction that describes the task: ### Input: Concatenate the given new samples to the current audio data. This function initializes the memory if no audio data is present already. If ``reverse`` is ``True``, the new samples will be reversed and then concatenated...
def _prune_edges(G, X, traj_lengths, pruning_thresh=0.1, verbose=False): '''Prune edges in graph G via cosine distance with trajectory edges.''' W = G.matrix('dense', copy=True) degree = G.degree(kind='out', weighted=False) i = 0 num_bad = 0 for n in traj_lengths: s, t = np.nonzero(W[i:i+n-1]) graph...
Prune edges in graph G via cosine distance with trajectory edges.
Below is the the instruction that describes the task: ### Input: Prune edges in graph G via cosine distance with trajectory edges. ### Response: def _prune_edges(G, X, traj_lengths, pruning_thresh=0.1, verbose=False): '''Prune edges in graph G via cosine distance with trajectory edges.''' W = G.matrix('dense',...
def clean_text(self, name, **kwargs): """Basic clean-up.""" name = strip_quotes(name) name = collapse_spaces(name) return name
Basic clean-up.
Below is the the instruction that describes the task: ### Input: Basic clean-up. ### Response: def clean_text(self, name, **kwargs): """Basic clean-up.""" name = strip_quotes(name) name = collapse_spaces(name) return name
def get_sub_node(dsp, path, node_attr='auto', solution=NONE, _level=0, _dsp_name=NONE): """ Returns a sub node of a dispatcher. :param dsp: A dispatcher object or a sub dispatch function. :type dsp: schedula.Dispatcher | SubDispatch :param path: A sequence of node...
Returns a sub node of a dispatcher. :param dsp: A dispatcher object or a sub dispatch function. :type dsp: schedula.Dispatcher | SubDispatch :param path: A sequence of node ids or a single node id. Each id identifies a sub-level node. :type path: tuple, str :param node_at...
Below is the the instruction that describes the task: ### Input: Returns a sub node of a dispatcher. :param dsp: A dispatcher object or a sub dispatch function. :type dsp: schedula.Dispatcher | SubDispatch :param path: A sequence of node ids or a single node id. Each id identifies a ...
def gbayes(x0, g_est, sigma): """ Estimate Bayes posterior with Gaussian noise [Efron2014]_. Parameters ---------- x0: ndarray an observation g_est: float a prior density, as returned by gfit sigma: int noise estimate Returns ------- An array of the post...
Estimate Bayes posterior with Gaussian noise [Efron2014]_. Parameters ---------- x0: ndarray an observation g_est: float a prior density, as returned by gfit sigma: int noise estimate Returns ------- An array of the posterior estimate E[mu | x0]
Below is the the instruction that describes the task: ### Input: Estimate Bayes posterior with Gaussian noise [Efron2014]_. Parameters ---------- x0: ndarray an observation g_est: float a prior density, as returned by gfit sigma: int noise estimate Returns -----...
def params_size(num_components, event_shape=(), name=None): """The number of `params` needed to create a single distribution.""" return MixtureSameFamily.params_size( num_components, IndependentLogistic.params_size(event_shape, name=name), name=name)
The number of `params` needed to create a single distribution.
Below is the the instruction that describes the task: ### Input: The number of `params` needed to create a single distribution. ### Response: def params_size(num_components, event_shape=(), name=None): """The number of `params` needed to create a single distribution.""" return MixtureSameFamily.params_size...
def parse(self, data): # type: (bytes) -> None ''' Parse the passed in data into a UDF Implementation Use Volume Descriptor Implementation Use field. Parameters: data - The data to parse. Returns: Nothing. ''' if self._initialized: ...
Parse the passed in data into a UDF Implementation Use Volume Descriptor Implementation Use field. Parameters: data - The data to parse. Returns: Nothing.
Below is the the instruction that describes the task: ### Input: Parse the passed in data into a UDF Implementation Use Volume Descriptor Implementation Use field. Parameters: data - The data to parse. Returns: Nothing. ### Response: def parse(self, data): # type:...
def extract_value(mapping, bind, data): """ Given a mapping and JSON schema spec, extract a value from ``data`` and apply certain transformations to normalize the value. """ columns = mapping.get('columns', [mapping.get('column')]) values = [data.get(c) for c in columns] for transform in mapping.ge...
Given a mapping and JSON schema spec, extract a value from ``data`` and apply certain transformations to normalize the value.
Below is the the instruction that describes the task: ### Input: Given a mapping and JSON schema spec, extract a value from ``data`` and apply certain transformations to normalize the value. ### Response: def extract_value(mapping, bind, data): """ Given a mapping and JSON schema spec, extract a value from...
def set_bool(_bytearray, byte_index, bool_index, value): """ Set boolean value on location in bytearray """ assert value in [0, 1, True, False] current_value = get_bool(_bytearray, byte_index, bool_index) index_value = 1 << bool_index # check if bool already has correct value if current...
Set boolean value on location in bytearray
Below is the the instruction that describes the task: ### Input: Set boolean value on location in bytearray ### Response: def set_bool(_bytearray, byte_index, bool_index, value): """ Set boolean value on location in bytearray """ assert value in [0, 1, True, False] current_value = get_bool(_byt...
def __valid_url(cls, url): """Expects input to already be a valid string""" bits = urlparse(url) return ((bits.scheme == "http" or bits.scheme == "https") and _PATTERN_URL_PART.match(bits.netloc) and _PATTERN_URL_PART.match(bits.path))
Expects input to already be a valid string
Below is the the instruction that describes the task: ### Input: Expects input to already be a valid string ### Response: def __valid_url(cls, url): """Expects input to already be a valid string""" bits = urlparse(url) return ((bits.scheme == "http" or bits.scheme == "https") and ...
def QA_util_date_gap(date, gap, methods): ''' :param date: 字符串起始日 类型 str eg: 2018-11-11 :param gap: 整数 间隔多数个交易日 :param methods: gt大于 ,gte 大于等于, 小于lt ,小于等于lte , 等于=== :return: 字符串 eg:2000-01-01 ''' try: if methods in ['>', 'gt']: return trade_date_sse[trade_date_sse.index...
:param date: 字符串起始日 类型 str eg: 2018-11-11 :param gap: 整数 间隔多数个交易日 :param methods: gt大于 ,gte 大于等于, 小于lt ,小于等于lte , 等于=== :return: 字符串 eg:2000-01-01
Below is the the instruction that describes the task: ### Input: :param date: 字符串起始日 类型 str eg: 2018-11-11 :param gap: 整数 间隔多数个交易日 :param methods: gt大于 ,gte 大于等于, 小于lt ,小于等于lte , 等于=== :return: 字符串 eg:2000-01-01 ### Response: def QA_util_date_gap(date, gap, methods): ''' :param date: 字符串起始日 类型...
def command_info(self, command, *commands): """Get array of specific Redis command details.""" return self.execute(b'COMMAND', b'INFO', command, *commands, encoding='utf-8')
Get array of specific Redis command details.
Below is the the instruction that describes the task: ### Input: Get array of specific Redis command details. ### Response: def command_info(self, command, *commands): """Get array of specific Redis command details.""" return self.execute(b'COMMAND', b'INFO', command, *commands, ...
def tabModificationStateChanged(self, tab): ''' Perform all UI state changes that need to be done when the modification state of the current tab has changed. ''' if tab == self.currentTab: changed = tab.editBox.document().isModified() if self.autoSaveActive(tab): changed = False self.actionSave.s...
Perform all UI state changes that need to be done when the modification state of the current tab has changed.
Below is the the instruction that describes the task: ### Input: Perform all UI state changes that need to be done when the modification state of the current tab has changed. ### Response: def tabModificationStateChanged(self, tab): ''' Perform all UI state changes that need to be done when the modificatio...
def get_arp_table(self): """ Get arp table information. Return a list of dictionaries having the following set of keys: * interface (string) * mac (string) * ip (string) * age (float) For example:: [ { ...
Get arp table information. Return a list of dictionaries having the following set of keys: * interface (string) * mac (string) * ip (string) * age (float) For example:: [ { 'interface' : 'MgmtEth0/RSP0/CPU0...
Below is the the instruction that describes the task: ### Input: Get arp table information. Return a list of dictionaries having the following set of keys: * interface (string) * mac (string) * ip (string) * age (float) For example:: [ ...
def kappa_se_calc(PA, PE, POP): """ Calculate kappa standard error. :param PA: observed agreement among raters (overall accuracy) :type PA : float :param PE: hypothetical probability of chance agreement (random accuracy) :type PE : float :param POP: population :type POP:int :return...
Calculate kappa standard error. :param PA: observed agreement among raters (overall accuracy) :type PA : float :param PE: hypothetical probability of chance agreement (random accuracy) :type PE : float :param POP: population :type POP:int :return: kappa standard error as float
Below is the the instruction that describes the task: ### Input: Calculate kappa standard error. :param PA: observed agreement among raters (overall accuracy) :type PA : float :param PE: hypothetical probability of chance agreement (random accuracy) :type PE : float :param POP: population ...
def set_value(self, value: ScalarType) -> None: """Sets the value of the node to a scalar value. After this, is_scalar(type(value)) will return true. Args: value: The value to set this node to, a str, int, float, \ bool, or None. """ if isinstanc...
Sets the value of the node to a scalar value. After this, is_scalar(type(value)) will return true. Args: value: The value to set this node to, a str, int, float, \ bool, or None.
Below is the the instruction that describes the task: ### Input: Sets the value of the node to a scalar value. After this, is_scalar(type(value)) will return true. Args: value: The value to set this node to, a str, int, float, \ bool, or None. ### Response: def set...
def translate(self, package, into=None): """From a binary package, translate to a local binary distribution.""" if not package.local: raise ValueError('BinaryTranslator cannot translate remote packages.') if not isinstance(package, self._package_type): return None if not package.compatible(s...
From a binary package, translate to a local binary distribution.
Below is the the instruction that describes the task: ### Input: From a binary package, translate to a local binary distribution. ### Response: def translate(self, package, into=None): """From a binary package, translate to a local binary distribution.""" if not package.local: raise ValueError('Binar...
def serialize_me(self, account_id, region, next_token=None): """Dumps the proper JSON for the schema. :param account_id: :param region: :param next_token: :return: """ payload = { 'account_id': account_id, 'region': region } ...
Dumps the proper JSON for the schema. :param account_id: :param region: :param next_token: :return:
Below is the the instruction that describes the task: ### Input: Dumps the proper JSON for the schema. :param account_id: :param region: :param next_token: :return: ### Response: def serialize_me(self, account_id, region, next_token=None): """Dumps the proper JSON for the s...
def delete(self): """Returns a response after attempting to delete the list. """ if not self.email_enabled: raise EmailNotEnabledError("See settings.EMAIL_ENABLED") return requests.delete( f"{self.api_url}/{self.address}", auth=("api", self.api_key) )
Returns a response after attempting to delete the list.
Below is the the instruction that describes the task: ### Input: Returns a response after attempting to delete the list. ### Response: def delete(self): """Returns a response after attempting to delete the list. """ if not self.email_enabled: raise EmailNotEnabledError("See sett...
def find_by_typename(self, typename): """ List of all objects whose type has the given name. """ return self.find_by(lambda obj: type(obj).__name__ == typename)
List of all objects whose type has the given name.
Below is the the instruction that describes the task: ### Input: List of all objects whose type has the given name. ### Response: def find_by_typename(self, typename): """ List of all objects whose type has the given name. """ return self.find_by(lambda obj: type(obj).__name__ == ty...
def search_and_extract_nucleotides_matching_nucleotide_database(self, unpack, euk_check, search_method, ...
As per nt_db_search() except slightly lower level. Search an input read set (unpack) and then extract the sequences that hit. Parameters ---------- hmmsearch_output_table: str path to hmmsearch output table hit_reads_fasta: str path to hit nucleotide sequ...
Below is the the instruction that describes the task: ### Input: As per nt_db_search() except slightly lower level. Search an input read set (unpack) and then extract the sequences that hit. Parameters ---------- hmmsearch_output_table: str path to hmmsearch output table...
def _add_hypotheses_assuming_new_stroke(self, new_stroke, stroke_nr, new_beam): """ Get new guesses by assuming new_stroke is a new symbol. Parameters ----...
Get new guesses by assuming new_stroke is a new symbol. Parameters ---------- new_stroke : list of dicts A list of dicts [{'x': 12, 'y': 34, 'time': 56}, ...] which represent a point. stroke_nr : int Number of the stroke for segmentation new_b...
Below is the the instruction that describes the task: ### Input: Get new guesses by assuming new_stroke is a new symbol. Parameters ---------- new_stroke : list of dicts A list of dicts [{'x': 12, 'y': 34, 'time': 56}, ...] which represent a point. stroke_nr ...
def getICMPrimitives(uuid: str): """ returns all ICM primitives (TODO - needs filter support)""" primitives = [ p.deserialize() for p in CausalPrimitive.query.filter_by(model_id=uuid).all() ] for p in primitives: del p["model_id"] return jsonify(primitives)
returns all ICM primitives (TODO - needs filter support)
Below is the the instruction that describes the task: ### Input: returns all ICM primitives (TODO - needs filter support) ### Response: def getICMPrimitives(uuid: str): """ returns all ICM primitives (TODO - needs filter support)""" primitives = [ p.deserialize() for p in CausalPrimitive.qu...
def record_tx(self, origin, destination, amount, outcome, destination_id=None): """Records a transaction in the database. Args: origin (str): user_id of the sender destination (str): coin address or user_id of the recipient amount (str, Decimal, number): ...
Records a transaction in the database. Args: origin (str): user_id of the sender destination (str): coin address or user_id of the recipient amount (str, Decimal, number): amount to send outcome (str, bool): the transaction hash if this is a "sendfrom" ...
Below is the the instruction that describes the task: ### Input: Records a transaction in the database. Args: origin (str): user_id of the sender destination (str): coin address or user_id of the recipient amount (str, Decimal, number): amount to send outcome (str, b...
def updateidf(idf, dct): """update idf using dct""" for key in list(dct.keys()): if key.startswith('idf.'): idftag, objkey, objname, field = key2elements(key) if objname == '': try: idfobj = idf.idfobjects[objkey.upper()][0] exc...
update idf using dct
Below is the the instruction that describes the task: ### Input: update idf using dct ### Response: def updateidf(idf, dct): """update idf using dct""" for key in list(dct.keys()): if key.startswith('idf.'): idftag, objkey, objname, field = key2elements(key) if objname == ''...
def find_model_dat(): """ Find the file containing the definition of all the models in Xspec (model.dat) and return its path """ # model.dat is in $HEADAS/../spectral headas_env = os.environ.get("HEADAS") assert headas_env is not None, ("You need to setup the HEADAS variable before import...
Find the file containing the definition of all the models in Xspec (model.dat) and return its path
Below is the the instruction that describes the task: ### Input: Find the file containing the definition of all the models in Xspec (model.dat) and return its path ### Response: def find_model_dat(): """ Find the file containing the definition of all the models in Xspec (model.dat) and return its p...
def create(self, name, overwrite=True): """Creates an SQLite database file. Creates an SQLite database with the given name. The .box file extension is added automatically. Overwrites any existing database by default. """ self._name = na...
Creates an SQLite database file. Creates an SQLite database with the given name. The .box file extension is added automatically. Overwrites any existing database by default.
Below is the the instruction that describes the task: ### Input: Creates an SQLite database file. Creates an SQLite database with the given name. The .box file extension is added automatically. Overwrites any existing database by default. ### Response: def create(self, name, overwr...
def sample_greedy(self): """ Sample a point in the leaf with the max progress. """ if self.leafnode: return self.sample_bounds() else: lp = self.lower.max_leaf_progress gp = self.greater.max_leaf_progress maxp =...
Sample a point in the leaf with the max progress.
Below is the the instruction that describes the task: ### Input: Sample a point in the leaf with the max progress. ### Response: def sample_greedy(self): """ Sample a point in the leaf with the max progress. """ if self.leafnode: return self.sample_b...
def weighted_random(samples, chains): """Determine the sample values of chains by weighed random choice. Args: samples (array_like): Samples as a nS x nV array_like object where nS is the number of samples and nV is the number of variables. The values should all be 0/1 or -1/+1....
Determine the sample values of chains by weighed random choice. Args: samples (array_like): Samples as a nS x nV array_like object where nS is the number of samples and nV is the number of variables. The values should all be 0/1 or -1/+1. chains (list[array_like]): ...
Below is the the instruction that describes the task: ### Input: Determine the sample values of chains by weighed random choice. Args: samples (array_like): Samples as a nS x nV array_like object where nS is the number of samples and nV is the number of variables. The values sho...
def warp(source_file, destination_file, dst_crs=None, resolution=None, dimensions=None, src_bounds=None, dst_bounds=None, src_nodata=None, dst_nodata=None, target_aligned_pixels=False, check_invert_proj=True, creation_options=None, resampling=Resampling.cubic, **kwargs): """Warp a raster ...
Warp a raster dataset. Parameters ------------ source_file: str, file object or pathlib.Path object Source file. destination_file: str, file object or pathlib.Path object Destination file. dst_crs: rasterio.crs.CRS, optional Target coordinate reference system. resolution...
Below is the the instruction that describes the task: ### Input: Warp a raster dataset. Parameters ------------ source_file: str, file object or pathlib.Path object Source file. destination_file: str, file object or pathlib.Path object Destination file. dst_crs: rasterio.crs.CRS...
def get_object( self, object_t, object_id=None, relation=None, parent=None, **kwargs ): """ Actually query the Deezer API to retrieve the object :returns: json dictionary """ url = self.object_url(object_t, object_id, relation, **kwargs) response = self.sessi...
Actually query the Deezer API to retrieve the object :returns: json dictionary
Below is the the instruction that describes the task: ### Input: Actually query the Deezer API to retrieve the object :returns: json dictionary ### Response: def get_object( self, object_t, object_id=None, relation=None, parent=None, **kwargs ): """ Actually query the Deezer AP...
def _setup_console_logger(cls, session: AppSession, args, stderr): '''Set up the console logger. A handler and with a formatter is added to the root logger. ''' stream = new_encoded_stream(args, stderr) logger = logging.getLogger() session.console_log_handler = handler ...
Set up the console logger. A handler and with a formatter is added to the root logger.
Below is the the instruction that describes the task: ### Input: Set up the console logger. A handler and with a formatter is added to the root logger. ### Response: def _setup_console_logger(cls, session: AppSession, args, stderr): '''Set up the console logger. A handler and with a forma...
def split(self, cutting_points, shift_times=False, overlap=0.0): """ Split the label-list into x parts and return them as new label-lists. x is defined by the number of cutting-points(``x == len(cutting_points) + 1``) The result is a list of label-lists corresponding to each part. ...
Split the label-list into x parts and return them as new label-lists. x is defined by the number of cutting-points(``x == len(cutting_points) + 1``) The result is a list of label-lists corresponding to each part. Label-list 0 contains labels between ``0`` and ``cutting_points[0]``. Labe...
Below is the the instruction that describes the task: ### Input: Split the label-list into x parts and return them as new label-lists. x is defined by the number of cutting-points(``x == len(cutting_points) + 1``) The result is a list of label-lists corresponding to each part. Label-list 0 ...
def compile_insert(self, query, values): """ Compile insert statement into SQL :param query: A QueryBuilder instance :type query: QueryBuilder :param values: The insert values :type values: dict or list :return: The compiled insert :rtype: str "...
Compile insert statement into SQL :param query: A QueryBuilder instance :type query: QueryBuilder :param values: The insert values :type values: dict or list :return: The compiled insert :rtype: str
Below is the the instruction that describes the task: ### Input: Compile insert statement into SQL :param query: A QueryBuilder instance :type query: QueryBuilder :param values: The insert values :type values: dict or list :return: The compiled insert :rtype: str #...
def dbRestore(self, db_value, context=None): """ Converts a stored database value to Python. :param py_value: <variant> :param context: <orb.Context> :return: <variant> """ if db_value is not None: try: return rest.unjsonify(db_value)...
Converts a stored database value to Python. :param py_value: <variant> :param context: <orb.Context> :return: <variant>
Below is the the instruction that describes the task: ### Input: Converts a stored database value to Python. :param py_value: <variant> :param context: <orb.Context> :return: <variant> ### Response: def dbRestore(self, db_value, context=None): """ Converts a stored databas...