code
stringlengths
75
104k
docstring
stringlengths
1
46.9k
text
stringlengths
164
112k
def reverse(self, start=None, end=None): """Reverse bits in-place. start -- Position of first bit to reverse. Defaults to 0. end -- One past the position of the last bit to reverse. Defaults to self.len. Using on an empty bitstring will have no effect. Raises Va...
Reverse bits in-place. start -- Position of first bit to reverse. Defaults to 0. end -- One past the position of the last bit to reverse. Defaults to self.len. Using on an empty bitstring will have no effect. Raises ValueError if start < 0, end > self.len or end < start...
Below is the the instruction that describes the task: ### Input: Reverse bits in-place. start -- Position of first bit to reverse. Defaults to 0. end -- One past the position of the last bit to reverse. Defaults to self.len. Using on an empty bitstring will have no effect. ...
def novatel_diag_send(self, timeStatus, receiverStatus, solStatus, posType, velType, posSolAge, csFails, force_mavlink1=False): ''' Transmits the diagnostics data from the Novatel OEMStar GPS timeStatus : The Time Status. See Table 8 page 27 Novatel OEMSta...
Transmits the diagnostics data from the Novatel OEMStar GPS timeStatus : The Time Status. See Table 8 page 27 Novatel OEMStar Manual (uint8_t) receiverStatus : Status Bitfield. See table 69 page 350 Novatel OEMstar Manual (uint32_t) solStatus ...
Below is the the instruction that describes the task: ### Input: Transmits the diagnostics data from the Novatel OEMStar GPS timeStatus : The Time Status. See Table 8 page 27 Novatel OEMStar Manual (uint8_t) receiverStatus : Status Bitfield. See table 69 pa...
def CreateRetryTask(self): """Creates a task that to retry a previously abandoned task. Returns: Task: a task that was abandoned but should be retried or None if there are no abandoned tasks that should be retried. """ with self._lock: abandoned_task = self._GetTaskPendingRetry() ...
Creates a task that to retry a previously abandoned task. Returns: Task: a task that was abandoned but should be retried or None if there are no abandoned tasks that should be retried.
Below is the the instruction that describes the task: ### Input: Creates a task that to retry a previously abandoned task. Returns: Task: a task that was abandoned but should be retried or None if there are no abandoned tasks that should be retried. ### Response: def CreateRetryTask(self): ...
def get_block(self, block_identifier: BlockSpecification) -> Dict: """Given a block number, query the chain to get its corresponding block hash""" return self.web3.eth.getBlock(block_identifier)
Given a block number, query the chain to get its corresponding block hash
Below is the the instruction that describes the task: ### Input: Given a block number, query the chain to get its corresponding block hash ### Response: def get_block(self, block_identifier: BlockSpecification) -> Dict: """Given a block number, query the chain to get its corresponding block hash""" ...
def _create_broker(self, broker_id, metadata=None): """Create a broker object and assign to a replication group. A broker object with no metadata is considered inactive. An inactive broker may or may not belong to a group. """ broker = Broker(broker_id, metadata) if not m...
Create a broker object and assign to a replication group. A broker object with no metadata is considered inactive. An inactive broker may or may not belong to a group.
Below is the the instruction that describes the task: ### Input: Create a broker object and assign to a replication group. A broker object with no metadata is considered inactive. An inactive broker may or may not belong to a group. ### Response: def _create_broker(self, broker_id, metadata=None): ...
def check_meta(pfeed, *, as_df=False, include_warnings=False): """ Analog of :func:`check_frequencies` for ``pfeed.meta`` """ table = 'meta' problems = [] # Preliminary checks if pfeed.meta is None: problems.append(['error', 'Missing table', table, []]) else: f = pfeed.m...
Analog of :func:`check_frequencies` for ``pfeed.meta``
Below is the the instruction that describes the task: ### Input: Analog of :func:`check_frequencies` for ``pfeed.meta`` ### Response: def check_meta(pfeed, *, as_df=False, include_warnings=False): """ Analog of :func:`check_frequencies` for ``pfeed.meta`` """ table = 'meta' problems = [] #...
def is_valid_interval(interval): """Checks if the given interval is valid. A valid interval is always a positive, non-zero integer value. """ if not isinstance(interval, (int, long)): return False if interval <= 0: return False return True
Checks if the given interval is valid. A valid interval is always a positive, non-zero integer value.
Below is the the instruction that describes the task: ### Input: Checks if the given interval is valid. A valid interval is always a positive, non-zero integer value. ### Response: def is_valid_interval(interval): """Checks if the given interval is valid. A valid interval is always a positive, non-zero...
def __get_windows_path(self): """Return the path with \ as the path separator, regardless of platform.""" if OS_SEP == '\\': return self else: entry = self.get() r = entry.get_path().replace(OS_SEP, '\\') return SCons.Subst.SpecialAttrWrapp...
Return the path with \ as the path separator, regardless of platform.
Below is the the instruction that describes the task: ### Input: Return the path with \ as the path separator, regardless of platform. ### Response: def __get_windows_path(self): """Return the path with \ as the path separator, regardless of platform.""" if OS_SEP == '\\': ...
def path(self, value): """ Setter for **self.__path** attribute. :param value: Attribute value. :type value: unicode """ if value is not None: assert type(value) is unicode, "'{0}' attribute: '{1}' type is not 'unicode'!".format( "path", valu...
Setter for **self.__path** attribute. :param value: Attribute value. :type value: unicode
Below is the the instruction that describes the task: ### Input: Setter for **self.__path** attribute. :param value: Attribute value. :type value: unicode ### Response: def path(self, value): """ Setter for **self.__path** attribute. :param value: Attribute value. ...
def digest(dna, restriction_enzyme): '''Restriction endonuclease reaction. :param dna: DNA template to digest. :type dna: coral.DNA :param restriction_site: Restriction site to use. :type restriction_site: RestrictionSite :returns: list of digested DNA fragments. :rtype: coral.DNA list ...
Restriction endonuclease reaction. :param dna: DNA template to digest. :type dna: coral.DNA :param restriction_site: Restriction site to use. :type restriction_site: RestrictionSite :returns: list of digested DNA fragments. :rtype: coral.DNA list
Below is the the instruction that describes the task: ### Input: Restriction endonuclease reaction. :param dna: DNA template to digest. :type dna: coral.DNA :param restriction_site: Restriction site to use. :type restriction_site: RestrictionSite :returns: list of digested DNA fragments. :r...
def set_key(cls, k, v): """Allows attaching stateless information to the class using the flask session dict """ k = cls.__name__ + "__" + k session[k] = v
Allows attaching stateless information to the class using the flask session dict
Below is the the instruction that describes the task: ### Input: Allows attaching stateless information to the class using the flask session dict ### Response: def set_key(cls, k, v): """Allows attaching stateless information to the class using the flask session dict """ k =...
def twoDimensionalHistogram(title, title_x, title_y, z, bins_x, bins_y, lim_x=None, lim_y=None, vmin=None, vmax=None): """ Create a two-dimension histogram plot or binned map. If using the outputs of np.histogram2d, remembe...
Create a two-dimension histogram plot or binned map. If using the outputs of np.histogram2d, remember to transpose the histogram. INPUTS
Below is the the instruction that describes the task: ### Input: Create a two-dimension histogram plot or binned map. If using the outputs of np.histogram2d, remember to transpose the histogram. INPUTS ### Response: def twoDimensionalHistogram(title, title_x, title_y, z, bins_...
def patch(self, url, data=None, **kwargs): """ Shorthand for self.oauth_request(url, 'patch') :param str url: url to send patch oauth request to :param dict data: patch data to update the service :param kwargs: extra params to send to request api :return: Response of the request...
Shorthand for self.oauth_request(url, 'patch') :param str url: url to send patch oauth request to :param dict data: patch data to update the service :param kwargs: extra params to send to request api :return: Response of the request :rtype: requests.Response
Below is the the instruction that describes the task: ### Input: Shorthand for self.oauth_request(url, 'patch') :param str url: url to send patch oauth request to :param dict data: patch data to update the service :param kwargs: extra params to send to request api :return: Response ...
def cli_tempurl(context, method, path, seconds=None, use_container=False): """ Generates a TempURL and sends that to the context.io_manager's stdout. See :py:mod:`swiftly.cli.tempurl` for context usage information. See :py:class:`CLITempURL` for more information. :param context: The :py:class...
Generates a TempURL and sends that to the context.io_manager's stdout. See :py:mod:`swiftly.cli.tempurl` for context usage information. See :py:class:`CLITempURL` for more information. :param context: The :py:class:`swiftly.cli.context.CLIContext` to use. :param method: The method for the...
Below is the the instruction that describes the task: ### Input: Generates a TempURL and sends that to the context.io_manager's stdout. See :py:mod:`swiftly.cli.tempurl` for context usage information. See :py:class:`CLITempURL` for more information. :param context: The :py:class:`swiftly.cli.cont...
def u_probs(self): """Probability P(x_i==1|Non-match) as described in the FS framework.""" log_u = self.kernel.feature_log_prob_[self._nonmatch_class_pos()] return self._prob_inverse_transform(numpy.exp(log_u))
Probability P(x_i==1|Non-match) as described in the FS framework.
Below is the the instruction that describes the task: ### Input: Probability P(x_i==1|Non-match) as described in the FS framework. ### Response: def u_probs(self): """Probability P(x_i==1|Non-match) as described in the FS framework.""" log_u = self.kernel.feature_log_prob_[self._nonmatch_class_pos(...
def vis_init(self): ''' Sends the state of the BTC at the time the visualizer connects, initializing it. ''' init_dict = {} init_dict['kind'] = 'init' assert len(self.want_file_pos) == len(self.heads_and_tails) init_dict['want_file_pos'] = self.want_file_p...
Sends the state of the BTC at the time the visualizer connects, initializing it.
Below is the the instruction that describes the task: ### Input: Sends the state of the BTC at the time the visualizer connects, initializing it. ### Response: def vis_init(self): ''' Sends the state of the BTC at the time the visualizer connects, initializing it. ''' ...
def posterior_predictive_to_xarray(self): """Convert posterior_predictive samples to xarray.""" posterior = self.posterior posterior_model = self.posterior_model posterior_predictive = self.posterior_predictive data = get_draws_stan3(posterior, model=posterior_model, variabl...
Convert posterior_predictive samples to xarray.
Below is the the instruction that describes the task: ### Input: Convert posterior_predictive samples to xarray. ### Response: def posterior_predictive_to_xarray(self): """Convert posterior_predictive samples to xarray.""" posterior = self.posterior posterior_model = self.posterior_model...
def session_end(self): """ End a session. Se session_begin for an in depth description of TREZOR sessions. """ self.session_depth -= 1 self.session_depth = max(0, self.session_depth) if self.session_depth == 0: self._session_end()
End a session. Se session_begin for an in depth description of TREZOR sessions.
Below is the the instruction that describes the task: ### Input: End a session. Se session_begin for an in depth description of TREZOR sessions. ### Response: def session_end(self): """ End a session. Se session_begin for an in depth description of TREZOR sessions. """ self.sessio...
def span(self): """Return a contiguous range that is a superset of this range. Returns: A VersionRange object representing the span of this range. For example, the span of "2+<4|6+<8" would be "2+<8". """ other = VersionRange(None) bound = _Bound(self.bou...
Return a contiguous range that is a superset of this range. Returns: A VersionRange object representing the span of this range. For example, the span of "2+<4|6+<8" would be "2+<8".
Below is the the instruction that describes the task: ### Input: Return a contiguous range that is a superset of this range. Returns: A VersionRange object representing the span of this range. For example, the span of "2+<4|6+<8" would be "2+<8". ### Response: def span(self): ...
def set_libs_flags(self, env, arch): '''Takes care to properly link libraries with python depending on our requirements and the attribute :attr:`opt_depends`. ''' def add_flags(include_flags, link_dirs, link_libs): env['CPPFLAGS'] = env.get('CPPFLAGS', '') + include_flags ...
Takes care to properly link libraries with python depending on our requirements and the attribute :attr:`opt_depends`.
Below is the the instruction that describes the task: ### Input: Takes care to properly link libraries with python depending on our requirements and the attribute :attr:`opt_depends`. ### Response: def set_libs_flags(self, env, arch): '''Takes care to properly link libraries with python depending o...
def minion_mods( opts, context=None, utils=None, whitelist=None, initial_load=False, loaded_base_name=None, notify=False, static_modules=None, proxy=None): ''' Load execution modules Returns a dictionary of execution modules appropriat...
Load execution modules Returns a dictionary of execution modules appropriate for the current system by evaluating the __virtual__() function in each module. :param dict opts: The Salt options dictionary :param dict context: A Salt context that should be made present inside ...
Below is the the instruction that describes the task: ### Input: Load execution modules Returns a dictionary of execution modules appropriate for the current system by evaluating the __virtual__() function in each module. :param dict opts: The Salt options dictionary :param dict context: A Salt c...
def get_last_response_xml(self, pretty_print_if_possible=False): """ Retrieves the raw XML (decrypted) of the last SAML response, or the last Logout Response generated or processed :returns: SAML response XML :rtype: string|None """ response = None if sel...
Retrieves the raw XML (decrypted) of the last SAML response, or the last Logout Response generated or processed :returns: SAML response XML :rtype: string|None
Below is the the instruction that describes the task: ### Input: Retrieves the raw XML (decrypted) of the last SAML response, or the last Logout Response generated or processed :returns: SAML response XML :rtype: string|None ### Response: def get_last_response_xml(self, pretty_print_if_pos...
def validate_ENUM(in_value, restriction): """ Test to ensure that the given value is contained in the provided list. the value parameter must be either a single value or a 1-dimensional list. All the values in this list must satisfy the ENUM """ value = _get_val(in_value) if type...
Test to ensure that the given value is contained in the provided list. the value parameter must be either a single value or a 1-dimensional list. All the values in this list must satisfy the ENUM
Below is the the instruction that describes the task: ### Input: Test to ensure that the given value is contained in the provided list. the value parameter must be either a single value or a 1-dimensional list. All the values in this list must satisfy the ENUM ### Response: def validate_ENUM(in_val...
def _newline_end_of_file(relative_path, contents, linter_options): r"""Check that every file ends with a single \n.""" del relative_path del linter_options last_line = len(contents) - 1 if not len(contents) or not contents[last_line].endswith("\n"): if len(contents): last_line_re...
r"""Check that every file ends with a single \n.
Below is the the instruction that describes the task: ### Input: r"""Check that every file ends with a single \n. ### Response: def _newline_end_of_file(relative_path, contents, linter_options): r"""Check that every file ends with a single \n.""" del relative_path del linter_options last_line = len...
def dao_fork_at(dao_fork_block_number: BlockNumber, chain_class: Type[BaseChain]) -> Type[BaseChain]: """ Set the block number on which the DAO fork will happen. Requires that a version of the :class:`~eth.vm.forks.homestead.HomesteadVM` is present in the chain's ``vm_configuration`` ...
Set the block number on which the DAO fork will happen. Requires that a version of the :class:`~eth.vm.forks.homestead.HomesteadVM` is present in the chain's ``vm_configuration``
Below is the the instruction that describes the task: ### Input: Set the block number on which the DAO fork will happen. Requires that a version of the :class:`~eth.vm.forks.homestead.HomesteadVM` is present in the chain's ``vm_configuration`` ### Response: def dao_fork_at(dao_fork_block_number: BlockNumb...
def format(self, result): """Generate plain text report. :return: Report body :rtype: str """ m = self.meta lines = ['-' * len(self.TITLE), self.TITLE, '-' * len(self.TITLE), "Compared: {db1} <-> {db2}".format(**m), ...
Generate plain text report. :return: Report body :rtype: str
Below is the the instruction that describes the task: ### Input: Generate plain text report. :return: Report body :rtype: str ### Response: def format(self, result): """Generate plain text report. :return: Report body :rtype: str """ m = self.meta l...
def delete_variant(self, variant): """Delete observation in database This means that we take down the observations variable with one. If 'observations' == 1 we remove the variant. If variant was homozygote we decrease 'homozygote' with one. Also remove the family from array 'fam...
Delete observation in database This means that we take down the observations variable with one. If 'observations' == 1 we remove the variant. If variant was homozygote we decrease 'homozygote' with one. Also remove the family from array 'families'. Args: variant (di...
Below is the the instruction that describes the task: ### Input: Delete observation in database This means that we take down the observations variable with one. If 'observations' == 1 we remove the variant. If variant was homozygote we decrease 'homozygote' with one. Also remove the...
def _find_controller(self, *args): ''' Returns the appropriate controller for routing a custom action. ''' for name in args: obj = self._lookup_child(name) if obj and iscontroller(obj): return obj return None
Returns the appropriate controller for routing a custom action.
Below is the the instruction that describes the task: ### Input: Returns the appropriate controller for routing a custom action. ### Response: def _find_controller(self, *args): ''' Returns the appropriate controller for routing a custom action. ''' for name in args: obj...
def getCachedOrUpdatedValue(self, key): """ Gets the device's value with the given key. If the key is not found in the cache, the value is queried from the host. """ try: return self._VALUES[key] except KeyError: return self.getValue(key)
Gets the device's value with the given key. If the key is not found in the cache, the value is queried from the host.
Below is the the instruction that describes the task: ### Input: Gets the device's value with the given key. If the key is not found in the cache, the value is queried from the host. ### Response: def getCachedOrUpdatedValue(self, key): """ Gets the device's value with the given key. If t...
def fit(self, X, y=None): """Fit X into an embedded space. Optionally use y for supervised dimension reduction. Parameters ---------- X : array, shape (n_samples, n_features) or (n_samples, n_samples) If the metric is 'precomputed' X must be a square distance ...
Fit X into an embedded space. Optionally use y for supervised dimension reduction. Parameters ---------- X : array, shape (n_samples, n_features) or (n_samples, n_samples) If the metric is 'precomputed' X must be a square distance matrix. Otherwise it contains a...
Below is the the instruction that describes the task: ### Input: Fit X into an embedded space. Optionally use y for supervised dimension reduction. Parameters ---------- X : array, shape (n_samples, n_features) or (n_samples, n_samples) If the metric is 'precomputed' X ...
def mavlink_packet(self, m): '''handle an incoming mavlink packet''' if m.get_type() == "ADSB_VEHICLE": id = 'ADSB-' + str(m.ICAO_address) if id not in self.threat_vehicles.keys(): # check to see if the vehicle is in the dict # if not then add it ...
handle an incoming mavlink packet
Below is the the instruction that describes the task: ### Input: handle an incoming mavlink packet ### Response: def mavlink_packet(self, m): '''handle an incoming mavlink packet''' if m.get_type() == "ADSB_VEHICLE": id = 'ADSB-' + str(m.ICAO_address) if id not in self.threa...
def terminate(self): """Terminates an active session""" self._backend_client.clear() self._needs_save = False self._started = False self._expire_cookie = True self._send_cookie = True
Terminates an active session
Below is the the instruction that describes the task: ### Input: Terminates an active session ### Response: def terminate(self): """Terminates an active session""" self._backend_client.clear() self._needs_save = False self._started = False self._expire_cookie = True ...
def PointCollection(mode="raw", *args, **kwargs): """ mode: string - "raw" (speed: fastest, size: small, output: ugly) - "agg" (speed: fast, size: small, output: beautiful) """ if mode == "raw": return RawPointCollection(*args, **kwargs) return AggPointCollection(*args,...
mode: string - "raw" (speed: fastest, size: small, output: ugly) - "agg" (speed: fast, size: small, output: beautiful)
Below is the the instruction that describes the task: ### Input: mode: string - "raw" (speed: fastest, size: small, output: ugly) - "agg" (speed: fast, size: small, output: beautiful) ### Response: def PointCollection(mode="raw", *args, **kwargs): """ mode: string - "raw" (speed...
def _request_reports(self, resource_param_name, resources, endpoint_name): """Sends multiples requests for the resources to a particular endpoint. Args: resource_param_name: a string name of the resource parameter. resources: list of of the resources. endpoint_name: ...
Sends multiples requests for the resources to a particular endpoint. Args: resource_param_name: a string name of the resource parameter. resources: list of of the resources. endpoint_name: VirusTotal endpoint URL suffix. Returns: A list of the responses.
Below is the the instruction that describes the task: ### Input: Sends multiples requests for the resources to a particular endpoint. Args: resource_param_name: a string name of the resource parameter. resources: list of of the resources. endpoint_name: VirusTotal endpoi...
def B(self): """ Effect-sizes parameter, B. """ return unvec(self._vecB.value, (self.X.shape[1], self.A.shape[0]))
Effect-sizes parameter, B.
Below is the the instruction that describes the task: ### Input: Effect-sizes parameter, B. ### Response: def B(self): """ Effect-sizes parameter, B. """ return unvec(self._vecB.value, (self.X.shape[1], self.A.shape[0]))
def evaluate(self, x, y, x_derivative=0, smooth=0, simple='auto'): """ this evaluates the 2-d spline by doing linear interpolation of the curves """ if simple=='auto': simple = self.simple # find which values y is in between for n in range(0, len(self.y_va...
this evaluates the 2-d spline by doing linear interpolation of the curves
Below is the the instruction that describes the task: ### Input: this evaluates the 2-d spline by doing linear interpolation of the curves ### Response: def evaluate(self, x, y, x_derivative=0, smooth=0, simple='auto'): """ this evaluates the 2-d spline by doing linear interpolation of the cu...
def authors(self): """A list of namedtuples storing author information, where each namedtuple corresponds to one author. The information in each namedtuple is (name surname initials id url). All entries are strings. """ out = [] order = 'name surname initials id u...
A list of namedtuples storing author information, where each namedtuple corresponds to one author. The information in each namedtuple is (name surname initials id url). All entries are strings.
Below is the the instruction that describes the task: ### Input: A list of namedtuples storing author information, where each namedtuple corresponds to one author. The information in each namedtuple is (name surname initials id url). All entries are strings. ### Response: def authors(self):...
def parse_sections(self, offset): """Fetch the PE file sections. The sections will be readily available in the "sections" attribute. Its attributes will contain all the section information plus "data" a buffer containing the section's data. The "Characteristics" member will be ...
Fetch the PE file sections. The sections will be readily available in the "sections" attribute. Its attributes will contain all the section information plus "data" a buffer containing the section's data. The "Characteristics" member will be processed and attributes representing...
Below is the the instruction that describes the task: ### Input: Fetch the PE file sections. The sections will be readily available in the "sections" attribute. Its attributes will contain all the section information plus "data" a buffer containing the section's data. The "Characte...
def _init_horizontal(self): """Create and grid the widgets for a horizontal orientation.""" self.scale.grid(row=0, sticky='ew') padx1, padx2 = 0, 0 pady1, pady2 = 0, 0 # showvalue if self._showvalue: self.label.configure(text=self._formatter.format(self._start...
Create and grid the widgets for a horizontal orientation.
Below is the the instruction that describes the task: ### Input: Create and grid the widgets for a horizontal orientation. ### Response: def _init_horizontal(self): """Create and grid the widgets for a horizontal orientation.""" self.scale.grid(row=0, sticky='ew') padx1, padx2 = 0, 0 ...
def tradingStatusDF(symbol=None, token='', version=''): '''The Trading status message is used to indicate the current trading status of a security. For IEX-listed securities, IEX acts as the primary market and has the authority to institute a trading halt or trading pause in a security due to news disseminatio...
The Trading status message is used to indicate the current trading status of a security. For IEX-listed securities, IEX acts as the primary market and has the authority to institute a trading halt or trading pause in a security due to news dissemination or regulatory reasons. For non-IEX-listed securities, IE...
Below is the the instruction that describes the task: ### Input: The Trading status message is used to indicate the current trading status of a security. For IEX-listed securities, IEX acts as the primary market and has the authority to institute a trading halt or trading pause in a security due to news dissem...
def to_hising(self): """Construct a higher-order Ising problem from a binary polynomial. Returns: tuple: A 3-tuple of the form (`h`, `J`, `offset`) where `h` includes the linear biases, `J` has the higher-order biases and `offset` is the linear offset. Examp...
Construct a higher-order Ising problem from a binary polynomial. Returns: tuple: A 3-tuple of the form (`h`, `J`, `offset`) where `h` includes the linear biases, `J` has the higher-order biases and `offset` is the linear offset. Examples: >>> poly = dimo...
Below is the the instruction that describes the task: ### Input: Construct a higher-order Ising problem from a binary polynomial. Returns: tuple: A 3-tuple of the form (`h`, `J`, `offset`) where `h` includes the linear biases, `J` has the higher-order biases and `offset` is ...
def tf_baseline_loss(self, states, internals, reward, update, reference=None): """ Creates the TensorFlow operations for calculating the baseline loss of a batch. Args: states: Dict of state tensors. internals: List of prior internal state tensors. reward: Re...
Creates the TensorFlow operations for calculating the baseline loss of a batch. Args: states: Dict of state tensors. internals: List of prior internal state tensors. reward: Reward tensor. update: Boolean tensor indicating whether this call happens during an upda...
Below is the the instruction that describes the task: ### Input: Creates the TensorFlow operations for calculating the baseline loss of a batch. Args: states: Dict of state tensors. internals: List of prior internal state tensors. reward: Reward tensor. updat...
def get_biopax_stmts(self, filter=False, query='pathsbetween', database_filter=None): """Get relevant statements from Pathway Commons. Performs a "paths between" query for the genes in :py:attr:`gene_list` and uses the results to build statements. This function caches t...
Get relevant statements from Pathway Commons. Performs a "paths between" query for the genes in :py:attr:`gene_list` and uses the results to build statements. This function caches two files: the list of statements built from the query, which is cached in `<basename>_biopax_stmts.pkl`, a...
Below is the the instruction that describes the task: ### Input: Get relevant statements from Pathway Commons. Performs a "paths between" query for the genes in :py:attr:`gene_list` and uses the results to build statements. This function caches two files: the list of statements built from t...
def load(name_or_file): """ Loads a sol file and returns a L{SOL} object. @param name_or_file: Name of file, or file-object. @type name_or_file: C{string} """ f = name_or_file opened = False if isinstance(name_or_file, basestring): f = open(name_or_file, 'rb') opened = ...
Loads a sol file and returns a L{SOL} object. @param name_or_file: Name of file, or file-object. @type name_or_file: C{string}
Below is the the instruction that describes the task: ### Input: Loads a sol file and returns a L{SOL} object. @param name_or_file: Name of file, or file-object. @type name_or_file: C{string} ### Response: def load(name_or_file): """ Loads a sol file and returns a L{SOL} object. @param name_o...
def search_files(self, search=None): """ Search for files, returning a FileRecord for each result. FileRecords have two additional methods patched into them, get_url() and download_to(file_name), which will retrieve the URL for the file content and download that content to a named file o...
Search for files, returning a FileRecord for each result. FileRecords have two additional methods patched into them, get_url() and download_to(file_name), which will retrieve the URL for the file content and download that content to a named file on disk, respectively. :param FileRecordSearch se...
Below is the the instruction that describes the task: ### Input: Search for files, returning a FileRecord for each result. FileRecords have two additional methods patched into them, get_url() and download_to(file_name), which will retrieve the URL for the file content and download that content to a ...
def get_contradiction_summary(graph: BELGraph) -> Iterable[Tuple[BaseEntity, BaseEntity, str]]: """Yield triplets of (source node, target node, set of relations) for (source node, target node) pairs that have multiple, contradictory relations. """ for u, v in set(graph.edges()): relations = {dat...
Yield triplets of (source node, target node, set of relations) for (source node, target node) pairs that have multiple, contradictory relations.
Below is the the instruction that describes the task: ### Input: Yield triplets of (source node, target node, set of relations) for (source node, target node) pairs that have multiple, contradictory relations. ### Response: def get_contradiction_summary(graph: BELGraph) -> Iterable[Tuple[BaseEntity, BaseEntity...
def find_bled112_devices(cls): """Look for BLED112 dongles on this computer and start an instance on each one""" found_devs = [] ports = serial.tools.list_ports.comports() for port in ports: if not hasattr(port, 'pid') or not hasattr(port, 'vid'): continue ...
Look for BLED112 dongles on this computer and start an instance on each one
Below is the the instruction that describes the task: ### Input: Look for BLED112 dongles on this computer and start an instance on each one ### Response: def find_bled112_devices(cls): """Look for BLED112 dongles on this computer and start an instance on each one""" found_devs = [] ports ...
def get_insns(cls = None): """ Get all Instructions. This is based on all known subclasses of `cls`. If non is given, all Instructions are returned. Only such instructions are returned that can be generated, i.e., that have a mnemonic, opcode, etc. So other classes in the hierarchy are not matched. ...
Get all Instructions. This is based on all known subclasses of `cls`. If non is given, all Instructions are returned. Only such instructions are returned that can be generated, i.e., that have a mnemonic, opcode, etc. So other classes in the hierarchy are not matched. :param cls: Base class to get list ...
Below is the the instruction that describes the task: ### Input: Get all Instructions. This is based on all known subclasses of `cls`. If non is given, all Instructions are returned. Only such instructions are returned that can be generated, i.e., that have a mnemonic, opcode, etc. So other classes in the h...
def add_observer(self, callback): """Add an observer to this event. Args: callback: A function or coroutine callback to call when the event is fired. Raises: ValueError: If the callback has already been added. """ if callback in self._obs...
Add an observer to this event. Args: callback: A function or coroutine callback to call when the event is fired. Raises: ValueError: If the callback has already been added.
Below is the the instruction that describes the task: ### Input: Add an observer to this event. Args: callback: A function or coroutine callback to call when the event is fired. Raises: ValueError: If the callback has already been added. ### Response: def a...
def srv_data(url, token, data, kind): """Serve data to RainbowAlga""" ws = websocket.create_connection(url) message = {'token': token, 'data': data, 'kind': kind} ws.send(pd.io.json.dumps(message)) ws.close()
Serve data to RainbowAlga
Below is the the instruction that describes the task: ### Input: Serve data to RainbowAlga ### Response: def srv_data(url, token, data, kind): """Serve data to RainbowAlga""" ws = websocket.create_connection(url) message = {'token': token, 'data': data, 'kind': kind} ws.send(pd.io.json.dumps(messag...
def distArrayFactory(BaseClass): """ Returns a distributed array class that derives from BaseClass @param BaseClass base class, e.g. numpy.ndarray or numpy.ma.masked_array @return dist array class """ class DistArrayAny(BaseClass): """ Distributed array. Each process owns data a...
Returns a distributed array class that derives from BaseClass @param BaseClass base class, e.g. numpy.ndarray or numpy.ma.masked_array @return dist array class
Below is the the instruction that describes the task: ### Input: Returns a distributed array class that derives from BaseClass @param BaseClass base class, e.g. numpy.ndarray or numpy.ma.masked_array @return dist array class ### Response: def distArrayFactory(BaseClass): """ Returns a distributed a...
def get_branch_mutation_matrix(self, node, full_sequence=False): """uses results from marginal ancestral inference to return a joint distribution of the sequence states at both ends of the branch. Parameters ---------- node : Phylo.clade node of the tree full...
uses results from marginal ancestral inference to return a joint distribution of the sequence states at both ends of the branch. Parameters ---------- node : Phylo.clade node of the tree full_sequence : bool, optional expand the sequence to the full seque...
Below is the the instruction that describes the task: ### Input: uses results from marginal ancestral inference to return a joint distribution of the sequence states at both ends of the branch. Parameters ---------- node : Phylo.clade node of the tree full_sequen...
def numericise_all(input, empty2zero=False, default_blank="", allow_underscores_in_numeric_literals=False): """Returns a list of numericised values from strings""" return [numericise(s, empty2zero, default_blank, allow_underscores_in_numeric_literals) for s in input]
Returns a list of numericised values from strings
Below is the the instruction that describes the task: ### Input: Returns a list of numericised values from strings ### Response: def numericise_all(input, empty2zero=False, default_blank="", allow_underscores_in_numeric_literals=False): """Returns a list of numericised values from strings""" return [numeri...
def delete(self): # type () -> () """Delete this property. :return: None :raises APIError: if delete was not successful """ r = self._client._request('DELETE', self._client._build_url('property', property_id=self.id)) if r.status_code != requests.codes.no_conten...
Delete this property. :return: None :raises APIError: if delete was not successful
Below is the the instruction that describes the task: ### Input: Delete this property. :return: None :raises APIError: if delete was not successful ### Response: def delete(self): # type () -> () """Delete this property. :return: None :raises APIError: if delete wa...
def _needs_download(self, f): ''' Decorator used to make sure that the downloading happens prior to running the task. ''' @wraps(f) def wrapper(self, *args, **kwargs): if not self.isdownloaded(): self.download() return f(self, *args, **kwargs) return wrapper
Decorator used to make sure that the downloading happens prior to running the task.
Below is the the instruction that describes the task: ### Input: Decorator used to make sure that the downloading happens prior to running the task. ### Response: def _needs_download(self, f): ''' Decorator used to make sure that the downloading happens prior to running the task. ''' @wraps(f) def wrapper(s...
def rpc_get_name_DID(self, name, **con_info): """ Given a name or subdomain, return its DID. """ did_info = None if check_name(name): did_info = self.get_name_DID_info(name) elif check_subdomain(name): did_info = self.get_subdomain_DID_info(name) ...
Given a name or subdomain, return its DID.
Below is the the instruction that describes the task: ### Input: Given a name or subdomain, return its DID. ### Response: def rpc_get_name_DID(self, name, **con_info): """ Given a name or subdomain, return its DID. """ did_info = None if check_name(name): did_inf...
def inside_brain(stat_dset,atlas=None,p=0.001): '''calculates the percentage of voxels above a statistical threshold inside a brain mask vs. outside it if ``atlas`` is ``None``, it will try to find ``TT_N27``''' atlas = find_atlas(atlas) if atlas==None: return None mask_dset = nl.suffix...
calculates the percentage of voxels above a statistical threshold inside a brain mask vs. outside it if ``atlas`` is ``None``, it will try to find ``TT_N27``
Below is the the instruction that describes the task: ### Input: calculates the percentage of voxels above a statistical threshold inside a brain mask vs. outside it if ``atlas`` is ``None``, it will try to find ``TT_N27`` ### Response: def inside_brain(stat_dset,atlas=None,p=0.001): '''calculates the...
def predict(self, choosers, alternatives, debug=False): """ Choose from among alternatives for a group of agents after segmenting the `choosers` table. Parameters ---------- choosers : pandas.DataFrame Table describing the agents making choices, e.g. househol...
Choose from among alternatives for a group of agents after segmenting the `choosers` table. Parameters ---------- choosers : pandas.DataFrame Table describing the agents making choices, e.g. households. Must have a column matching the .segmentation_col attribute....
Below is the the instruction that describes the task: ### Input: Choose from among alternatives for a group of agents after segmenting the `choosers` table. Parameters ---------- choosers : pandas.DataFrame Table describing the agents making choices, e.g. households. ...
async def edit(self, *args, **kwargs): """ Edits the message iff it's outgoing. Shorthand for `telethon.client.messages.MessageMethods.edit_message` with both ``entity`` and ``message`` already set. Returns ``None`` if the message was incoming, or the edited `Message` ot...
Edits the message iff it's outgoing. Shorthand for `telethon.client.messages.MessageMethods.edit_message` with both ``entity`` and ``message`` already set. Returns ``None`` if the message was incoming, or the edited `Message` otherwise. .. note:: This is different ...
Below is the the instruction that describes the task: ### Input: Edits the message iff it's outgoing. Shorthand for `telethon.client.messages.MessageMethods.edit_message` with both ``entity`` and ``message`` already set. Returns ``None`` if the message was incoming, or the edited `M...
def upcoming_shabbat(self): """Return the HDate for either the upcoming or current Shabbat. If it is currently Shabbat, returns the HDate of the Saturday. """ if self.is_shabbat: return self # If it's Sunday, fast forward to the next Shabbat. saturday = self....
Return the HDate for either the upcoming or current Shabbat. If it is currently Shabbat, returns the HDate of the Saturday.
Below is the the instruction that describes the task: ### Input: Return the HDate for either the upcoming or current Shabbat. If it is currently Shabbat, returns the HDate of the Saturday. ### Response: def upcoming_shabbat(self): """Return the HDate for either the upcoming or current Shabbat. ...
def encode_request(uuid, address, interrupt): """ Encode request into client_message""" client_message = ClientMessage(payload_size=calculate_size(uuid, address, interrupt)) client_message.set_message_type(REQUEST_TYPE) client_message.set_retryable(RETRYABLE) client_message.append_str(uuid) Addr...
Encode request into client_message
Below is the the instruction that describes the task: ### Input: Encode request into client_message ### Response: def encode_request(uuid, address, interrupt): """ Encode request into client_message""" client_message = ClientMessage(payload_size=calculate_size(uuid, address, interrupt)) client_message....
def prepare_node(data): """Prepare node for catalog endpoint Parameters: data (Union[str, dict]): Node ID or node definition Returns: Tuple[str, dict]: where first is ID and second is node definition Extract from /v1/health/service/<service>:: { "Node": { ...
Prepare node for catalog endpoint Parameters: data (Union[str, dict]): Node ID or node definition Returns: Tuple[str, dict]: where first is ID and second is node definition Extract from /v1/health/service/<service>:: { "Node": { "Node": "foobar", ...
Below is the the instruction that describes the task: ### Input: Prepare node for catalog endpoint Parameters: data (Union[str, dict]): Node ID or node definition Returns: Tuple[str, dict]: where first is ID and second is node definition Extract from /v1/health/service/<service>:: ...
def get_words(self): """ Returns the document words. :return: Document words. :rtype: list """ words = [] block = self.document().findBlockByLineNumber(0) while block.isValid(): blockWords = foundations.strings.get_words(foundations.strings.t...
Returns the document words. :return: Document words. :rtype: list
Below is the the instruction that describes the task: ### Input: Returns the document words. :return: Document words. :rtype: list ### Response: def get_words(self): """ Returns the document words. :return: Document words. :rtype: list """ words = ...
def noise3d(self, x, y, z): """ Generate 3D OpenSimplex noise from X,Y,Z coordinates. """ # Place input coordinates on simplectic honeycomb. stretch_offset = (x + y + z) * STRETCH_CONSTANT_3D xs = x + stretch_offset ys = y + stretch_offset zs = z + stretch...
Generate 3D OpenSimplex noise from X,Y,Z coordinates.
Below is the the instruction that describes the task: ### Input: Generate 3D OpenSimplex noise from X,Y,Z coordinates. ### Response: def noise3d(self, x, y, z): """ Generate 3D OpenSimplex noise from X,Y,Z coordinates. """ # Place input coordinates on simplectic honeycomb. s...
def issues(self, from_date=DEFAULT_DATETIME, offset=None, max_issues=MAX_ISSUES): """Get the information of a list of issues. :param from_date: retrieve issues that where updated from that date; dates are converted to UTC :param offset: starting position for the searc...
Get the information of a list of issues. :param from_date: retrieve issues that where updated from that date; dates are converted to UTC :param offset: starting position for the search :param max_issues: maximum number of issues to reteurn per query
Below is the the instruction that describes the task: ### Input: Get the information of a list of issues. :param from_date: retrieve issues that where updated from that date; dates are converted to UTC :param offset: starting position for the search :param max_issues: maximum nu...
def average_true_range_percent(close_data, period): """ Average True Range Percent. Formula: ATRP = (ATR / CLOSE) * 100 """ catch_errors.check_for_period_error(close_data, period) atrp = (atr(close_data, period) / np.array(close_data)) * 100 return atrp
Average True Range Percent. Formula: ATRP = (ATR / CLOSE) * 100
Below is the the instruction that describes the task: ### Input: Average True Range Percent. Formula: ATRP = (ATR / CLOSE) * 100 ### Response: def average_true_range_percent(close_data, period): """ Average True Range Percent. Formula: ATRP = (ATR / CLOSE) * 100 """ catch_errors.c...
def show_input(self, template_helper, language, seed): """ Show FileBox """ header = ParsableText(self.gettext(language, self._header), "rst", translation=self._translations.get(language, gettext.NullTranslations())) return str(DisplayableFileProblem.get_renderer(te...
Show FileBox
Below is the the instruction that describes the task: ### Input: Show FileBox ### Response: def show_input(self, template_helper, language, seed): """ Show FileBox """ header = ParsableText(self.gettext(language, self._header), "rst", translation=self._translations.get...
def _build_tree(self, actor, content): """ Builds the tree for the given actor. :param actor: the actor to process :type actor: Actor :param content: the rows of the tree collected so far :type content: list """ depth = actor.depth row = "" ...
Builds the tree for the given actor. :param actor: the actor to process :type actor: Actor :param content: the rows of the tree collected so far :type content: list
Below is the the instruction that describes the task: ### Input: Builds the tree for the given actor. :param actor: the actor to process :type actor: Actor :param content: the rows of the tree collected so far :type content: list ### Response: def _build_tree(self, actor, content):...
def summary(self, CorpNum, JobID, Type, TaxType, PurposeType, TaxRegIDType, TaxRegIDYN, TaxRegID, UserID=None): """ 수집 결과 요약정보 조회 args CorpNum : 팝빌회원 사업자번호 JobID : 작업아이디 Type : 문서형태 배열, N-일반전자세금계산서, M-수정전자세금계산서 TaxType : 과세형태 배열, T-과세, ...
수집 결과 요약정보 조회 args CorpNum : 팝빌회원 사업자번호 JobID : 작업아이디 Type : 문서형태 배열, N-일반전자세금계산서, M-수정전자세금계산서 TaxType : 과세형태 배열, T-과세, N-면세, Z-영세 PurposeType : 영수/청구, R-영수, C-청구, N-없음 TaxRegIDType : 종사업장번호 사업자유형, S-공급자, B-공급받는자...
Below is the the instruction that describes the task: ### Input: 수집 결과 요약정보 조회 args CorpNum : 팝빌회원 사업자번호 JobID : 작업아이디 Type : 문서형태 배열, N-일반전자세금계산서, M-수정전자세금계산서 TaxType : 과세형태 배열, T-과세, N-면세, Z-영세 PurposeType : 영수/청구, R-영수, C...
def merge(self, other): """Merge another translation into this catalog.""" if not getattr(other, '_catalog', None): return # NullTranslations() has no _catalog if self._catalog is None: # Take plural and _info from first catalog found self.plural = other.plur...
Merge another translation into this catalog.
Below is the the instruction that describes the task: ### Input: Merge another translation into this catalog. ### Response: def merge(self, other): """Merge another translation into this catalog.""" if not getattr(other, '_catalog', None): return # NullTranslations() has no _catalog ...
def _unpack_header(self, data): """ Unpacks the header of given byte string. """ return struct.unpack(self._struct_header, data[:self._struct_header_size])
Unpacks the header of given byte string.
Below is the the instruction that describes the task: ### Input: Unpacks the header of given byte string. ### Response: def _unpack_header(self, data): """ Unpacks the header of given byte string. """ return struct.unpack(self._struct_header, data[:self....
def update(self, yaml_dict): ''' Update the content (i.e. keys and values) with yaml_dict. ''' def _update_node(base_node, update_node): if isinstance(update_node, YAMLDict) or \ isinstance(update_node, dict): if not (isinstance(base_node, YAMLDict...
Update the content (i.e. keys and values) with yaml_dict.
Below is the the instruction that describes the task: ### Input: Update the content (i.e. keys and values) with yaml_dict. ### Response: def update(self, yaml_dict): ''' Update the content (i.e. keys and values) with yaml_dict. ''' def _update_node(base_node, update_node): if is...
def add_composite_field(self, name, field): """ Add a dynamic composite field to the already existing ones and initialize it appropriatly. """ self.composite_fields[name] = field self._init_composite_field(name, field)
Add a dynamic composite field to the already existing ones and initialize it appropriatly.
Below is the the instruction that describes the task: ### Input: Add a dynamic composite field to the already existing ones and initialize it appropriatly. ### Response: def add_composite_field(self, name, field): """ Add a dynamic composite field to the already existing ones and in...
def filter(self, record: logging.LogRecord): """ Extend LogRecord by data from Telegram Update object. :param record: :return: """ update = types.Update.get_current(True) if update: for key, value in self.make_prefix(self.prefix, self.process_update(u...
Extend LogRecord by data from Telegram Update object. :param record: :return:
Below is the the instruction that describes the task: ### Input: Extend LogRecord by data from Telegram Update object. :param record: :return: ### Response: def filter(self, record: logging.LogRecord): """ Extend LogRecord by data from Telegram Update object. :param record...
def buy_close(id_or_ins, amount, price=None, style=None, close_today=False): """ 平卖仓 :param id_or_ins: 下单标的物 :type id_or_ins: :class:`~Instrument` object | `str` | List[:class:`~Instrument`] | List[`str`] :param int amount: 下单手数 :param float price: 下单价格,默认为None,表示 :class:`~MarketOrder`, 此参数主要...
平卖仓 :param id_or_ins: 下单标的物 :type id_or_ins: :class:`~Instrument` object | `str` | List[:class:`~Instrument`] | List[`str`] :param int amount: 下单手数 :param float price: 下单价格,默认为None,表示 :class:`~MarketOrder`, 此参数主要用于简化 `style` 参数。 :param style: 下单类型, 默认是市价单。目前支持的订单类型有 :class:`~LimitOrder` 和 :class...
Below is the the instruction that describes the task: ### Input: 平卖仓 :param id_or_ins: 下单标的物 :type id_or_ins: :class:`~Instrument` object | `str` | List[:class:`~Instrument`] | List[`str`] :param int amount: 下单手数 :param float price: 下单价格,默认为None,表示 :class:`~MarketOrder`, 此参数主要用于简化 `style` 参数。 ...
def full_name(self): """ You can get full name of user. :return: str """ full_name = self.first_name if self.last_name: full_name += ' ' + self.last_name return full_name
You can get full name of user. :return: str
Below is the the instruction that describes the task: ### Input: You can get full name of user. :return: str ### Response: def full_name(self): """ You can get full name of user. :return: str """ full_name = self.first_name if self.last_name: fu...
def setup_regex(self): """Sets up the patterns and compiled regex objects for parsing types.""" #Regex for matching the entire body of the type and getting top-level modifiers. self._RX_TYPE = r"\n\s*type(?P<modifiers>,\s+(public|private))?(\s*::)?\s+(?P<name>[A-Za-z0-9_]+)" + \ ...
Sets up the patterns and compiled regex objects for parsing types.
Below is the the instruction that describes the task: ### Input: Sets up the patterns and compiled regex objects for parsing types. ### Response: def setup_regex(self): """Sets up the patterns and compiled regex objects for parsing types.""" #Regex for matching the entire body of the type and getti...
def collectstatic(force=False): """ collect static files for production httpd If run with ``settings.DEBUG==True``, this is a no-op unless ``force`` is set to ``True`` """ # noise reduction: only collectstatic if not in debug mode from django.conf import settings if force or not setting...
collect static files for production httpd If run with ``settings.DEBUG==True``, this is a no-op unless ``force`` is set to ``True``
Below is the the instruction that describes the task: ### Input: collect static files for production httpd If run with ``settings.DEBUG==True``, this is a no-op unless ``force`` is set to ``True`` ### Response: def collectstatic(force=False): """ collect static files for production httpd If r...
def check_fill_value_outside_valid_range(self, ds): ''' Checks each variable's _FillValue to ensure that it's in valid_range or between valid_min and valid_max according to CF §2.5.1 CF §2.5.1 The _FillValue should be outside the range specified by valid_range (if used) for a va...
Checks each variable's _FillValue to ensure that it's in valid_range or between valid_min and valid_max according to CF §2.5.1 CF §2.5.1 The _FillValue should be outside the range specified by valid_range (if used) for a variable. :param netCDF4.Dataset ds: An open netCDF dataset ...
Below is the the instruction that describes the task: ### Input: Checks each variable's _FillValue to ensure that it's in valid_range or between valid_min and valid_max according to CF §2.5.1 CF §2.5.1 The _FillValue should be outside the range specified by valid_range (if used) for a varia...
def es_read(self, log_id, offset): """ Returns the logs matching log_id in Elasticsearch and next offset. Returns '' if no log is found or there was an error. :param log_id: the log_id of the log to read. :type log_id: str :param offset: the offset start to read log from....
Returns the logs matching log_id in Elasticsearch and next offset. Returns '' if no log is found or there was an error. :param log_id: the log_id of the log to read. :type log_id: str :param offset: the offset start to read log from. :type offset: str
Below is the the instruction that describes the task: ### Input: Returns the logs matching log_id in Elasticsearch and next offset. Returns '' if no log is found or there was an error. :param log_id: the log_id of the log to read. :type log_id: str :param offset: the offset start to ...
def team_players(self, team): """Store output of team players to a CSV file""" headers = ['Jersey Number', 'Name', 'Position', 'Nationality', 'Date of Birth'] result = [headers] result.extend([player['shirtNumber'], player['name'], ...
Store output of team players to a CSV file
Below is the the instruction that describes the task: ### Input: Store output of team players to a CSV file ### Response: def team_players(self, team): """Store output of team players to a CSV file""" headers = ['Jersey Number', 'Name', 'Position', 'Nationality', 'Date of Birth']...
def fit(self, X, y=None, **kwargs): """ Fits the PCA transformer, transforms the data in X, then draws the decomposition in either 2D or 3D space as a scatter plot. Parameters ---------- X : ndarray or DataFrame of shape n x m A matrix of n instances with m f...
Fits the PCA transformer, transforms the data in X, then draws the decomposition in either 2D or 3D space as a scatter plot. Parameters ---------- X : ndarray or DataFrame of shape n x m A matrix of n instances with m features. y : ndarray or Series of length n ...
Below is the the instruction that describes the task: ### Input: Fits the PCA transformer, transforms the data in X, then draws the decomposition in either 2D or 3D space as a scatter plot. Parameters ---------- X : ndarray or DataFrame of shape n x m A matrix of n insta...
def set_custom_values(self, key, values): """Set several values for the customParameter with the given key. We append one GSCustomParameter per value. """ for value in values: self.set_custom_value(key, value)
Set several values for the customParameter with the given key. We append one GSCustomParameter per value.
Below is the the instruction that describes the task: ### Input: Set several values for the customParameter with the given key. We append one GSCustomParameter per value. ### Response: def set_custom_values(self, key, values): """Set several values for the customParameter with the given key. ...
def _base_get_list(self, url, limit=None, *, query=None, order_by=None, batch=None): """ Returns a collection of drive items """ if limit is None or limit > self.protocol.max_top_value: batch = self.protocol.max_top_value params = {'$top': batch if batch else...
Returns a collection of drive items
Below is the the instruction that describes the task: ### Input: Returns a collection of drive items ### Response: def _base_get_list(self, url, limit=None, *, query=None, order_by=None, batch=None): """ Returns a collection of drive items """ if limit is None or limit > sel...
def _get_result(self): """ get the result """ info = {} self.options2attr = { 'email': self._email, 'telephone': self._telephone, 'QQ' : self._QQ, 'wechat': self._wechat, 'url': self._url, 'emoji': self._emo...
get the result
Below is the the instruction that describes the task: ### Input: get the result ### Response: def _get_result(self): """ get the result """ info = {} self.options2attr = { 'email': self._email, 'telephone': self._telephone, 'QQ' : self._Q...
def gen_columns_info(engine: Engine, tablename: str) -> Generator[SqlaColumnInspectionInfo, None, None]: """ For the specified table, generate column information as :class:`SqlaColumnInspectionInfo` objects. """ # Dictionary stru...
For the specified table, generate column information as :class:`SqlaColumnInspectionInfo` objects.
Below is the the instruction that describes the task: ### Input: For the specified table, generate column information as :class:`SqlaColumnInspectionInfo` objects. ### Response: def gen_columns_info(engine: Engine, tablename: str) -> Generator[SqlaColumnInspectionInfo, ...
def __read_stored_routine_metadata(self): """ Reads the metadata of stored routines from the metadata file. """ if os.path.isfile(self._pystratum_metadata_filename): with open(self._pystratum_metadata_filename, 'r') as file: self._pystratum_metadata = json.loa...
Reads the metadata of stored routines from the metadata file.
Below is the the instruction that describes the task: ### Input: Reads the metadata of stored routines from the metadata file. ### Response: def __read_stored_routine_metadata(self): """ Reads the metadata of stored routines from the metadata file. """ if os.path.isfile(self._pystra...
def convert_to_coarse(data,chan_per_coarse): ''' Converts a data array with length n_chans to an array of length n_coarse_chans by averaging over the coarse channels ''' #find number of coarse channels and reshape array num_coarse = data.size/chan_per_coarse data_shaped = np.array(np.reshape...
Converts a data array with length n_chans to an array of length n_coarse_chans by averaging over the coarse channels
Below is the the instruction that describes the task: ### Input: Converts a data array with length n_chans to an array of length n_coarse_chans by averaging over the coarse channels ### Response: def convert_to_coarse(data,chan_per_coarse): ''' Converts a data array with length n_chans to an array of l...
def get_values(): """ Get dictionary of values from the backend :return: """ # First load a mapping between config name and default value default_initial = ((name, options[0]) for name, options in settings.CONFIG.items()) # Then update the mapping with actually values...
Get dictionary of values from the backend :return:
Below is the the instruction that describes the task: ### Input: Get dictionary of values from the backend :return: ### Response: def get_values(): """ Get dictionary of values from the backend :return: """ # First load a mapping between config name and default value default_initial = ...
def domain(self, expparams): """ Returns a list of ``Domain``s, one for each input expparam. :param numpy.ndarray expparams: Array of experimental parameters. This array must be of dtype agreeing with the ``expparams_dtype`` property, or, in the case where ``n_outcomes_...
Returns a list of ``Domain``s, one for each input expparam. :param numpy.ndarray expparams: Array of experimental parameters. This array must be of dtype agreeing with the ``expparams_dtype`` property, or, in the case where ``n_outcomes_constant`` is ``True``, ``None`` shou...
Below is the the instruction that describes the task: ### Input: Returns a list of ``Domain``s, one for each input expparam. :param numpy.ndarray expparams: Array of experimental parameters. This array must be of dtype agreeing with the ``expparams_dtype`` property, or, in the case...
def phantom_decorate(f, get_or_add): """ Decorator for version-dependent fields. If get_or_add is True (means get), we return s, self.phantom_value. If it is False (means add), we return s. """ def wrapper(*args): self, pkt, s = args[:3] if phantom_mode(pkt): if get_o...
Decorator for version-dependent fields. If get_or_add is True (means get), we return s, self.phantom_value. If it is False (means add), we return s.
Below is the the instruction that describes the task: ### Input: Decorator for version-dependent fields. If get_or_add is True (means get), we return s, self.phantom_value. If it is False (means add), we return s. ### Response: def phantom_decorate(f, get_or_add): """ Decorator for version-dependen...
def _makes_clone(_func, *args, **kw): """ A decorator that returns a clone of the current object so that we can re-use the object for similar requests. """ self = args[0]._clone() _func(self, *args[1:], **kw) return self
A decorator that returns a clone of the current object so that we can re-use the object for similar requests.
Below is the the instruction that describes the task: ### Input: A decorator that returns a clone of the current object so that we can re-use the object for similar requests. ### Response: def _makes_clone(_func, *args, **kw): """ A decorator that returns a clone of the current object so that we ca...
def add_parameter(self, field_name, param_name, param_value): """ Add a parameter to a field into script_fields The ScriptFields object will be returned, so calls to this can be chained. """ try: self.fields[field_name]['params'][param_name] = param_value exc...
Add a parameter to a field into script_fields The ScriptFields object will be returned, so calls to this can be chained.
Below is the the instruction that describes the task: ### Input: Add a parameter to a field into script_fields The ScriptFields object will be returned, so calls to this can be chained. ### Response: def add_parameter(self, field_name, param_name, param_value): """ Add a parameter to a fie...
def finish_assessment(self, assessment_taken_id): """Indicates the entire assessment is complete. arg: assessment_taken_id (osid.id.Id): ``Id`` of the ``AssessmentTaken`` raise: IllegalState - ``has_begun()`` is ``false or is_over()`` is ``true`` rais...
Indicates the entire assessment is complete. arg: assessment_taken_id (osid.id.Id): ``Id`` of the ``AssessmentTaken`` raise: IllegalState - ``has_begun()`` is ``false or is_over()`` is ``true`` raise: NotFound - ``assessment_taken_id`` is not found r...
Below is the the instruction that describes the task: ### Input: Indicates the entire assessment is complete. arg: assessment_taken_id (osid.id.Id): ``Id`` of the ``AssessmentTaken`` raise: IllegalState - ``has_begun()`` is ``false or is_over()`` is ``true`` ...
def tf_step(self, time, variables, **kwargs): """ Creates the TensorFlow operations for performing an optimization step. Args: time: Time tensor. variables: List of variables to optimize. **kwargs: Additional arguments passed on to the internal optimizer. ...
Creates the TensorFlow operations for performing an optimization step. Args: time: Time tensor. variables: List of variables to optimize. **kwargs: Additional arguments passed on to the internal optimizer. Returns: List of delta tensors corresponding to ...
Below is the the instruction that describes the task: ### Input: Creates the TensorFlow operations for performing an optimization step. Args: time: Time tensor. variables: List of variables to optimize. **kwargs: Additional arguments passed on to the internal optimizer. ...
def set_state_view(self, request): """ Changes the experiment state """ if not request.user.has_perm('experiments.change_experiment'): return HttpResponseForbidden() try: state = int(request.POST.get("state", "")) except ValueError: re...
Changes the experiment state
Below is the the instruction that describes the task: ### Input: Changes the experiment state ### Response: def set_state_view(self, request): """ Changes the experiment state """ if not request.user.has_perm('experiments.change_experiment'): return HttpResponseForbidden...
def _from_binary_attrlist_e(cls, binary_stream): """See base class.""" ''' Attribute type - 4 Length of a particular entry - 2 Length of the name - 1 (in characters) Offset to name - 1 Starting VCN - 8 File reference - 8 Attribute ID - 1 Name (unic...
See base class.
Below is the the instruction that describes the task: ### Input: See base class. ### Response: def _from_binary_attrlist_e(cls, binary_stream): """See base class.""" ''' Attribute type - 4 Length of a particular entry - 2 Length of the name - 1 (in characters) Offset to name...
def serialize(expr): """Serialize input expr into a parsable value. :rtype: str""" result = None if isinstance(expr, string_types): result = expr elif expr is not None: result = '=py:{0}'.format(expr) return result
Serialize input expr into a parsable value. :rtype: str
Below is the the instruction that describes the task: ### Input: Serialize input expr into a parsable value. :rtype: str ### Response: def serialize(expr): """Serialize input expr into a parsable value. :rtype: str""" result = None if isinstance(expr, string_types): result = expr ...
def ArcTan(input_vertex: vertex_constructor_param_types, label: Optional[str]=None) -> Vertex: """ Takes the inverse tan of a vertex, Arctan(vertex) :param input_vertex: the vertex """ return Double(context.jvm_view().ArcTanVertex, label, cast_to_double_vertex(input_vertex))
Takes the inverse tan of a vertex, Arctan(vertex) :param input_vertex: the vertex
Below is the the instruction that describes the task: ### Input: Takes the inverse tan of a vertex, Arctan(vertex) :param input_vertex: the vertex ### Response: def ArcTan(input_vertex: vertex_constructor_param_types, label: Optional[str]=None) -> Vertex: """ Takes the inverse tan of a vertex, Arc...
def get(self, section, key, default=MANIFEST_NULL_KEY): """ Returns the value if it exist, or default if default is set """ if not self.manifest.has_option(section, key) and default is not MANIFEST_NULL_KEY: return default return self.manifest.get(section, key)
Returns the value if it exist, or default if default is set
Below is the the instruction that describes the task: ### Input: Returns the value if it exist, or default if default is set ### Response: def get(self, section, key, default=MANIFEST_NULL_KEY): """ Returns the value if it exist, or default if default is set """ if not self.manifest.has_option(sect...