code
stringlengths
75
104k
docstring
stringlengths
1
46.9k
text
stringlengths
164
112k
def search( self, query, accept_language=None, pragma=None, user_agent=None, client_id=None, client_ip=None, location=None, answer_count=None, country_code=None, count=None, freshness=None, market="en-us", offset=None, promote=None, response_filter=None, safe_search=None, set_lang=None, text_decorations=Non...
The Web Search API lets you send a search query to Bing and get back search results that include links to webpages, images, and more. :param query: The user's search query term. The term may not be empty. The term may contain Bing Advanced Operators. For example, to limit results to a...
Below is the the instruction that describes the task: ### Input: The Web Search API lets you send a search query to Bing and get back search results that include links to webpages, images, and more. :param query: The user's search query term. The term may not be empty. The term may contain...
def _headers(self, name, is_file=False): """ Returns the header of the encoding of this parameter. Args: name (str): Field name Kwargs: is_file (bool): If true, this is a file field Returns: array. Headers """ ...
Returns the header of the encoding of this parameter. Args: name (str): Field name Kwargs: is_file (bool): If true, this is a file field Returns: array. Headers
Below is the the instruction that describes the task: ### Input: Returns the header of the encoding of this parameter. Args: name (str): Field name Kwargs: is_file (bool): If true, this is a file field Returns: array. Headers ###...
def select_by_atime(self, min_time=0, max_time=ts_2100, recursive=True): """ Select file path by access time. :param min_time: lower bound timestamp :param max_time: upper bound timestamp **中文文档** 选择所有 :attr:`pathlib_mate.pathlib2.Path.atime` 在一定范围内的文件。 """ ...
Select file path by access time. :param min_time: lower bound timestamp :param max_time: upper bound timestamp **中文文档** 选择所有 :attr:`pathlib_mate.pathlib2.Path.atime` 在一定范围内的文件。
Below is the the instruction that describes the task: ### Input: Select file path by access time. :param min_time: lower bound timestamp :param max_time: upper bound timestamp **中文文档** 选择所有 :attr:`pathlib_mate.pathlib2.Path.atime` 在一定范围内的文件。 ### Response: def select_by_atime(self...
def get_docker(interfaces=None, cidrs=None, with_container_id=False): ''' .. versionchanged:: 2017.7.8,2018.3.3 When :conf_minion:`docker.update_mine` is set to ``False`` for a given minion, no mine data will be populated for that minion, and thus none will be returned for it. .. ver...
.. versionchanged:: 2017.7.8,2018.3.3 When :conf_minion:`docker.update_mine` is set to ``False`` for a given minion, no mine data will be populated for that minion, and thus none will be returned for it. .. versionchanged:: 2019.2.0 :conf_minion:`docker.update_mine` now defaults to `...
Below is the the instruction that describes the task: ### Input: .. versionchanged:: 2017.7.8,2018.3.3 When :conf_minion:`docker.update_mine` is set to ``False`` for a given minion, no mine data will be populated for that minion, and thus none will be returned for it. .. versionchanged::...
def update(self, group: 'SentenceGroup', flags: Flags) -> None: """ This object is considered to be a "global" sentence group while the other one is flags-specific. All data related to the specified flags will be overwritten by the content of the specified group. """ to_...
This object is considered to be a "global" sentence group while the other one is flags-specific. All data related to the specified flags will be overwritten by the content of the specified group.
Below is the the instruction that describes the task: ### Input: This object is considered to be a "global" sentence group while the other one is flags-specific. All data related to the specified flags will be overwritten by the content of the specified group. ### Response: def update(self, group: ...
def get_aps(self): """Return a list of all AP:s, with significant information about each.""" #Set test to 0 instead of NULL params = json.dumps({'_depth': 2, 'test': 0}) return self._read(self.api_url + 'stat/device', params)
Return a list of all AP:s, with significant information about each.
Below is the the instruction that describes the task: ### Input: Return a list of all AP:s, with significant information about each. ### Response: def get_aps(self): """Return a list of all AP:s, with significant information about each.""" #Set test to 0 instead of NULL params = json.dumps...
def sample(self, n=None, frac=None, replace=False, weights=None, random_state=None): '''Returns a DataFrame with a random set of rows {note_copy} Provide either n or frac. Example: >>> import vaex, numpy as np >>> df = vaex.from_arrays(s=np.array(['a', 'b', 'c', 'd'])...
Returns a DataFrame with a random set of rows {note_copy} Provide either n or frac. Example: >>> import vaex, numpy as np >>> df = vaex.from_arrays(s=np.array(['a', 'b', 'c', 'd']), x=np.arange(1,5)) >>> df # s x 0 a 1 1 b ...
Below is the the instruction that describes the task: ### Input: Returns a DataFrame with a random set of rows {note_copy} Provide either n or frac. Example: >>> import vaex, numpy as np >>> df = vaex.from_arrays(s=np.array(['a', 'b', 'c', 'd']), x=np.arange(1,5)) ...
def parse_pseudo_class(self, sel, m, has_selector, iselector, is_html): """Parse pseudo class.""" complex_pseudo = False pseudo = util.lower(css_unescape(m.group('name'))) if m.group('open'): complex_pseudo = True if complex_pseudo and pseudo in PSEUDO_COMPLEX: ...
Parse pseudo class.
Below is the the instruction that describes the task: ### Input: Parse pseudo class. ### Response: def parse_pseudo_class(self, sel, m, has_selector, iselector, is_html): """Parse pseudo class.""" complex_pseudo = False pseudo = util.lower(css_unescape(m.group('name'))) if m.group(...
def repr_assist(obj, remap=None): """Helper function to simplify ``__repr__`` methods. Args: obj: Object to pull argument values for remap (dict): Argument pairs to remap before output Returns: str: Self-documenting representation of ``value`` """ if not remap: rema...
Helper function to simplify ``__repr__`` methods. Args: obj: Object to pull argument values for remap (dict): Argument pairs to remap before output Returns: str: Self-documenting representation of ``value``
Below is the the instruction that describes the task: ### Input: Helper function to simplify ``__repr__`` methods. Args: obj: Object to pull argument values for remap (dict): Argument pairs to remap before output Returns: str: Self-documenting representation of ``value`` ### Respon...
def pretty_format(message): """ Convert a message dictionary into a human-readable string. @param message: Message to parse, as dictionary. @return: Unicode string. """ skip = { TIMESTAMP_FIELD, TASK_UUID_FIELD, TASK_LEVEL_FIELD, MESSAGE_TYPE_FIELD, ACTION_TYPE_FIELD, ACTION_ST...
Convert a message dictionary into a human-readable string. @param message: Message to parse, as dictionary. @return: Unicode string.
Below is the the instruction that describes the task: ### Input: Convert a message dictionary into a human-readable string. @param message: Message to parse, as dictionary. @return: Unicode string. ### Response: def pretty_format(message): """ Convert a message dictionary into a human-readable st...
def plot_results(fout_img, goea_results, **kws): """Given a list of GOEA results, plot result GOs up to top.""" if "{NS}" not in fout_img: plt_goea_results(fout_img, goea_results, **kws) else: # Plot separately by NS: BP, MF, CC ns2goea_results = cx.defaultdict(list) for rec ...
Given a list of GOEA results, plot result GOs up to top.
Below is the the instruction that describes the task: ### Input: Given a list of GOEA results, plot result GOs up to top. ### Response: def plot_results(fout_img, goea_results, **kws): """Given a list of GOEA results, plot result GOs up to top.""" if "{NS}" not in fout_img: plt_goea_results(fout_im...
def _resume_with_session_ticket( self, server_info: ServerConnectivityInfo, ssl_version_to_use: OpenSslVersionEnum, ) -> TslSessionTicketSupportEnum: """Perform one session resumption using TLS Session Tickets. """ # Connect to the server and keep the SSL ...
Perform one session resumption using TLS Session Tickets.
Below is the the instruction that describes the task: ### Input: Perform one session resumption using TLS Session Tickets. ### Response: def _resume_with_session_ticket( self, server_info: ServerConnectivityInfo, ssl_version_to_use: OpenSslVersionEnum, ) -> TslSessionTicketS...
def _check_connectivity(self, err): ''' a method to check connectivity as source of error ''' try: import requests requests.get(self.uptime_ssl) except: from requests import Request request_object = Request(method='GET', url=self...
a method to check connectivity as source of error
Below is the the instruction that describes the task: ### Input: a method to check connectivity as source of error ### Response: def _check_connectivity(self, err): ''' a method to check connectivity as source of error ''' try: import requests requests.get(se...
def add_subtree(cls, for_node, node, options): """ Recursively build options tree. """ if cls.is_loop_safe(for_node, node): options.append( (node.pk, mark_safe(cls.mk_indent(node.get_depth()) + escape(node)))) for subnode in node.get_children(): ...
Recursively build options tree.
Below is the the instruction that describes the task: ### Input: Recursively build options tree. ### Response: def add_subtree(cls, for_node, node, options): """ Recursively build options tree. """ if cls.is_loop_safe(for_node, node): options.append( (node.pk, ...
def empty_clone(self, binning=None, axis=0, type=None, **kwargs): """ Return a new empty histogram. The binning may be modified along one axis by specifying the binning and axis arguments. If binning is False, then the corresponding axis is dropped from the returned histogram. ...
Return a new empty histogram. The binning may be modified along one axis by specifying the binning and axis arguments. If binning is False, then the corresponding axis is dropped from the returned histogram.
Below is the the instruction that describes the task: ### Input: Return a new empty histogram. The binning may be modified along one axis by specifying the binning and axis arguments. If binning is False, then the corresponding axis is dropped from the returned histogram. ### Response: def ...
def set_contents_from_stream(self, fp, headers=None, replace=True, cb=None, num_cb=10, policy=None, reduced_redundancy=False, query_args=None, size=None): """ Store an object using the name of the Key obje...
Store an object using the name of the Key object as the key in cloud and the contents of the data stream pointed to by 'fp' as the contents. The stream object is not seekable and total size is not known. This has the implication that we can't specify the Content-Size and Content-...
Below is the the instruction that describes the task: ### Input: Store an object using the name of the Key object as the key in cloud and the contents of the data stream pointed to by 'fp' as the contents. The stream object is not seekable and total size is not known. This has the im...
def do_comparison(parser, token): """ Compares passed arguments. Attached functions should return boolean ``True`` or ``False``. If the attached function returns ``True``, the first node list is rendered. If the attached function returns ``False``, the second optional node list is rendered (part af...
Compares passed arguments. Attached functions should return boolean ``True`` or ``False``. If the attached function returns ``True``, the first node list is rendered. If the attached function returns ``False``, the second optional node list is rendered (part after the ``{% else %}`` statement). If the...
Below is the the instruction that describes the task: ### Input: Compares passed arguments. Attached functions should return boolean ``True`` or ``False``. If the attached function returns ``True``, the first node list is rendered. If the attached function returns ``False``, the second optional node li...
def to_dict(self): """Return the schema as a `dict`, ready to be serialized by :mod:`json`. """ result = {} stack = collections.deque() stack.append( ( result, {_to_camel_case(k): v for k, v in self.__dict__.iteritems()}, ...
Return the schema as a `dict`, ready to be serialized by :mod:`json`.
Below is the the instruction that describes the task: ### Input: Return the schema as a `dict`, ready to be serialized by :mod:`json`. ### Response: def to_dict(self): """Return the schema as a `dict`, ready to be serialized by :mod:`json`. """ result = {} stack = c...
def compact(self): """ Switch to the compact variant of the live form template. By default, this will simply create a loader for the C{self.compactFragmentName} template and compact all of this form's parameters. """ self.docFactory = webtheme.getLoader(self.comp...
Switch to the compact variant of the live form template. By default, this will simply create a loader for the C{self.compactFragmentName} template and compact all of this form's parameters.
Below is the the instruction that describes the task: ### Input: Switch to the compact variant of the live form template. By default, this will simply create a loader for the C{self.compactFragmentName} template and compact all of this form's parameters. ### Response: def compact(self): ...
def _indent_decor(lbl): """ does the actual work of indent_func """ def closure_indent(func): if util_arg.TRACE: @ignores_exc_tb(outer_wrapper=False) #@wraps(func) def wrp_indent(*args, **kwargs): with util_print.Indenter(lbl): ...
does the actual work of indent_func
Below is the the instruction that describes the task: ### Input: does the actual work of indent_func ### Response: def _indent_decor(lbl): """ does the actual work of indent_func """ def closure_indent(func): if util_arg.TRACE: @ignores_exc_tb(outer_wrapper=False) #@...
def _get_word_start_cursor(self, position): """ Find the start of the word to the left the given position. If a sequence of non-word characters precedes the first word, skip over them. (This emulates the behavior of bash, emacs, etc.) """ document = self._control.document...
Find the start of the word to the left the given position. If a sequence of non-word characters precedes the first word, skip over them. (This emulates the behavior of bash, emacs, etc.)
Below is the the instruction that describes the task: ### Input: Find the start of the word to the left the given position. If a sequence of non-word characters precedes the first word, skip over them. (This emulates the behavior of bash, emacs, etc.) ### Response: def _get_word_start_curso...
def proc_line_coordinate(self, line): """Extracts data from columns in ATOM/HETATM record.""" at_type = line[0:6].strip() # 0 at_ser = int(line[6:11].strip()) # 1 at_name = line[12:16].strip() # 2 alt_loc = line[16].strip() # 3 res_name = line[17:20].strip() # 4 ...
Extracts data from columns in ATOM/HETATM record.
Below is the the instruction that describes the task: ### Input: Extracts data from columns in ATOM/HETATM record. ### Response: def proc_line_coordinate(self, line): """Extracts data from columns in ATOM/HETATM record.""" at_type = line[0:6].strip() # 0 at_ser = int(line[6:11].strip()) #...
def _extract(self, source, *args, **kwargs): """ Extracts data from mbox files. Mutates _data. :param str source: The path to one or more mbox files. :param args: Arbitrary arguments for extensibility. :param kwargs: Arbitrary keyword arguments for extensibility. :return...
Extracts data from mbox files. Mutates _data. :param str source: The path to one or more mbox files. :param args: Arbitrary arguments for extensibility. :param kwargs: Arbitrary keyword arguments for extensibility. :return: None
Below is the the instruction that describes the task: ### Input: Extracts data from mbox files. Mutates _data. :param str source: The path to one or more mbox files. :param args: Arbitrary arguments for extensibility. :param kwargs: Arbitrary keyword arguments for extensibility. :re...
def get_datasets_in_nodes(): """ Get the node associated with each dataset. Some datasets will have an ambiguous node since they exists in more than one node. """ data_dir = os.path.join(scriptdir, "..", "usgs", "data") cwic = map(lambda d: d["datasetName"], api.datasets(None, CWIC_LSI_EXP...
Get the node associated with each dataset. Some datasets will have an ambiguous node since they exists in more than one node.
Below is the the instruction that describes the task: ### Input: Get the node associated with each dataset. Some datasets will have an ambiguous node since they exists in more than one node. ### Response: def get_datasets_in_nodes(): """ Get the node associated with each dataset. Some datasets ...
def _check_yaml_and_paths(ymlfilepath, yamldefs): """ Checks YAML for errors and resolves all paths """ relpath = os.path.relpath(ymlfilepath) if '/' not in relpath: relpath = './%s' % relpath pathroot = os.path.abspath(os.path.dirname(ymlfilepath)) for image...
Checks YAML for errors and resolves all paths
Below is the the instruction that describes the task: ### Input: Checks YAML for errors and resolves all paths ### Response: def _check_yaml_and_paths(ymlfilepath, yamldefs): """ Checks YAML for errors and resolves all paths """ relpath = os.path.relpath(ymlfilepath) if '/' not in r...
def from_blob(cls, blob, stage=0): """:return: Minimal entry resembling the given blob object""" time = pack(">LL", 0, 0) return IndexEntry((blob.mode, blob.binsha, stage << CE_STAGESHIFT, blob.path, time, time, 0, 0, 0, 0, blob.size))
:return: Minimal entry resembling the given blob object
Below is the the instruction that describes the task: ### Input: :return: Minimal entry resembling the given blob object ### Response: def from_blob(cls, blob, stage=0): """:return: Minimal entry resembling the given blob object""" time = pack(">LL", 0, 0) return IndexEntry((blob.mode, blob...
def execute(command, *args, **kwargs): """Execute a command with arguments and wait for output. Arguments should not be quoted! Keyword arguments: env (dict): Dictionary of additional environment variables. wait (bool): Wait for the process to finish. Example:: >>>...
Execute a command with arguments and wait for output. Arguments should not be quoted! Keyword arguments: env (dict): Dictionary of additional environment variables. wait (bool): Wait for the process to finish. Example:: >>> code = 'import sys;sys.stdout.write('out');sys...
Below is the the instruction that describes the task: ### Input: Execute a command with arguments and wait for output. Arguments should not be quoted! Keyword arguments: env (dict): Dictionary of additional environment variables. wait (bool): Wait for the process to finish. Ex...
def reply(self, to_all=True): """ Creates a new message that is a reply to this message :param bool to_all: whether or not to replies to all the recipients instead to just the sender :return: new message :rtype: Message """ if not self.object_id or self.__is_dr...
Creates a new message that is a reply to this message :param bool to_all: whether or not to replies to all the recipients instead to just the sender :return: new message :rtype: Message
Below is the the instruction that describes the task: ### Input: Creates a new message that is a reply to this message :param bool to_all: whether or not to replies to all the recipients instead to just the sender :return: new message :rtype: Message ### Response: def reply(self, ...
def position(msg0, msg1, t0, t1, lat_ref=None, lon_ref=None): """Decode position from a pair of even and odd position message (works with both airborne and surface position messages) Args: msg0 (string): even message (28 bytes hexadecimal string) msg1 (string): odd message (28 bytes hexadec...
Decode position from a pair of even and odd position message (works with both airborne and surface position messages) Args: msg0 (string): even message (28 bytes hexadecimal string) msg1 (string): odd message (28 bytes hexadecimal string) t0 (int): timestamps for the even message ...
Below is the the instruction that describes the task: ### Input: Decode position from a pair of even and odd position message (works with both airborne and surface position messages) Args: msg0 (string): even message (28 bytes hexadecimal string) msg1 (string): odd message (28 bytes hexadec...
def networks_distribution(df, filepath=None): """ Generates two alternative plots describing the distribution of variables `mse` and `size`. It is intended to be used over a list of logical networks. Parameters ---------- df: `pandas.DataFrame`_ DataFrame with columns `mse` and `si...
Generates two alternative plots describing the distribution of variables `mse` and `size`. It is intended to be used over a list of logical networks. Parameters ---------- df: `pandas.DataFrame`_ DataFrame with columns `mse` and `size` filepath: str Absolute path to a folder w...
Below is the the instruction that describes the task: ### Input: Generates two alternative plots describing the distribution of variables `mse` and `size`. It is intended to be used over a list of logical networks. Parameters ---------- df: `pandas.DataFrame`_ DataFrame with columns `m...
def eval_mus_dir( dataset, estimates_dir, output_dir=None, *args, **kwargs ): """Run musdb.run for the purpose of evaluation of musdb estimate dir Parameters ---------- dataset : DB(object) Musdb Database object. estimates_dir : str Path to estimates folder. outp...
Run musdb.run for the purpose of evaluation of musdb estimate dir Parameters ---------- dataset : DB(object) Musdb Database object. estimates_dir : str Path to estimates folder. output_dir : str Output folder where evaluation json files are stored. *args Variable...
Below is the the instruction that describes the task: ### Input: Run musdb.run for the purpose of evaluation of musdb estimate dir Parameters ---------- dataset : DB(object) Musdb Database object. estimates_dir : str Path to estimates folder. output_dir : str Output fold...
def doeqdi(x, y, UP=False): """ Takes digitized x,y, data and returns the dec,inc, assuming an equal area projection Parameters __________________ x : array of digitized x from point on equal area projection y : array of igitized y from point on equal area projection UP : if...
Takes digitized x,y, data and returns the dec,inc, assuming an equal area projection Parameters __________________ x : array of digitized x from point on equal area projection y : array of igitized y from point on equal area projection UP : if True, is an upper hemisphere projection...
Below is the the instruction that describes the task: ### Input: Takes digitized x,y, data and returns the dec,inc, assuming an equal area projection Parameters __________________ x : array of digitized x from point on equal area projection y : array of igitized y from point on equal ar...
def get_url_preview(self, url, ts=None): """Get preview for URL. Args: url (str): URL to get a preview ts (double): The preferred point in time to return a preview for. The server may return a newer version if it does not have the requested ...
Get preview for URL. Args: url (str): URL to get a preview ts (double): The preferred point in time to return a preview for. The server may return a newer version if it does not have the requested version available.
Below is the the instruction that describes the task: ### Input: Get preview for URL. Args: url (str): URL to get a preview ts (double): The preferred point in time to return a preview for. The server may return a newer version if it does not have t...
def get_queues(self, service_desk_id, include_count=False, start=0, limit=50): """ Returns a page of queues defined inside a service desk, for a given service desk ID. The returned queues will include an issue count for each queue (represented in issueCount field) if the query param incl...
Returns a page of queues defined inside a service desk, for a given service desk ID. The returned queues will include an issue count for each queue (represented in issueCount field) if the query param includeCount is set to true (defaults to false). Permissions: The calling user must be an agen...
Below is the the instruction that describes the task: ### Input: Returns a page of queues defined inside a service desk, for a given service desk ID. The returned queues will include an issue count for each queue (represented in issueCount field) if the query param includeCount is set to true (defau...
def authenticate(self, request, username=None, password=None): """Authenticate a username-password pair. Creates a new user if one is not already in the database. Args: username The username of the `User` to authenticate. password The pas...
Authenticate a username-password pair. Creates a new user if one is not already in the database. Args: username The username of the `User` to authenticate. password The password of the `User` to authenticate. Returns: `User`
Below is the the instruction that describes the task: ### Input: Authenticate a username-password pair. Creates a new user if one is not already in the database. Args: username The username of the `User` to authenticate. password The password...
def script_exists(self, digest, *digests): """Check existence of scripts in the script cache.""" return self.execute(b'SCRIPT', b'EXISTS', digest, *digests)
Check existence of scripts in the script cache.
Below is the the instruction that describes the task: ### Input: Check existence of scripts in the script cache. ### Response: def script_exists(self, digest, *digests): """Check existence of scripts in the script cache.""" return self.execute(b'SCRIPT', b'EXISTS', digest, *digests)
def _remove_rule(self, group, role, value=None): """Implementation detail""" if role not in group: return if value is None: group.pop(role, None) else: group[role].remove(value) self.invalidate()
Implementation detail
Below is the the instruction that describes the task: ### Input: Implementation detail ### Response: def _remove_rule(self, group, role, value=None): """Implementation detail""" if role not in group: return if value is None: group.pop(role, None) else: ...
def min_base_size_mask(self, size, hs_dims=None, prune=False): """Returns MinBaseSizeMask object with correct row, col and table masks. The returned object stores the necessary information about the base size, as well as about the base values. It can create corresponding masks in teh row, ...
Returns MinBaseSizeMask object with correct row, col and table masks. The returned object stores the necessary information about the base size, as well as about the base values. It can create corresponding masks in teh row, column, and table directions, based on the corresponding base values ...
Below is the the instruction that describes the task: ### Input: Returns MinBaseSizeMask object with correct row, col and table masks. The returned object stores the necessary information about the base size, as well as about the base values. It can create corresponding masks in teh row, co...
def firmware_download_input_protocol_type_scp_protocol_scp_file(self, **kwargs): """Auto Generated Code """ config = ET.Element("config") firmware_download = ET.Element("firmware_download") config = firmware_download input = ET.SubElement(firmware_download, "input") ...
Auto Generated Code
Below is the the instruction that describes the task: ### Input: Auto Generated Code ### Response: def firmware_download_input_protocol_type_scp_protocol_scp_file(self, **kwargs): """Auto Generated Code """ config = ET.Element("config") firmware_download = ET.Element("firmware_downl...
def delete_table_records(self, table, query_column, ids_to_delete): """ Responsys.deleteTableRecords call Accepts: InteractObject table string query_column possible values: 'RIID'|'EMAIL_ADDRESS'|'CUSTOMER_ID'|'MOBILE_NUMBER' list ids_to_delete ...
Responsys.deleteTableRecords call Accepts: InteractObject table string query_column possible values: 'RIID'|'EMAIL_ADDRESS'|'CUSTOMER_ID'|'MOBILE_NUMBER' list ids_to_delete Returns a list of DeleteResult instances
Below is the the instruction that describes the task: ### Input: Responsys.deleteTableRecords call Accepts: InteractObject table string query_column possible values: 'RIID'|'EMAIL_ADDRESS'|'CUSTOMER_ID'|'MOBILE_NUMBER' list ids_to_delete Returns ...
def prepare_to_run(self): """ Prepare the model for execution. """ self.clock.reset() for e in self.entities: e.prepare_to_run(self.clock, self.period_count)
Prepare the model for execution.
Below is the the instruction that describes the task: ### Input: Prepare the model for execution. ### Response: def prepare_to_run(self): """ Prepare the model for execution. """ self.clock.reset() for e in self.entities: e.prepare_to_run(self.clock, self.period...
def get_proficiency_form(self, *args, **kwargs): """Pass through to provider ProficiencyAdminSession.get_proficiency_form_for_update""" # Implemented from kitosid template for - # osid.resource.ResourceAdminSession.get_resource_form_for_update # This method might be a bit sketchy. Time w...
Pass through to provider ProficiencyAdminSession.get_proficiency_form_for_update
Below is the the instruction that describes the task: ### Input: Pass through to provider ProficiencyAdminSession.get_proficiency_form_for_update ### Response: def get_proficiency_form(self, *args, **kwargs): """Pass through to provider ProficiencyAdminSession.get_proficiency_form_for_update""" # I...
def parseInt(self, words): """Parses words to the integer they describe. Args: words (str): Description of the integer. Returns: An integer representation of the words. """ # Remove 'and', case-sensitivity words = words.replace(" and ", " ").lowe...
Parses words to the integer they describe. Args: words (str): Description of the integer. Returns: An integer representation of the words.
Below is the the instruction that describes the task: ### Input: Parses words to the integer they describe. Args: words (str): Description of the integer. Returns: An integer representation of the words. ### Response: def parseInt(self, words): """Parses words to t...
def _onmessage(cls, kmsg): """ Call on received message :param kser.schemas.Message kmsg: Kafka message :return: Kafka message :rtype: kser.schemas.Message """ logger.debug( "{}.ReceivedMessage {}[{}]".format( cls.__name__, kmsg.entrypoint, km...
Call on received message :param kser.schemas.Message kmsg: Kafka message :return: Kafka message :rtype: kser.schemas.Message
Below is the the instruction that describes the task: ### Input: Call on received message :param kser.schemas.Message kmsg: Kafka message :return: Kafka message :rtype: kser.schemas.Message ### Response: def _onmessage(cls, kmsg): """ Call on received message :param kser.s...
def update(self): """ Update this `~photutils.isophote.EllipseSample` instance. This method calls the :meth:`~photutils.isophote.EllipseSample.extract` method to get the values that match the current ``geometry`` attribute, and then computes the the mean intensity, local...
Update this `~photutils.isophote.EllipseSample` instance. This method calls the :meth:`~photutils.isophote.EllipseSample.extract` method to get the values that match the current ``geometry`` attribute, and then computes the the mean intensity, local gradient, and other associate...
Below is the the instruction that describes the task: ### Input: Update this `~photutils.isophote.EllipseSample` instance. This method calls the :meth:`~photutils.isophote.EllipseSample.extract` method to get the values that match the current ``geometry`` attribute, and then compute...
def search_list(self, term=None, phrase=None, limit=DEFAULT_SEARCH_LIMIT, rating=None): """ Suppose you expect the `search` method to just give you a list rather than a generator. This method will have that effect. Equivalent to:: >>> g = Giphy() >>> ...
Suppose you expect the `search` method to just give you a list rather than a generator. This method will have that effect. Equivalent to:: >>> g = Giphy() >>> results = list(g.search('foo'))
Below is the the instruction that describes the task: ### Input: Suppose you expect the `search` method to just give you a list rather than a generator. This method will have that effect. Equivalent to:: >>> g = Giphy() >>> results = list(g.search('foo')) ### Response: def search_l...
def cmd_link_list(self): '''list links''' print("%u links" % len(self.mpstate.mav_master)) for i in range(len(self.mpstate.mav_master)): conn = self.mpstate.mav_master[i] print("%u: %s" % (i, conn.address))
list links
Below is the the instruction that describes the task: ### Input: list links ### Response: def cmd_link_list(self): '''list links''' print("%u links" % len(self.mpstate.mav_master)) for i in range(len(self.mpstate.mav_master)): conn = self.mpstate.mav_master[i] print(...
def _select_root_port(self): """ ROOT_PORT is the nearest port to a root bridge. It is determined by the cost of path, etc. """ root_port = None for port in self.ports.values(): root_msg = (self.root_priority if root_port is None else root_port.de...
ROOT_PORT is the nearest port to a root bridge. It is determined by the cost of path, etc.
Below is the the instruction that describes the task: ### Input: ROOT_PORT is the nearest port to a root bridge. It is determined by the cost of path, etc. ### Response: def _select_root_port(self): """ ROOT_PORT is the nearest port to a root bridge. It is determined by the cost of ...
def get_first_non_label_instruction(self): """ Returns the memcell of the given block, which is not a LABEL. """ for i in range(len(self)): if not self.mem[i].is_label: return self.mem[i] return None
Returns the memcell of the given block, which is not a LABEL.
Below is the the instruction that describes the task: ### Input: Returns the memcell of the given block, which is not a LABEL. ### Response: def get_first_non_label_instruction(self): """ Returns the memcell of the given block, which is not a LABEL. """ for i in range(len(se...
def authorize(self, devices, op_type=1): """ 设备授权 详情请参考 https://iot.weixin.qq.com/wiki/new/index.html?page=3-4-5 :param devices: 设备信息的列表 :param op_type: 请求操作的类型,限定取值为:0:设备授权 1:设备更新 :return: 返回的 JSON 数据包 """ return self._post( 'authoriz...
设备授权 详情请参考 https://iot.weixin.qq.com/wiki/new/index.html?page=3-4-5 :param devices: 设备信息的列表 :param op_type: 请求操作的类型,限定取值为:0:设备授权 1:设备更新 :return: 返回的 JSON 数据包
Below is the the instruction that describes the task: ### Input: 设备授权 详情请参考 https://iot.weixin.qq.com/wiki/new/index.html?page=3-4-5 :param devices: 设备信息的列表 :param op_type: 请求操作的类型,限定取值为:0:设备授权 1:设备更新 :return: 返回的 JSON 数据包 ### Response: def authorize(self, devices, op_type=...
def __check_disk(self): ''' raise exception on disk space exceeded ''' cmd = "sh -c \"df --no-sync -m -P -l -x fuse -x tmpfs -x devtmpfs -x davfs -x nfs " cmd += self.core.artifacts_base_dir cmd += " | tail -n 1 | awk '{print \$4}' \"" res = execute(cmd, True, 0.1, True) ...
raise exception on disk space exceeded
Below is the the instruction that describes the task: ### Input: raise exception on disk space exceeded ### Response: def __check_disk(self): ''' raise exception on disk space exceeded ''' cmd = "sh -c \"df --no-sync -m -P -l -x fuse -x tmpfs -x devtmpfs -x davfs -x nfs " cmd += self.core.a...
def get_link_pat (arg, strict=False): """Get a link pattern matcher for intern/extern links. Returns a compiled pattern and a negate and strict option. @param arg: pattern from config @type arg: string @param strict: if pattern is to be handled strict @type strict: bool @return: dictionary ...
Get a link pattern matcher for intern/extern links. Returns a compiled pattern and a negate and strict option. @param arg: pattern from config @type arg: string @param strict: if pattern is to be handled strict @type strict: bool @return: dictionary with keys 'pattern', 'negate' and 'strict' ...
Below is the the instruction that describes the task: ### Input: Get a link pattern matcher for intern/extern links. Returns a compiled pattern and a negate and strict option. @param arg: pattern from config @type arg: string @param strict: if pattern is to be handled strict @type strict: bool ...
def read_bytes(self): """ reading bytes; update progress bar after 1 ms """ global exit_flag for self.i in range(0, self.length) : self.bytes[self.i] = i_max[self.i] self.maxbytes[self.i] = total_chunks[self.i] self.progress[self.i]["maximum"] = total_chunks[self.i] self.progress[self.i]["value"]...
reading bytes; update progress bar after 1 ms
Below is the the instruction that describes the task: ### Input: reading bytes; update progress bar after 1 ms ### Response: def read_bytes(self): """ reading bytes; update progress bar after 1 ms """ global exit_flag for self.i in range(0, self.length) : self.bytes[self.i] = i_max[self.i] self.ma...
def calculate_quality_metrics(metrics, designs, verbose=False): """ Have each metric calculate all the information it needs. """ for metric in metrics: if metric.progress_update: print metric.progress_update metric.load(designs, verbose)
Have each metric calculate all the information it needs.
Below is the the instruction that describes the task: ### Input: Have each metric calculate all the information it needs. ### Response: def calculate_quality_metrics(metrics, designs, verbose=False): """ Have each metric calculate all the information it needs. """ for metric in metrics: if ...
def _maybe_connect(self, to_pid, callback=None): """Asynchronously establish a connection to the remote pid.""" callback = stack_context.wrap(callback or (lambda stream: None)) def streaming_callback(data): # we are not guaranteed to get an acknowledgment, but log and discard bytes if we do. l...
Asynchronously establish a connection to the remote pid.
Below is the the instruction that describes the task: ### Input: Asynchronously establish a connection to the remote pid. ### Response: def _maybe_connect(self, to_pid, callback=None): """Asynchronously establish a connection to the remote pid.""" callback = stack_context.wrap(callback or (lambda stream: ...
def __git_tag_push(): """ Push all tags. The function call will return 0 if the command success. """ command = ['git', 'push', 'origin', '--tags'] Shell.msg('Pushing tags...') if APISettings.DEBUG: Git.__debug(command, True) if not call(comma...
Push all tags. The function call will return 0 if the command success.
Below is the the instruction that describes the task: ### Input: Push all tags. The function call will return 0 if the command success. ### Response: def __git_tag_push(): """ Push all tags. The function call will return 0 if the command success. """ command = ['git'...
def ADC(cpu, dest, src): """ Adds with carry. Adds the destination operand (first operand), the source operand (second operand), and the carry (CF) flag and stores the result in the destination operand. The state of the CF flag represents a carry from a previous addition. When a...
Adds with carry. Adds the destination operand (first operand), the source operand (second operand), and the carry (CF) flag and stores the result in the destination operand. The state of the CF flag represents a carry from a previous addition. When an immediate value is used as an opera...
Below is the the instruction that describes the task: ### Input: Adds with carry. Adds the destination operand (first operand), the source operand (second operand), and the carry (CF) flag and stores the result in the destination operand. The state of the CF flag represents a carry from a p...
def replace_table_rate_rule_by_id(cls, table_rate_rule_id, table_rate_rule, **kwargs): """Replace TableRateRule Replace all attributes of TableRateRule This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async=True >>> threa...
Replace TableRateRule Replace all attributes of TableRateRule This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async=True >>> thread = api.replace_table_rate_rule_by_id(table_rate_rule_id, table_rate_rule, async=True) >>>...
Below is the the instruction that describes the task: ### Input: Replace TableRateRule Replace all attributes of TableRateRule This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async=True >>> thread = api.replace_table_rate_ru...
def get_logger(name=None, level=logging.NOTSET, handlers=None): """ Create a Python logging Logger for the given name. A special case is when the name is None, as this will represent the root Logger object. When handlers are specified, the currently configured handlers for this name are removed, and the specified...
Create a Python logging Logger for the given name. A special case is when the name is None, as this will represent the root Logger object. When handlers are specified, the currently configured handlers for this name are removed, and the specified handlers are set. Parameters ---------- name: string Name of th...
Below is the the instruction that describes the task: ### Input: Create a Python logging Logger for the given name. A special case is when the name is None, as this will represent the root Logger object. When handlers are specified, the currently configured handlers for this name are removed, and the specified ...
def from_dict(cls, spec): """Create a |Shape| from a dictionary specification. Parameters ---------- spec : dict A dictionary with either the fields ``'center'`` and ``'radius'`` (for a circle), ``'center'``, ``'radius'``, and ``'n_vertices'`` (for a regular poly...
Create a |Shape| from a dictionary specification. Parameters ---------- spec : dict A dictionary with either the fields ``'center'`` and ``'radius'`` (for a circle), ``'center'``, ``'radius'``, and ``'n_vertices'`` (for a regular polygon), or ``'vertices'``. ...
Below is the the instruction that describes the task: ### Input: Create a |Shape| from a dictionary specification. Parameters ---------- spec : dict A dictionary with either the fields ``'center'`` and ``'radius'`` (for a circle), ``'center'``, ``'radius'``, and ``'n...
def fetch_todays_schedule(self, rooms): """ Fetch the schedules for the given rooms. """ def _format_date(d): return d.strftime('%Y/%m/%d') room_ids = self.fetch_room_ids(rooms) ret = {} now = datetime.datetime.now() nowStr = _format_date(now) tomorrow...
Fetch the schedules for the given rooms.
Below is the the instruction that describes the task: ### Input: Fetch the schedules for the given rooms. ### Response: def fetch_todays_schedule(self, rooms): """ Fetch the schedules for the given rooms. """ def _format_date(d): return d.strftime('%Y/%m/%d') room_ids = self.fet...
def _initPermConnected(self): """ Returns a randomly generated permanence value for a synapses that is initialized in a connected state. The basic idea here is to initialize permanence values very close to synPermConnected so that a small number of learning steps could make it disconnected or connec...
Returns a randomly generated permanence value for a synapses that is initialized in a connected state. The basic idea here is to initialize permanence values very close to synPermConnected so that a small number of learning steps could make it disconnected or connected. Note: experimentation was done a...
Below is the the instruction that describes the task: ### Input: Returns a randomly generated permanence value for a synapses that is initialized in a connected state. The basic idea here is to initialize permanence values very close to synPermConnected so that a small number of learning steps could mak...
def remove_core_element(self, model): """Remove respective core element of handed scoped variable model :param ScopedVariableModel model: Scoped variable model which core element should be removed :return: """ assert model.scoped_variable.parent is self.model.state gui_h...
Remove respective core element of handed scoped variable model :param ScopedVariableModel model: Scoped variable model which core element should be removed :return:
Below is the the instruction that describes the task: ### Input: Remove respective core element of handed scoped variable model :param ScopedVariableModel model: Scoped variable model which core element should be removed :return: ### Response: def remove_core_element(self, model): """Remov...
def competition_list_files_cli(self, competition, competition_opt=None, csv_display=False, quiet=False): """ List files for a competition, if it exists Paramet...
List files for a competition, if it exists Parameters ========== competition: the name of the competition. If None, look to config competition_opt: an alternative competition option provided by cli csv_display: if True, print comma separated values ...
Below is the the instruction that describes the task: ### Input: List files for a competition, if it exists Parameters ========== competition: the name of the competition. If None, look to config competition_opt: an alternative competition option provided by cli ...
def setup_metrics(self, metric_names, objects, period, count): """Sets parameters of specified base metrics for a set of objects. Returns an array of :py:class:`IPerformanceMetric` describing the metrics have been affected. @c Null or empty metric name array means all metrics. ...
Sets parameters of specified base metrics for a set of objects. Returns an array of :py:class:`IPerformanceMetric` describing the metrics have been affected. @c Null or empty metric name array means all metrics. @c Null or empty object array means all existing objects. If metri...
Below is the the instruction that describes the task: ### Input: Sets parameters of specified base metrics for a set of objects. Returns an array of :py:class:`IPerformanceMetric` describing the metrics have been affected. @c Null or empty metric name array means all metrics. @c Nu...
def get_val(self, x): """Converts to int.""" try: if self.subtype == 'integer': return int(round(x[self.col_name])) else: if np.isnan(x[self.col_name]): return self.default_val return x[self.col_name] e...
Converts to int.
Below is the the instruction that describes the task: ### Input: Converts to int. ### Response: def get_val(self, x): """Converts to int.""" try: if self.subtype == 'integer': return int(round(x[self.col_name])) else: if np.isnan(x[self.col_na...
def _record_training_step(self, summary): """ Adds summary to writer and increments the step. """ self.writer.add_summary(summary=summary, global_step=self.step) self.step += 1
Adds summary to writer and increments the step.
Below is the the instruction that describes the task: ### Input: Adds summary to writer and increments the step. ### Response: def _record_training_step(self, summary): """ Adds summary to writer and increments the step. """ self.writer.add_summary(summary=summary, global_step=self.step) se...
def consume(self, cwd=None): """ Converts the lexer tokens into valid statements. This process also checks command syntax. """ first_pass = Grammar.overall.parseString(self.string) lowered = { key.lower(): val for key, val in first_pass.iteritems() } self.commands = ['\n...
Converts the lexer tokens into valid statements. This process also checks command syntax.
Below is the the instruction that describes the task: ### Input: Converts the lexer tokens into valid statements. This process also checks command syntax. ### Response: def consume(self, cwd=None): """ Converts the lexer tokens into valid statements. This process also checks command syntax....
def data(self, fields=None, sorted_by='energy', name='Sample', reverse=False, sample_dict_cast=True, index=False): """Iterate over the data in the :class:`SampleSet`. Args: fields (list, optional, default=None): If specified, only these fields are included in th...
Iterate over the data in the :class:`SampleSet`. Args: fields (list, optional, default=None): If specified, only these fields are included in the yielded tuples. The special field name 'sample' can be used to view the samples. sorted_by (str/None, option...
Below is the the instruction that describes the task: ### Input: Iterate over the data in the :class:`SampleSet`. Args: fields (list, optional, default=None): If specified, only these fields are included in the yielded tuples. The special field name 'sample' can ...
def run_request_processors(self, request): """ Before rendering a page, run all registered request processors. A request processor may peruse and modify the page or the request. It can also return a ``HttpResponse`` for shortcutting the rendering and returning that response immed...
Before rendering a page, run all registered request processors. A request processor may peruse and modify the page or the request. It can also return a ``HttpResponse`` for shortcutting the rendering and returning that response immediately to the client.
Below is the the instruction that describes the task: ### Input: Before rendering a page, run all registered request processors. A request processor may peruse and modify the page or the request. It can also return a ``HttpResponse`` for shortcutting the rendering and returning that response...
def getSamplingStrategy(self, serviceName): """ Parameters: - serviceName """ self._seqid += 1 future = self._reqs[self._seqid] = concurrent.Future() self.send_getSamplingStrategy(serviceName) return future
Parameters: - serviceName
Below is the the instruction that describes the task: ### Input: Parameters: - serviceName ### Response: def getSamplingStrategy(self, serviceName): """ Parameters: - serviceName """ self._seqid += 1 future = self._reqs[self._seqid] = concurrent.Future() self.send_getSamplingStrat...
def _assign_name(self, obj, name, shaders): """ Assign *name* to *obj* in *shaders*. """ if self._is_global(obj): assert name not in self._global_ns self._global_ns[name] = obj else: for shader in shaders: ns = self._shader_ns[shader] ...
Assign *name* to *obj* in *shaders*.
Below is the the instruction that describes the task: ### Input: Assign *name* to *obj* in *shaders*. ### Response: def _assign_name(self, obj, name, shaders): """ Assign *name* to *obj* in *shaders*. """ if self._is_global(obj): assert name not in self._global_ns se...
def Run(self): """ Wait for clients to connect and service them :returns: None """ while True: try: events = self.poller.poll() except KeyboardInterrupt: self.context.destroy() sys.exit() self...
Wait for clients to connect and service them :returns: None
Below is the the instruction that describes the task: ### Input: Wait for clients to connect and service them :returns: None ### Response: def Run(self): """ Wait for clients to connect and service them :returns: None """ while True: try: ...
def get_or_add_group(self, nested_names, name_attr='id'): """Get a group from the tree, or add a new one with the given name structure. `nested_names` is a list of strings which represent group names. Each group name will be nested inside of the previous group name. `name_attr`...
Get a group from the tree, or add a new one with the given name structure. `nested_names` is a list of strings which represent group names. Each group name will be nested inside of the previous group name. `name_attr` is the group attribute that is being used to represent the g...
Below is the the instruction that describes the task: ### Input: Get a group from the tree, or add a new one with the given name structure. `nested_names` is a list of strings which represent group names. Each group name will be nested inside of the previous group name. `name_attr`...
def reconstruct_dict(dot_paths, values): ''' a method for reconstructing a dictionary from the values along dot paths ''' output_dict = {} for i in range(len(dot_paths)): if i + 1 <= len(values): path_segments = segment_path(dot_paths[i]) current_nest = output_...
a method for reconstructing a dictionary from the values along dot paths
Below is the the instruction that describes the task: ### Input: a method for reconstructing a dictionary from the values along dot paths ### Response: def reconstruct_dict(dot_paths, values): ''' a method for reconstructing a dictionary from the values along dot paths ''' output_dict = {} ...
def rest_get_stream(self, url, session=None, verify=True, cert=None): """ Perform a chunked GET request to url with requests.session This is specifically to download files. """ res = session.get(url, stream=True, verify=verify, cert=cert) return res.raw, res.status_code
Perform a chunked GET request to url with requests.session This is specifically to download files.
Below is the the instruction that describes the task: ### Input: Perform a chunked GET request to url with requests.session This is specifically to download files. ### Response: def rest_get_stream(self, url, session=None, verify=True, cert=None): """ Perform a chunked GET request to url wi...
def as_html(self, labels=None, predict_proba=True, show_predicted_value=True, **kwargs): """Returns the explanation as an html page. Args: labels: desired labels to show explanations for (as barcharts). If you a...
Returns the explanation as an html page. Args: labels: desired labels to show explanations for (as barcharts). If you ask for a label for which an explanation wasn't computed, will throw an exception. If None, will show explanations for all available ...
Below is the the instruction that describes the task: ### Input: Returns the explanation as an html page. Args: labels: desired labels to show explanations for (as barcharts). If you ask for a label for which an explanation wasn't computed, will throw an exceptio...
def edgepaths(self): """ Returns the fixed EdgePaths or computes direct connections between supplied nodes. """ if self._edgepaths: return self._edgepaths if pd is None: paths = connect_edges(self) else: paths = connect_edges_pd...
Returns the fixed EdgePaths or computes direct connections between supplied nodes.
Below is the the instruction that describes the task: ### Input: Returns the fixed EdgePaths or computes direct connections between supplied nodes. ### Response: def edgepaths(self): """ Returns the fixed EdgePaths or computes direct connections between supplied nodes. """ ...
def _set_isns_discovery_domain(self, v, load=False): """ Setter method for isns_discovery_domain, mapped from YANG variable /isns/isns_vrf/isns_discovery_domain (list) If this variable is read-only (config: false) in the source YANG file, then _set_isns_discovery_domain is considered as a private me...
Setter method for isns_discovery_domain, mapped from YANG variable /isns/isns_vrf/isns_discovery_domain (list) If this variable is read-only (config: false) in the source YANG file, then _set_isns_discovery_domain is considered as a private method. Backends looking to populate this variable should do so...
Below is the the instruction that describes the task: ### Input: Setter method for isns_discovery_domain, mapped from YANG variable /isns/isns_vrf/isns_discovery_domain (list) If this variable is read-only (config: false) in the source YANG file, then _set_isns_discovery_domain is considered as a private ...
def setVerticalAxis(self, axis): """ Sets the vertical axis for this chart. :param axis | <XChartAxis> """ self._verticalAxis = axis if axis: axis.setOrientation(Qt.Vertical) self.uiYAxisVIEW.setFixedWidth(axis.minimumLabelWi...
Sets the vertical axis for this chart. :param axis | <XChartAxis>
Below is the the instruction that describes the task: ### Input: Sets the vertical axis for this chart. :param axis | <XChartAxis> ### Response: def setVerticalAxis(self, axis): """ Sets the vertical axis for this chart. :param axis | <XChartAxis> ...
def block_similarity(self, block_a, block_b): """ :param block_a: The first block address. :param block_b: The second block address. :returns: The similarity of the basic blocks, normalized for the base address of the block and function call addresses. ...
:param block_a: The first block address. :param block_b: The second block address. :returns: The similarity of the basic blocks, normalized for the base address of the block and function call addresses.
Below is the the instruction that describes the task: ### Input: :param block_a: The first block address. :param block_b: The second block address. :returns: The similarity of the basic blocks, normalized for the base address of the block and function call addresses. ##...
def rotate_exif(self): """ Rotate image via exif information. Only 90, 180 and 270 rotations are supported. """ exif = self.image._getexif() or {} rotation = exif.get(TAGS['Orientation'], 1) rotations = { 6: -90, 3: -180, 8: -2...
Rotate image via exif information. Only 90, 180 and 270 rotations are supported.
Below is the the instruction that describes the task: ### Input: Rotate image via exif information. Only 90, 180 and 270 rotations are supported. ### Response: def rotate_exif(self): """ Rotate image via exif information. Only 90, 180 and 270 rotations are supported. """ ...
def _read_theta(self, dt): """ Used by :func:`.from_mallet` to reconstruct theta posterior distributions. Returns ------- td : Numpy array Rows are documents, columns are topics. Rows sum to ~1. """ self.theta = FeatureSet() with ope...
Used by :func:`.from_mallet` to reconstruct theta posterior distributions. Returns ------- td : Numpy array Rows are documents, columns are topics. Rows sum to ~1.
Below is the the instruction that describes the task: ### Input: Used by :func:`.from_mallet` to reconstruct theta posterior distributions. Returns ------- td : Numpy array Rows are documents, columns are topics. Rows sum to ~1. ### Response: def _read_theta(self, dt): ...
def get_sid_string(principal): ''' Converts a PySID object to a string SID. Args: principal(str): The principal to lookup the sid. Must be a PySID object. Returns: str: A string sid Usage: .. code-block:: python # Get a PySID object py_sid = salt...
Converts a PySID object to a string SID. Args: principal(str): The principal to lookup the sid. Must be a PySID object. Returns: str: A string sid Usage: .. code-block:: python # Get a PySID object py_sid = salt.utils.win_dacl.get_sid('jsnuffy') ...
Below is the the instruction that describes the task: ### Input: Converts a PySID object to a string SID. Args: principal(str): The principal to lookup the sid. Must be a PySID object. Returns: str: A string sid Usage: .. code-block:: python # Get a PySID ob...
def start(self, wait=60, *, server_settings={}, **opts): """Start the cluster.""" status = self.get_status() if status == 'running': return elif status == 'not-initialized': raise ClusterError( 'cluster in {!r} has not been initialized'.format( ...
Start the cluster.
Below is the the instruction that describes the task: ### Input: Start the cluster. ### Response: def start(self, wait=60, *, server_settings={}, **opts): """Start the cluster.""" status = self.get_status() if status == 'running': return elif status == 'not-initialized':...
def _publish_connection(self, name=None): """Return the connection to publish. If the name is not specified, the connection associated with the current message is returned. :param str name: :rtype: rejected.process.Connection """ try: conn = self._connection...
Return the connection to publish. If the name is not specified, the connection associated with the current message is returned. :param str name: :rtype: rejected.process.Connection
Below is the the instruction that describes the task: ### Input: Return the connection to publish. If the name is not specified, the connection associated with the current message is returned. :param str name: :rtype: rejected.process.Connection ### Response: def _publish_connection(self, ...
def wait_for_compactions(self, timeout=120): """ Wait for all compactions to finish on this node. """ pattern = re.compile("pending tasks: 0") start = time.time() while time.time() - start < timeout: output, err, rc = self.nodetool("compactionstats") ...
Wait for all compactions to finish on this node.
Below is the the instruction that describes the task: ### Input: Wait for all compactions to finish on this node. ### Response: def wait_for_compactions(self, timeout=120): """ Wait for all compactions to finish on this node. """ pattern = re.compile("pending tasks: 0") star...
def _reset_lazymodule(module, cls_attrs): """Resets a module's lazy state from cached data. """ modclass = type(module) del modclass.__getattribute__ del modclass.__setattr__ try: del modclass._LOADING except AttributeError: pass for cls_attr in _CLS_ATTRS: try: ...
Resets a module's lazy state from cached data.
Below is the the instruction that describes the task: ### Input: Resets a module's lazy state from cached data. ### Response: def _reset_lazymodule(module, cls_attrs): """Resets a module's lazy state from cached data. """ modclass = type(module) del modclass.__getattribute__ del modclass.__set...
def root (path, root): """ If 'path' is relative, it is rooted at 'root'. Otherwise, it's unchanged. """ if os.path.isabs (path): return path else: return os.path.join (root, path)
If 'path' is relative, it is rooted at 'root'. Otherwise, it's unchanged.
Below is the the instruction that describes the task: ### Input: If 'path' is relative, it is rooted at 'root'. Otherwise, it's unchanged. ### Response: def root (path, root): """ If 'path' is relative, it is rooted at 'root'. Otherwise, it's unchanged. """ if os.path.isabs (path): return path ...
def fetch(self, settlement_id, data={}, **kwargs): """" Fetch Settlement data for given Id Args: settlement_id : Id for which settlement object has to be retrieved Returns: settlement dict for given settlement id """ return super(Settlement, self...
Fetch Settlement data for given Id Args: settlement_id : Id for which settlement object has to be retrieved Returns: settlement dict for given settlement id
Below is the the instruction that describes the task: ### Input: Fetch Settlement data for given Id Args: settlement_id : Id for which settlement object has to be retrieved Returns: settlement dict for given settlement id ### Response: def fetch(self, settlement_id, data={...
def likelihood_weighted_sample(self, evidence=None, size=1, return_type="dataframe"): """ Generates weighted sample(s) from joint distribution of the bayesian network, that comply with the given evidence. 'Probabilistic Graphical Model Principles and Techniques', Koller and Fried...
Generates weighted sample(s) from joint distribution of the bayesian network, that comply with the given evidence. 'Probabilistic Graphical Model Principles and Techniques', Koller and Friedman, Algorithm 12.2 pp 493. Parameters ---------- evidence: list of `pgmpy.factor...
Below is the the instruction that describes the task: ### Input: Generates weighted sample(s) from joint distribution of the bayesian network, that comply with the given evidence. 'Probabilistic Graphical Model Principles and Techniques', Koller and Friedman, Algorithm 12.2 pp 493. ...
def set_mtu(self, name, value=None, default=False, disable=False): """ Configures the interface IP MTU Args: name (string): The interface identifier to apply the interface config to value (integer): The MTU value to set the interface to. Accepted ...
Configures the interface IP MTU Args: name (string): The interface identifier to apply the interface config to value (integer): The MTU value to set the interface to. Accepted values include 68 to 65535 default (bool): Configures the mtu pa...
Below is the the instruction that describes the task: ### Input: Configures the interface IP MTU Args: name (string): The interface identifier to apply the interface config to value (integer): The MTU value to set the interface to. Accepted values i...
def calculate_size(name, index, value): """ Calculates the request payload size""" data_size = 0 data_size += calculate_size_str(name) data_size += INT_SIZE_IN_BYTES data_size += calculate_size_data(value) return data_size
Calculates the request payload size
Below is the the instruction that describes the task: ### Input: Calculates the request payload size ### Response: def calculate_size(name, index, value): """ Calculates the request payload size""" data_size = 0 data_size += calculate_size_str(name) data_size += INT_SIZE_IN_BYTES data_size += c...
def hide_dataset(dataset_id, exceptions, read, write, share,**kwargs): """ Hide a particular piece of data so it can only be seen by its owner. Only an owner can hide (and unhide) data. Data with no owner cannot be hidden. The exceptions paramater lists the usernames of those with p...
Hide a particular piece of data so it can only be seen by its owner. Only an owner can hide (and unhide) data. Data with no owner cannot be hidden. The exceptions paramater lists the usernames of those with permission to view the data read, write and share indicate whether these users c...
Below is the the instruction that describes the task: ### Input: Hide a particular piece of data so it can only be seen by its owner. Only an owner can hide (and unhide) data. Data with no owner cannot be hidden. The exceptions paramater lists the usernames of those with permission to view ...
def get_max_median_position_concentration(positions): """ Finds the max and median long and short position concentrations in each time period specified by the index of positions. Parameters ---------- positions : pd.DataFrame The positions that the strategy takes over time. Returns...
Finds the max and median long and short position concentrations in each time period specified by the index of positions. Parameters ---------- positions : pd.DataFrame The positions that the strategy takes over time. Returns ------- pd.DataFrame Columns are max long, max sh...
Below is the the instruction that describes the task: ### Input: Finds the max and median long and short position concentrations in each time period specified by the index of positions. Parameters ---------- positions : pd.DataFrame The positions that the strategy takes over time. Retu...
def get_day_of_month_description(self): """Generates a description for only the DAYOFMONTH portion of the expression Returns: The DAYOFMONTH description """ expression = self._expression_parts[3] expression = expression.replace("?", "*") if expression == "L...
Generates a description for only the DAYOFMONTH portion of the expression Returns: The DAYOFMONTH description
Below is the the instruction that describes the task: ### Input: Generates a description for only the DAYOFMONTH portion of the expression Returns: The DAYOFMONTH description ### Response: def get_day_of_month_description(self): """Generates a description for only the DAYOFMONTH portio...
def copy_directory_structure(destination_directory, relative_path): """Create all the intermediate directories required for relative_path to exist within destination_directory. This assumes that relative_path is a directory located within root_dir. Examples: destination_directory: /tmp/destination ...
Create all the intermediate directories required for relative_path to exist within destination_directory. This assumes that relative_path is a directory located within root_dir. Examples: destination_directory: /tmp/destination relative_path: test/unit/ will create: /tmp/destination/t...
Below is the the instruction that describes the task: ### Input: Create all the intermediate directories required for relative_path to exist within destination_directory. This assumes that relative_path is a directory located within root_dir. Examples: destination_directory: /tmp/destination ...
def p_function_call_variable(p): 'function_call : variable_without_objects LPAREN function_call_parameter_list RPAREN' p[0] = ast.FunctionCall(p[1], p[3], lineno=p.lineno(2))
function_call : variable_without_objects LPAREN function_call_parameter_list RPAREN
Below is the the instruction that describes the task: ### Input: function_call : variable_without_objects LPAREN function_call_parameter_list RPAREN ### Response: def p_function_call_variable(p): 'function_call : variable_without_objects LPAREN function_call_parameter_list RPAREN' p[0] = ast.FunctionCall(p...
def get_stp_mst_detail_output_msti_port_configured_root_guard(self, **kwargs): """Auto Generated Code """ config = ET.Element("config") get_stp_mst_detail = ET.Element("get_stp_mst_detail") config = get_stp_mst_detail output = ET.SubElement(get_stp_mst_detail, "output") ...
Auto Generated Code
Below is the the instruction that describes the task: ### Input: Auto Generated Code ### Response: def get_stp_mst_detail_output_msti_port_configured_root_guard(self, **kwargs): """Auto Generated Code """ config = ET.Element("config") get_stp_mst_detail = ET.Element("get_stp_mst_det...
def _init_browser(self): """ Ovveride this method with the appropriate way to prepare a logged in browser. """ self.browser = mechanize.Browser() self.browser.set_handle_robots(False) self.browser.open(self.server_url + "/youraccount/login") self.browser.s...
Ovveride this method with the appropriate way to prepare a logged in browser.
Below is the the instruction that describes the task: ### Input: Ovveride this method with the appropriate way to prepare a logged in browser. ### Response: def _init_browser(self): """ Ovveride this method with the appropriate way to prepare a logged in browser. """ ...