code
stringlengths
75
104k
docstring
stringlengths
1
46.9k
text
stringlengths
164
112k
def update_firmware_nfs_or_cifs(filename, share, host=None, admin_username=None, admin_password=None): ''' Executes the following for CIFS (using username and password stored in the pillar data) .. code-bloc...
Executes the following for CIFS (using username and password stored in the pillar data) .. code-block:: bash racadm update -f <updatefile> -u user –p pass -l //IP-Address/share Or for NFS (using username and password stored in the pillar data) .. code-block:: bash racadm upda...
Below is the the instruction that describes the task: ### Input: Executes the following for CIFS (using username and password stored in the pillar data) .. code-block:: bash racadm update -f <updatefile> -u user –p pass -l //IP-Address/share Or for NFS (using username and password stored...
def _extents(self): """ A (cx, cy) 2-tuple representing the effective rendering area for text within this text frame when margins are taken into account. """ return ( self._parent.width - self.margin_left - self.margin_right, self._parent.height - self.mar...
A (cx, cy) 2-tuple representing the effective rendering area for text within this text frame when margins are taken into account.
Below is the the instruction that describes the task: ### Input: A (cx, cy) 2-tuple representing the effective rendering area for text within this text frame when margins are taken into account. ### Response: def _extents(self): """ A (cx, cy) 2-tuple representing the effective rendering ar...
def get_webhook_url(deployment_name, space='default', data_source='webhook', token_manager=None, app_url=defaults.APP_URL, **fields): """ return the webhook URL for posting webhook data to """ import_ur...
return the webhook URL for posting webhook data to
Below is the the instruction that describes the task: ### Input: return the webhook URL for posting webhook data to ### Response: def get_webhook_url(deployment_name, space='default', data_source='webhook', token_manager=None, app_url=...
def POST_AUTH(self, courseid, aggregationid=''): # pylint: disable=arguments-differ """ Edit a aggregation """ course, __ = self.get_course_and_check_rights(courseid, allow_all_staff=True) if course.is_lti(): raise web.notfound() msg='' error = False errore...
Edit a aggregation
Below is the the instruction that describes the task: ### Input: Edit a aggregation ### Response: def POST_AUTH(self, courseid, aggregationid=''): # pylint: disable=arguments-differ """ Edit a aggregation """ course, __ = self.get_course_and_check_rights(courseid, allow_all_staff=True) if...
def validate_config_value(value, possible_values): """ Validate a config value to make sure it is one of the possible values. Args: value: the config value to validate. possible_values: the possible values the value can be Raises: Exception if the value is not one of possible values. """ if valu...
Validate a config value to make sure it is one of the possible values. Args: value: the config value to validate. possible_values: the possible values the value can be Raises: Exception if the value is not one of possible values.
Below is the the instruction that describes the task: ### Input: Validate a config value to make sure it is one of the possible values. Args: value: the config value to validate. possible_values: the possible values the value can be Raises: Exception if the value is not one of possible values. ###...
def _main(): """\ Usage: tabulate [options] [FILE ...] Pretty-print tabular data. See also https://bitbucket.org/astanin/python-tabulate FILE a filename of the file with tabular data; if "-" or missing, read data from stdin. Options: -h,...
\ Usage: tabulate [options] [FILE ...] Pretty-print tabular data. See also https://bitbucket.org/astanin/python-tabulate FILE a filename of the file with tabular data; if "-" or missing, read data from stdin. Options: -h, --help ...
Below is the the instruction that describes the task: ### Input: \ Usage: tabulate [options] [FILE ...] Pretty-print tabular data. See also https://bitbucket.org/astanin/python-tabulate FILE a filename of the file with tabular data; if "-" or miss...
def get_package(self, feed_id, package_id, include_all_versions=None, include_urls=None, is_listed=None, is_release=None, include_deleted=None, include_description=None): """GetPackage. [Preview API] Get details about a specific package. :param str feed_id: Name or Id of the feed. :param...
GetPackage. [Preview API] Get details about a specific package. :param str feed_id: Name or Id of the feed. :param str package_id: The package Id (GUID Id, not the package name). :param bool include_all_versions: True to return all versions of the package in the response. Default is fal...
Below is the the instruction that describes the task: ### Input: GetPackage. [Preview API] Get details about a specific package. :param str feed_id: Name or Id of the feed. :param str package_id: The package Id (GUID Id, not the package name). :param bool include_all_versions: True t...
def get_progress_percentage(self, ar_brain): """Returns the percentage of completeness of the Analysis Request """ review_state = ar_brain.review_state if review_state == "published": return 100 numbers = ar_brain.getAnalysesNum num_analyses = numbers[1] or ...
Returns the percentage of completeness of the Analysis Request
Below is the the instruction that describes the task: ### Input: Returns the percentage of completeness of the Analysis Request ### Response: def get_progress_percentage(self, ar_brain): """Returns the percentage of completeness of the Analysis Request """ review_state = ar_brain.review_sta...
def validate_parameters(self, method, args, kwargs): """Verify that `*args` and `**kwargs` are appropriate parameters for `method`. :param method: A callable. :param args: List of positional arguments for `method` :param kwargs: Keyword arguments for `method` :raises ~tinyrpc.ex...
Verify that `*args` and `**kwargs` are appropriate parameters for `method`. :param method: A callable. :param args: List of positional arguments for `method` :param kwargs: Keyword arguments for `method` :raises ~tinyrpc.exc.InvalidParamsError: Raised when the provided argum...
Below is the the instruction that describes the task: ### Input: Verify that `*args` and `**kwargs` are appropriate parameters for `method`. :param method: A callable. :param args: List of positional arguments for `method` :param kwargs: Keyword arguments for `method` :raises ~tinyr...
def coord_features(objectinfo): '''Calculates object coordinates features, including: - galactic coordinates - total proper motion from pmra, pmdecl - reduced J proper motion from propermotion and Jmag Parameters ---------- objectinfo : dict This is an objectinfo dict from a ligh...
Calculates object coordinates features, including: - galactic coordinates - total proper motion from pmra, pmdecl - reduced J proper motion from propermotion and Jmag Parameters ---------- objectinfo : dict This is an objectinfo dict from a light curve file read into an `lcdic...
Below is the the instruction that describes the task: ### Input: Calculates object coordinates features, including: - galactic coordinates - total proper motion from pmra, pmdecl - reduced J proper motion from propermotion and Jmag Parameters ---------- objectinfo : dict This is a...
def round_sigfigs(x, n=2): """ Rounds the number to the specified significant figures. x can also be a list or array of numbers (in these cases, a numpy array is returned). """ iterable = is_iterable(x) if not iterable: x = [x] # make a copy to be safe x = _n.array(x) # loop o...
Rounds the number to the specified significant figures. x can also be a list or array of numbers (in these cases, a numpy array is returned).
Below is the the instruction that describes the task: ### Input: Rounds the number to the specified significant figures. x can also be a list or array of numbers (in these cases, a numpy array is returned). ### Response: def round_sigfigs(x, n=2): """ Rounds the number to the specified significant fig...
def _status_response(self, response_class, issuer, status, sign=False, sign_alg=None, digest_alg=None, **kwargs): """ Create a StatusResponse. :param response_class: Which subclass of StatusResponse that should be used :param issuer:...
Create a StatusResponse. :param response_class: Which subclass of StatusResponse that should be used :param issuer: The issuer of the response message :param status: The return status of the response operation :param sign: Whether the response should be signed or not ...
Below is the the instruction that describes the task: ### Input: Create a StatusResponse. :param response_class: Which subclass of StatusResponse that should be used :param issuer: The issuer of the response message :param status: The return status of the response operation ...
def strip_ansi(text, c1=False, osc=False): ''' Strip ANSI escape sequences from a portion of text. https://stackoverflow.com/a/38662876/450917 Arguments: line: str osc: bool - include OSC commands in the strippage. c1: bool - include C1 commands in the strippa...
Strip ANSI escape sequences from a portion of text. https://stackoverflow.com/a/38662876/450917 Arguments: line: str osc: bool - include OSC commands in the strippage. c1: bool - include C1 commands in the strippage. Notes: Enabling c1 and osc...
Below is the the instruction that describes the task: ### Input: Strip ANSI escape sequences from a portion of text. https://stackoverflow.com/a/38662876/450917 Arguments: line: str osc: bool - include OSC commands in the strippage. c1: bool - include C1 comma...
def consume(topic, conf): """ Consume User records """ from confluent_kafka.avro import AvroConsumer from confluent_kafka.avro.serializer import SerializerError print("Consuming user records from topic {} with group {}. ^c to exit.".format(topic, conf["group.id"])) c = AvroConsumer(con...
Consume User records
Below is the the instruction that describes the task: ### Input: Consume User records ### Response: def consume(topic, conf): """ Consume User records """ from confluent_kafka.avro import AvroConsumer from confluent_kafka.avro.serializer import SerializerError print("Consuming user rec...
def run(self): """ Called by internal API subsystem to initialize websockets connections in the API interface """ self.api = self.context.get("cls")(self.context) self.context["inst"].append(self) # Adapters used by strategies def on_ws_connect(*args, **kwargs):...
Called by internal API subsystem to initialize websockets connections in the API interface
Below is the the instruction that describes the task: ### Input: Called by internal API subsystem to initialize websockets connections in the API interface ### Response: def run(self): """ Called by internal API subsystem to initialize websockets connections in the API interface ...
def _reshape_n_vecs(self): """return list of arrays, each array represents a different m mode""" lst = [] sl = slice(None, None, None) lst.append(self.__getitem__((sl, 0))) for m in xrange(1, self.mmax + 1): lst.append(self.__getitem__((sl, -m))) ...
return list of arrays, each array represents a different m mode
Below is the the instruction that describes the task: ### Input: return list of arrays, each array represents a different m mode ### Response: def _reshape_n_vecs(self): """return list of arrays, each array represents a different m mode""" lst = [] sl = slice(None, None, None) ...
def get_contributors(self): """Return a list of contributors with contributions between the start/end dates.""" return User.objects.filter( freelanceprofile__is_freelance=True ).filter( contributions__content__published__gte=self.start, contributions__content_...
Return a list of contributors with contributions between the start/end dates.
Below is the the instruction that describes the task: ### Input: Return a list of contributors with contributions between the start/end dates. ### Response: def get_contributors(self): """Return a list of contributors with contributions between the start/end dates.""" return User.objects.filter( ...
def apply(self, macro): """ Show what a macro would do Zendesk API `Reference <https://developer.zendesk.com/rest_api/docs/core/macros#show-changes-to-ticket>`__. :param macro: Macro object or id. """ return self._query_zendesk(self.endpoint.apply, 'result', id=macro)
Show what a macro would do Zendesk API `Reference <https://developer.zendesk.com/rest_api/docs/core/macros#show-changes-to-ticket>`__. :param macro: Macro object or id.
Below is the the instruction that describes the task: ### Input: Show what a macro would do Zendesk API `Reference <https://developer.zendesk.com/rest_api/docs/core/macros#show-changes-to-ticket>`__. :param macro: Macro object or id. ### Response: def apply(self, macro): """ Show w...
def add_tag_to_derived_metric(self, id, tag_value, **kwargs): # noqa: E501 """Add a tag to a specific Derived Metric # noqa: E501 # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread...
Add a tag to a specific Derived Metric # noqa: E501 # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.add_tag_to_derived_metric(id, tag_value, async_req=True) >>> result = th...
Below is the the instruction that describes the task: ### Input: Add a tag to a specific Derived Metric # noqa: E501 # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.add_tag_to_...
def New(Type, columns = None, **kwargs): """ Construct a pre-defined LSC table. The optional columns argument is a sequence of the names of the columns the table should be constructed with. If columns = None, then the table is constructed with all valid columns (use columns = [] to create a table with no column...
Construct a pre-defined LSC table. The optional columns argument is a sequence of the names of the columns the table should be constructed with. If columns = None, then the table is constructed with all valid columns (use columns = [] to create a table with no columns). Example: >>> import sys >>> tbl = New(...
Below is the the instruction that describes the task: ### Input: Construct a pre-defined LSC table. The optional columns argument is a sequence of the names of the columns the table should be constructed with. If columns = None, then the table is constructed with all valid columns (use columns = [] to create a...
def backwards(apps, schema_editor): """ Delete initial recurrence rules. """ RecurrenceRule = apps.get_model('icekit_events', 'RecurrenceRule') descriptions = [d for d, rr in RULES] RecurrenceRule.objects.filter(description__in=descriptions).delete()
Delete initial recurrence rules.
Below is the the instruction that describes the task: ### Input: Delete initial recurrence rules. ### Response: def backwards(apps, schema_editor): """ Delete initial recurrence rules. """ RecurrenceRule = apps.get_model('icekit_events', 'RecurrenceRule') descriptions = [d for d, rr in RULES] ...
def issueCommand(self, command, *args): """ Issue the given Assuan command and return a Deferred that will fire with the response. """ result = Deferred() self._dq.append(result) self.sendLine(b" ".join([command] + list(args))) return result
Issue the given Assuan command and return a Deferred that will fire with the response.
Below is the the instruction that describes the task: ### Input: Issue the given Assuan command and return a Deferred that will fire with the response. ### Response: def issueCommand(self, command, *args): """ Issue the given Assuan command and return a Deferred that will fire with ...
def execution_environment(): """A convenient bundling of the current execution context""" context = {} context['conf'] = config() if relation_id(): context['reltype'] = relation_type() context['relid'] = relation_id() context['rel'] = relation_get() context['unit'] = local_un...
A convenient bundling of the current execution context
Below is the the instruction that describes the task: ### Input: A convenient bundling of the current execution context ### Response: def execution_environment(): """A convenient bundling of the current execution context""" context = {} context['conf'] = config() if relation_id(): context['...
def count_mutations(codon, AA, alleles, counts, nucs, trans_table): """ count types of mutations in codon counts = {'obs syn':#, 'pos syn':#, 'obs non-syn':#, 'pos non-syn':#} """ # find alternative codons based on SNPs obs_codons = [] # codons observed from SNPs for pos, pos_mutations in en...
count types of mutations in codon counts = {'obs syn':#, 'pos syn':#, 'obs non-syn':#, 'pos non-syn':#}
Below is the the instruction that describes the task: ### Input: count types of mutations in codon counts = {'obs syn':#, 'pos syn':#, 'obs non-syn':#, 'pos non-syn':#} ### Response: def count_mutations(codon, AA, alleles, counts, nucs, trans_table): """ count types of mutations in codon counts = {...
def stack_decoders(self, *layers): """ Stack decoding layers. """ self.stack(*layers) self.decoding_layers.extend(layers)
Stack decoding layers.
Below is the the instruction that describes the task: ### Input: Stack decoding layers. ### Response: def stack_decoders(self, *layers): """ Stack decoding layers. """ self.stack(*layers) self.decoding_layers.extend(layers)
def hybrid_forward(self, F, inputs, states=None, mask=None): # pylint: disable=arguments-differ """ Parameters ---------- inputs : NDArray Shape (batch_size, sequence_length, max_character_per_token) of character ids representing the current batch. ...
Parameters ---------- inputs : NDArray Shape (batch_size, sequence_length, max_character_per_token) of character ids representing the current batch. states : (list of list of NDArray, list of list of NDArray) The states. First tuple element is the forward laye...
Below is the the instruction that describes the task: ### Input: Parameters ---------- inputs : NDArray Shape (batch_size, sequence_length, max_character_per_token) of character ids representing the current batch. states : (list of list of NDArray, list of list of NDA...
def _validate_source_data(self): """ :raises ValidationError: """ try: jsonschema.validate(self._buffer, self._schema) except jsonschema.ValidationError as e: raise ValidationError(e)
:raises ValidationError:
Below is the the instruction that describes the task: ### Input: :raises ValidationError: ### Response: def _validate_source_data(self): """ :raises ValidationError: """ try: jsonschema.validate(self._buffer, self._schema) except jsonschema.ValidationError as e:...
def update_role_config_group(self, name, apigroup): """ Update a role config group. @param name: Role config group name. @param apigroup: The updated role config group. @return: The updated ApiRoleConfigGroup object. @since: API v3 """ return role_config_groups.update_role_config_group(...
Update a role config group. @param name: Role config group name. @param apigroup: The updated role config group. @return: The updated ApiRoleConfigGroup object. @since: API v3
Below is the the instruction that describes the task: ### Input: Update a role config group. @param name: Role config group name. @param apigroup: The updated role config group. @return: The updated ApiRoleConfigGroup object. @since: API v3 ### Response: def update_role_config_group(self, name, ap...
def get_console(request, console_type, instance): """Get a tuple of console url and console type.""" if console_type == 'AUTO': check_consoles = CONSOLES else: try: check_consoles = {console_type: CONSOLES[console_type]} except KeyError: msg = _('Console type ...
Get a tuple of console url and console type.
Below is the the instruction that describes the task: ### Input: Get a tuple of console url and console type. ### Response: def get_console(request, console_type, instance): """Get a tuple of console url and console type.""" if console_type == 'AUTO': check_consoles = CONSOLES else: try...
def filter_by_folder(self, include=None, exclude=None): "Only keep filenames in `include` folder or reject the ones in `exclude`." include,exclude = listify(include),listify(exclude) def _inner(o): if isinstance(o, Path): n = o.relative_to(self.path).parts[0] else: n = o....
Only keep filenames in `include` folder or reject the ones in `exclude`.
Below is the the instruction that describes the task: ### Input: Only keep filenames in `include` folder or reject the ones in `exclude`. ### Response: def filter_by_folder(self, include=None, exclude=None): "Only keep filenames in `include` folder or reject the ones in `exclude`." include,exclude ...
def write_data(self, buf): """Send data to the device. :param buf: the data to send. :type buf: list(int) :return: success status. :rtype: bool """ if self.hid.write(buf) != len(buf): raise IOError( 'pywws.device_cython_hidapi.USBD...
Send data to the device. :param buf: the data to send. :type buf: list(int) :return: success status. :rtype: bool
Below is the the instruction that describes the task: ### Input: Send data to the device. :param buf: the data to send. :type buf: list(int) :return: success status. :rtype: bool ### Response: def write_data(self, buf): """Send data to the device. :param buf: th...
def release(): """ Release current version to pypi """ with settings(warn_only=True): r = local(clom.git['diff-files']('--quiet', '--ignore-submodules', '--')) if r.return_code != 0: abort('There are uncommitted changes, commit or stash them before releasing') version = open('...
Release current version to pypi
Below is the the instruction that describes the task: ### Input: Release current version to pypi ### Response: def release(): """ Release current version to pypi """ with settings(warn_only=True): r = local(clom.git['diff-files']('--quiet', '--ignore-submodules', '--')) if r.return_co...
def replace_with(self, other): """ Replace this instance with the given other. Deletes stale Match objects and updates related TextLogErrorMetadatas' best_classifications to point to the given other. """ match_ids_to_delete = list(self.update_matches(other)) Text...
Replace this instance with the given other. Deletes stale Match objects and updates related TextLogErrorMetadatas' best_classifications to point to the given other.
Below is the the instruction that describes the task: ### Input: Replace this instance with the given other. Deletes stale Match objects and updates related TextLogErrorMetadatas' best_classifications to point to the given other. ### Response: def replace_with(self, other): """ Rep...
def filter(self, names): """ Returns a list with the names matching the pattern. """ names = list_strings(names) fnames = [] for f in names: for pat in self.pats: if fnmatch.fnmatch(f, pat): fnames.append(f) return...
Returns a list with the names matching the pattern.
Below is the the instruction that describes the task: ### Input: Returns a list with the names matching the pattern. ### Response: def filter(self, names): """ Returns a list with the names matching the pattern. """ names = list_strings(names) fnames = [] for f in n...
def get_public_ip(access_token, subscription_id, resource_group, ip_name): '''Get details about the named public ip address. Args: access_token (str): A valid Azure authentication token. subscription_id (str): Azure subscription id. resource_group (str): Azure resource group name. ...
Get details about the named public ip address. Args: access_token (str): A valid Azure authentication token. subscription_id (str): Azure subscription id. resource_group (str): Azure resource group name. public_ip_name (str): Name of the public ip address resource. Returns: ...
Below is the the instruction that describes the task: ### Input: Get details about the named public ip address. Args: access_token (str): A valid Azure authentication token. subscription_id (str): Azure subscription id. resource_group (str): Azure resource group name. public_ip_...
async def statistics(self, tube_name=None): """ Returns queue statistics (coroutine) :param tube_name: If specified, statistics by a specific tube is returned, else statistics about all tubes is returned """ args = None if tube_nam...
Returns queue statistics (coroutine) :param tube_name: If specified, statistics by a specific tube is returned, else statistics about all tubes is returned
Below is the the instruction that describes the task: ### Input: Returns queue statistics (coroutine) :param tube_name: If specified, statistics by a specific tube is returned, else statistics about all tubes is returned ### Response: async def statistics(self, tube_nam...
def ip_in_subnet(ip, subnet): """Does IP exists in a given subnet utility. Returns a boolean""" ipaddr = int(''.join(['%02x' % int(x) for x in ip.split('.')]), 16) netstr, bits = subnet.split('/') netaddr = int(''.join(['%02x' % int(x) for x in netstr.split('.')]), 16) mask = (0xffffffff << (32 - in...
Does IP exists in a given subnet utility. Returns a boolean
Below is the the instruction that describes the task: ### Input: Does IP exists in a given subnet utility. Returns a boolean ### Response: def ip_in_subnet(ip, subnet): """Does IP exists in a given subnet utility. Returns a boolean""" ipaddr = int(''.join(['%02x' % int(x) for x in ip.split('.')]), 16) ...
def forward(self, speed=1): """ Drive the motor forwards. :param float speed: The speed at which the motor should turn. Can be any value between 0 (stopped) and the default 1 (maximum speed). """ if isinstance(self.enable_device, DigitalOutputDevice): ...
Drive the motor forwards. :param float speed: The speed at which the motor should turn. Can be any value between 0 (stopped) and the default 1 (maximum speed).
Below is the the instruction that describes the task: ### Input: Drive the motor forwards. :param float speed: The speed at which the motor should turn. Can be any value between 0 (stopped) and the default 1 (maximum speed). ### Response: def forward(self, speed=1): """ ...
def clonetopath(self, dest): """ Clone the repo at <self.pushablepath> into <dest> Note that if self.pushablepath is None, then self.path will be used instead. """ raise Exception( "%s.%s needs to implement @classmethod .clonetopath(dest)" % ( ...
Clone the repo at <self.pushablepath> into <dest> Note that if self.pushablepath is None, then self.path will be used instead.
Below is the the instruction that describes the task: ### Input: Clone the repo at <self.pushablepath> into <dest> Note that if self.pushablepath is None, then self.path will be used instead. ### Response: def clonetopath(self, dest): """ Clone the repo at <self.pushablepath> into <...
def fire_service_event(self, event): """ Notifies service events listeners of a new event in the calling thread. :param event: The service event """ # Get the service properties properties = event.get_service_reference().get_properties() svc_specs = properties[OB...
Notifies service events listeners of a new event in the calling thread. :param event: The service event
Below is the the instruction that describes the task: ### Input: Notifies service events listeners of a new event in the calling thread. :param event: The service event ### Response: def fire_service_event(self, event): """ Notifies service events listeners of a new event in the calling th...
def on_channel_open(self, channel): """This method is invoked by pika when the channel has been opened. It will change the state to CONNECTED, add the callbacks and setup the channel to start consuming. :param pika.channel.Channel channel: The channel object """ self.lo...
This method is invoked by pika when the channel has been opened. It will change the state to CONNECTED, add the callbacks and setup the channel to start consuming. :param pika.channel.Channel channel: The channel object
Below is the the instruction that describes the task: ### Input: This method is invoked by pika when the channel has been opened. It will change the state to CONNECTED, add the callbacks and setup the channel to start consuming. :param pika.channel.Channel channel: The channel object ### Re...
def add_interpolated_colorbar(da, colors, direction): """ Add 'rastered' colorbar to DrawingArea """ # Special case that arises due to not so useful # aesthetic mapping. if len(colors) == 1: colors = [colors[0], colors[0]] # Number of horizontal egdes(breaks) in the grid # No ne...
Add 'rastered' colorbar to DrawingArea
Below is the the instruction that describes the task: ### Input: Add 'rastered' colorbar to DrawingArea ### Response: def add_interpolated_colorbar(da, colors, direction): """ Add 'rastered' colorbar to DrawingArea """ # Special case that arises due to not so useful # aesthetic mapping. if ...
def get_mean_and_stddevs(self, sites, rup, dists, imt, stddev_types): """ See :meth:`superclass method <.base.GroundShakingIntensityModel.get_mean_and_stddevs>` for spec of input and result values. """ # Distance term R = np.sqrt(dists.rjb ** 2 + 11.29 ** 2) ...
See :meth:`superclass method <.base.GroundShakingIntensityModel.get_mean_and_stddevs>` for spec of input and result values.
Below is the the instruction that describes the task: ### Input: See :meth:`superclass method <.base.GroundShakingIntensityModel.get_mean_and_stddevs>` for spec of input and result values. ### Response: def get_mean_and_stddevs(self, sites, rup, dists, imt, stddev_types): """ See :m...
def get_oauth_token_secret_name(self, provider): """ Returns the token_secret name for the oauth provider if none is configured defaults to oauth_secret this is configured using OAUTH_PROVIDERS and token_secret """ for _provider in self.oauth_providers: ...
Returns the token_secret name for the oauth provider if none is configured defaults to oauth_secret this is configured using OAUTH_PROVIDERS and token_secret
Below is the the instruction that describes the task: ### Input: Returns the token_secret name for the oauth provider if none is configured defaults to oauth_secret this is configured using OAUTH_PROVIDERS and token_secret ### Response: def get_oauth_token_secret_name(self, provider): ...
def phonetic_u_umlaut(sound: Vowel) -> Vowel: """ >>> umlaut_a = OldNorsePhonology.phonetic_u_umlaut(a) >>> umlaut_a.ipar 'ΓΈ' >>> umlaut_o = OldNorsePhonology.phonetic_u_umlaut(o) >>> umlaut_o.ipar 'u' >>> umlaut_e = OldNorsePhonology.phonetic_u_umlaut(e...
>>> umlaut_a = OldNorsePhonology.phonetic_u_umlaut(a) >>> umlaut_a.ipar 'ΓΈ' >>> umlaut_o = OldNorsePhonology.phonetic_u_umlaut(o) >>> umlaut_o.ipar 'u' >>> umlaut_e = OldNorsePhonology.phonetic_u_umlaut(e) >>> umlaut_e.ipar 'e' :param sound: in...
Below is the the instruction that describes the task: ### Input: >>> umlaut_a = OldNorsePhonology.phonetic_u_umlaut(a) >>> umlaut_a.ipar 'ΓΈ' >>> umlaut_o = OldNorsePhonology.phonetic_u_umlaut(o) >>> umlaut_o.ipar 'u' >>> umlaut_e = OldNorsePhonology.phonetic_u_umlau...
def _parse_response_for_all_events(self, response): """ This function will retrieve *most* of the event data, excluding Organizer & Attendee details """ items = response.xpath(u'//m:FindItemResponseMessage/m:RootFolder/t:Items/t:CalendarItem', namespaces=soap_request.NAMESPACES) if not items: ...
This function will retrieve *most* of the event data, excluding Organizer & Attendee details
Below is the the instruction that describes the task: ### Input: This function will retrieve *most* of the event data, excluding Organizer & Attendee details ### Response: def _parse_response_for_all_events(self, response): """ This function will retrieve *most* of the event data, excluding Organizer & Att...
def pull(self, key, default=None): """ Pulls an item from the collection. :param key: The key :type key: mixed :param default: The default value :type default: mixed :rtype: mixed """ val = self.get(key, default) self.forget(key) ...
Pulls an item from the collection. :param key: The key :type key: mixed :param default: The default value :type default: mixed :rtype: mixed
Below is the the instruction that describes the task: ### Input: Pulls an item from the collection. :param key: The key :type key: mixed :param default: The default value :type default: mixed :rtype: mixed ### Response: def pull(self, key, default=None): """ ...
def process(self, data, **kwargs): """Process event data.""" data = super(RequestIdProcessor, self).process(data, **kwargs) if g and hasattr(g, 'request_id'): tags = data.get('tags', {}) tags['request_id'] = g.request_id data['tags'] = tags return data
Process event data.
Below is the the instruction that describes the task: ### Input: Process event data. ### Response: def process(self, data, **kwargs): """Process event data.""" data = super(RequestIdProcessor, self).process(data, **kwargs) if g and hasattr(g, 'request_id'): tags = data.get('tags...
def create_from_format_name(cls, format_name): """ Create a table writer class instance from a format name. Supported file format names are as follows: ============================================= =================================== Format name ...
Create a table writer class instance from a format name. Supported file format names are as follows: ============================================= =================================== Format name Writer Class ===============================...
Below is the the instruction that describes the task: ### Input: Create a table writer class instance from a format name. Supported file format names are as follows: ============================================= =================================== Format name ...
def _set_routing_profiletype(self, v, load=False): """ Setter method for routing_profiletype, mapped from YANG variable /rbridge_id/hardware_profile/route_table/predefined/routing_profiletype (routing-profile-subtype) If this variable is read-only (config: false) in the source YANG file, then _set_routi...
Setter method for routing_profiletype, mapped from YANG variable /rbridge_id/hardware_profile/route_table/predefined/routing_profiletype (routing-profile-subtype) If this variable is read-only (config: false) in the source YANG file, then _set_routing_profiletype is considered as a private method. Backends ...
Below is the the instruction that describes the task: ### Input: Setter method for routing_profiletype, mapped from YANG variable /rbridge_id/hardware_profile/route_table/predefined/routing_profiletype (routing-profile-subtype) If this variable is read-only (config: false) in the source YANG file, then _set...
def seed(seed_state, ctx="all"): """Seeds the random number generators in MXNet. This affects the behavior of modules in MXNet that uses random number generators, like the dropout operator and `NDArray`'s random sampling operators. Parameters ---------- seed_state : int The random numb...
Seeds the random number generators in MXNet. This affects the behavior of modules in MXNet that uses random number generators, like the dropout operator and `NDArray`'s random sampling operators. Parameters ---------- seed_state : int The random number seed. ctx : Context The ...
Below is the the instruction that describes the task: ### Input: Seeds the random number generators in MXNet. This affects the behavior of modules in MXNet that uses random number generators, like the dropout operator and `NDArray`'s random sampling operators. Parameters ---------- seed_state ...
def _convert_paths_to_flask(transmute_paths): """ convert transmute-core's path syntax (which uses {var} as the variable wildcard) into flask's <var>. """ paths = [] for p in transmute_paths: paths.append(p.replace("{", "<").replace("}", ">")) return paths
convert transmute-core's path syntax (which uses {var} as the variable wildcard) into flask's <var>.
Below is the the instruction that describes the task: ### Input: convert transmute-core's path syntax (which uses {var} as the variable wildcard) into flask's <var>. ### Response: def _convert_paths_to_flask(transmute_paths): """ convert transmute-core's path syntax (which uses {var} as the variabl...
def get_related_with_scores(page): """ Returns list of related tuples (Entry instance, score) for specified page. :param page: the page instance. :rtype: list. """ related = [] entry = Entry.get_for_model(page) if entry: related = entry.related_with_scores return rel...
Returns list of related tuples (Entry instance, score) for specified page. :param page: the page instance. :rtype: list.
Below is the the instruction that describes the task: ### Input: Returns list of related tuples (Entry instance, score) for specified page. :param page: the page instance. :rtype: list. ### Response: def get_related_with_scores(page): """ Returns list of related tuples (Entry instance, score) ...
def post(self, object_type, object_id): """Add new tags to an object.""" if object_id == 0: return Response(status=404) tagged_objects = [] for name in request.get_json(force=True): if ':' in name: type_name = name.split(':', 1)[0] ...
Add new tags to an object.
Below is the the instruction that describes the task: ### Input: Add new tags to an object. ### Response: def post(self, object_type, object_id): """Add new tags to an object.""" if object_id == 0: return Response(status=404) tagged_objects = [] for name in request.get_...
def domain_unblock(self, domain=None): """ Remove a domain block for the logged-in user. """ params = self.__generate_params(locals()) self.__api_request('DELETE', '/api/v1/domain_blocks', params)
Remove a domain block for the logged-in user.
Below is the the instruction that describes the task: ### Input: Remove a domain block for the logged-in user. ### Response: def domain_unblock(self, domain=None): """ Remove a domain block for the logged-in user. """ params = self.__generate_params(locals()) self.__api_requ...
def set_shape(self, shape, inner): """ Set the shape for all components """ for c in self.comps: c.set_shape(shape, inner)
Set the shape for all components
Below is the the instruction that describes the task: ### Input: Set the shape for all components ### Response: def set_shape(self, shape, inner): """ Set the shape for all components """ for c in self.comps: c.set_shape(shape, inner)
def estimate_L(model,bounds,storehistory=True): """ Estimate the Lipschitz constant of f by taking maximizing the norm of the expectation of the gradient of *f*. """ def df(x,model,x0): x = np.atleast_2d(x) dmdx,_ = model.predictive_gradients(x) res = np.sqrt((dmdx*dmdx).sum(1)) ...
Estimate the Lipschitz constant of f by taking maximizing the norm of the expectation of the gradient of *f*.
Below is the the instruction that describes the task: ### Input: Estimate the Lipschitz constant of f by taking maximizing the norm of the expectation of the gradient of *f*. ### Response: def estimate_L(model,bounds,storehistory=True): """ Estimate the Lipschitz constant of f by taking maximizing the norm...
def from_unicode(text, origin = root): """Convert unicode text into a Name object. Lables are encoded in IDN ACE form. @rtype: dns.name.Name object """ if not isinstance(text, unicode): raise ValueError("input to from_unicode() must be a unicode string") if not (origin is None or isin...
Convert unicode text into a Name object. Lables are encoded in IDN ACE form. @rtype: dns.name.Name object
Below is the the instruction that describes the task: ### Input: Convert unicode text into a Name object. Lables are encoded in IDN ACE form. @rtype: dns.name.Name object ### Response: def from_unicode(text, origin = root): """Convert unicode text into a Name object. Lables are encoded in IDN AC...
def slistFloat(slist): """ Converts signed list to float. """ values = [v / 60**(i) for (i,v) in enumerate(slist[1:])] value = sum(values) return -value if slist[0] == '-' else value
Converts signed list to float.
Below is the the instruction that describes the task: ### Input: Converts signed list to float. ### Response: def slistFloat(slist): """ Converts signed list to float. """ values = [v / 60**(i) for (i,v) in enumerate(slist[1:])] value = sum(values) return -value if slist[0] == '-' else value
def sanitise_capabilities(capabilities): """ Makes sure dictionary of capabilities includes required options, and does not include protected ones. :param capabilities: :return: dict """ for c in REQUIRED_CAPABILITIES: capabilities[c] = options[c] for c in PROTECTED_CAPABILITIES: ...
Makes sure dictionary of capabilities includes required options, and does not include protected ones. :param capabilities: :return: dict
Below is the the instruction that describes the task: ### Input: Makes sure dictionary of capabilities includes required options, and does not include protected ones. :param capabilities: :return: dict ### Response: def sanitise_capabilities(capabilities): """ Makes sure dictionary of capabilities ...
def set_joinstyle(self, js): """ Set the join style to be one of ('miter', 'round', 'bevel') """ DEBUG_MSG("set_joinstyle()", 1, self) self.select() GraphicsContextBase.set_joinstyle(self, js) self._pen.SetJoin(GraphicsContextWx._joind[self._joinstyle]) se...
Set the join style to be one of ('miter', 'round', 'bevel')
Below is the the instruction that describes the task: ### Input: Set the join style to be one of ('miter', 'round', 'bevel') ### Response: def set_joinstyle(self, js): """ Set the join style to be one of ('miter', 'round', 'bevel') """ DEBUG_MSG("set_joinstyle()", 1, self) s...
def bind(renderer, to): """ Bind a renderer to the given callable by constructing a new rendering view. """ @wraps(to) def view(request, **kwargs): try: returned = to(request, **kwargs) except Exception as error: view_error = getattr(renderer, "view_error", ...
Bind a renderer to the given callable by constructing a new rendering view.
Below is the the instruction that describes the task: ### Input: Bind a renderer to the given callable by constructing a new rendering view. ### Response: def bind(renderer, to): """ Bind a renderer to the given callable by constructing a new rendering view. """ @wraps(to) def view(request, *...
def raise_check_result(self): """Raise ACTIVE CHECK RESULT entry Example : "ACTIVE SERVICE CHECK: server;DOWN;HARD;1;I don't know what to say..." :return: None """ if not self.__class__.log_active_checks: return log_level = 'info' if self.state in [u...
Raise ACTIVE CHECK RESULT entry Example : "ACTIVE SERVICE CHECK: server;DOWN;HARD;1;I don't know what to say..." :return: None
Below is the the instruction that describes the task: ### Input: Raise ACTIVE CHECK RESULT entry Example : "ACTIVE SERVICE CHECK: server;DOWN;HARD;1;I don't know what to say..." :return: None ### Response: def raise_check_result(self): """Raise ACTIVE CHECK RESULT entry Example : "...
def to_paginated_list(self, result, _ns, _operation, **kwargs): """ Convert a controller result to a paginated list. The result format is assumed to meet the contract of this page class's `parse_result` function. """ items, context = self.parse_result(result) headers = ...
Convert a controller result to a paginated list. The result format is assumed to meet the contract of this page class's `parse_result` function.
Below is the the instruction that describes the task: ### Input: Convert a controller result to a paginated list. The result format is assumed to meet the contract of this page class's `parse_result` function. ### Response: def to_paginated_list(self, result, _ns, _operation, **kwargs): """ ...
async def find_deleted(self, seq_set: SequenceSet, selected: SelectedMailbox) -> Sequence[int]: """Return all the active message UIDs that have the ``\\Deleted`` flag. Args: seq_set: The sequence set of the possible messages. selected: The selected mai...
Return all the active message UIDs that have the ``\\Deleted`` flag. Args: seq_set: The sequence set of the possible messages. selected: The selected mailbox session.
Below is the the instruction that describes the task: ### Input: Return all the active message UIDs that have the ``\\Deleted`` flag. Args: seq_set: The sequence set of the possible messages. selected: The selected mailbox session. ### Response: async def find_deleted(self, seq_set...
def your_tips_on_tip_submission_form(context): """ A template tag to display the most recent and popular tip on the tip submission form. :param context: takes context """ context = copy(context) site_main = context['request'].site.root_page most_recent_tip = (YourTipsArticlePage.objects...
A template tag to display the most recent and popular tip on the tip submission form. :param context: takes context
Below is the the instruction that describes the task: ### Input: A template tag to display the most recent and popular tip on the tip submission form. :param context: takes context ### Response: def your_tips_on_tip_submission_form(context): """ A template tag to display the most recent and popular...
def class_types(self): """list of class/class declaration types, extracted from the operator arguments""" if None is self.__class_types: self.__class_types = [] for type_ in self.argument_types: decl = None type_ = type_traits.remove_refer...
list of class/class declaration types, extracted from the operator arguments
Below is the the instruction that describes the task: ### Input: list of class/class declaration types, extracted from the operator arguments ### Response: def class_types(self): """list of class/class declaration types, extracted from the operator arguments""" if None is self.__cl...
def install_package(self, path, recursive=False, prefix=None): # type: (str, bool, str) -> tuple """ Installs all the modules found in the given package :param path: Path of the package (folder) :param recursive: If True, install the sub-packages too :param prefix: (**in...
Installs all the modules found in the given package :param path: Path of the package (folder) :param recursive: If True, install the sub-packages too :param prefix: (**internal**) Prefix for all found modules :return: A 2-tuple, with the list of installed bundles and the list ...
Below is the the instruction that describes the task: ### Input: Installs all the modules found in the given package :param path: Path of the package (folder) :param recursive: If True, install the sub-packages too :param prefix: (**internal**) Prefix for all found modules :return: ...
def phase_histogram(dts, times=None, nbins=30, colormap=mpl.cm.Blues): """Plot a polar histogram of a phase variable's probability distribution Args: dts: DistTimeseries with axis 2 ranging over separate instances of an oscillator (time series values are assumed to represent an angle) times ...
Plot a polar histogram of a phase variable's probability distribution Args: dts: DistTimeseries with axis 2 ranging over separate instances of an oscillator (time series values are assumed to represent an angle) times (float or sequence of floats): The target times at which to plot the ...
Below is the the instruction that describes the task: ### Input: Plot a polar histogram of a phase variable's probability distribution Args: dts: DistTimeseries with axis 2 ranging over separate instances of an oscillator (time series values are assumed to represent an angle) times (float or...
def is_for_driver_task(self): """See whether this function descriptor is for a driver or not. Returns: True if this function descriptor is for driver tasks. """ return all( len(x) == 0 for x in [self.module_name, self.class_name, self.function_name])
See whether this function descriptor is for a driver or not. Returns: True if this function descriptor is for driver tasks.
Below is the the instruction that describes the task: ### Input: See whether this function descriptor is for a driver or not. Returns: True if this function descriptor is for driver tasks. ### Response: def is_for_driver_task(self): """See whether this function descriptor is for a driv...
def gapply(grouped_data, func, schema, *cols): """Applies the function ``func`` to data grouped by key. In particular, given a dataframe grouped by some set of key columns key1, key2, ..., keyn, this method groups all the values for each row with the same key columns into a single Pandas dataframe and by de...
Applies the function ``func`` to data grouped by key. In particular, given a dataframe grouped by some set of key columns key1, key2, ..., keyn, this method groups all the values for each row with the same key columns into a single Pandas dataframe and by default invokes ``func((key1, key2, ..., keyn), valu...
Below is the the instruction that describes the task: ### Input: Applies the function ``func`` to data grouped by key. In particular, given a dataframe grouped by some set of key columns key1, key2, ..., keyn, this method groups all the values for each row with the same key columns into a single Pandas data...
def merge(old_df, new_df, return_index=False): """ Merge two dataframes of buildings. The old dataframe is usually the buildings dataset and the new dataframe is a modified (by the user) version of what is returned by the pick method. Parameters ---------- old_d...
Merge two dataframes of buildings. The old dataframe is usually the buildings dataset and the new dataframe is a modified (by the user) version of what is returned by the pick method. Parameters ---------- old_df : dataframe Current set of buildings new_df :...
Below is the the instruction that describes the task: ### Input: Merge two dataframes of buildings. The old dataframe is usually the buildings dataset and the new dataframe is a modified (by the user) version of what is returned by the pick method. Parameters ---------- old...
def iter_item_handles(self): """Return iterator over item handles.""" path = self._data_abspath path_length = len(path) + 1 for dirpath, dirnames, filenames in os.walk(path): for fn in filenames: path = os.path.join(dirpath, fn) relative_path...
Return iterator over item handles.
Below is the the instruction that describes the task: ### Input: Return iterator over item handles. ### Response: def iter_item_handles(self): """Return iterator over item handles.""" path = self._data_abspath path_length = len(path) + 1 for dirpath, dirnames, filenames in os.walk...
def _find_loopback(self, use_loopback=True, var_name='loopback'): """Finds a free loopback device that can be used. The loopback is stored in :attr:`loopback`. If *use_loopback* is True, the loopback will also be used directly. :returns: the loopback address :raises NoLoopbackAvailableE...
Finds a free loopback device that can be used. The loopback is stored in :attr:`loopback`. If *use_loopback* is True, the loopback will also be used directly. :returns: the loopback address :raises NoLoopbackAvailableError: if no loopback could be found
Below is the the instruction that describes the task: ### Input: Finds a free loopback device that can be used. The loopback is stored in :attr:`loopback`. If *use_loopback* is True, the loopback will also be used directly. :returns: the loopback address :raises NoLoopbackAvailableError: if...
def open_files(self, idx): """Open all files with an activated disk flag.""" for name in self: if getattr(self, '_%s_diskflag' % name): path = getattr(self, '_%s_path' % name) file_ = open(path, 'rb+') ndim = getattr(self, '_%s_ndim' % name) ...
Open all files with an activated disk flag.
Below is the the instruction that describes the task: ### Input: Open all files with an activated disk flag. ### Response: def open_files(self, idx): """Open all files with an activated disk flag.""" for name in self: if getattr(self, '_%s_diskflag' % name): path = getat...
def get_modal_link(self, url, obj={}): """ Returns the metadata for a link that needs to be confirmed, if it exists, it also parses the message and title of the url to include row field data if needed. """ if not (url in self.modal_links.keys()): return None ...
Returns the metadata for a link that needs to be confirmed, if it exists, it also parses the message and title of the url to include row field data if needed.
Below is the the instruction that describes the task: ### Input: Returns the metadata for a link that needs to be confirmed, if it exists, it also parses the message and title of the url to include row field data if needed. ### Response: def get_modal_link(self, url, obj={}): """ Re...
def connect(self): """This method connects to RabbitMQ, returning the connection handle. When the connection is established, the on_connection_open method will be invoked by pika. :rtype: pika.TornadoConnection """ if not self.idle and not self.closed: raise...
This method connects to RabbitMQ, returning the connection handle. When the connection is established, the on_connection_open method will be invoked by pika. :rtype: pika.TornadoConnection
Below is the the instruction that describes the task: ### Input: This method connects to RabbitMQ, returning the connection handle. When the connection is established, the on_connection_open method will be invoked by pika. :rtype: pika.TornadoConnection ### Response: def connect(self): ...
def bind(self, container): """ Bind implementation that supports sharing. """ # if there's already a matching bound instance, return that shared = container.shared_extensions.get(self.sharing_key) if shared: return shared instance = super(SharedExtension, sel...
Bind implementation that supports sharing.
Below is the the instruction that describes the task: ### Input: Bind implementation that supports sharing. ### Response: def bind(self, container): """ Bind implementation that supports sharing. """ # if there's already a matching bound instance, return that shared = container.shar...
def _largest_integer_by_dtype(dt): """Helper returning the largest integer exactly representable by dtype.""" if not _is_known_dtype(dt): raise TypeError("Unrecognized dtype: {}".format(dt.name)) if dt.is_floating: return int(2**(np.finfo(dt.as_numpy_dtype).nmant + 1)) if dt.is_integer: return np.ii...
Helper returning the largest integer exactly representable by dtype.
Below is the the instruction that describes the task: ### Input: Helper returning the largest integer exactly representable by dtype. ### Response: def _largest_integer_by_dtype(dt): """Helper returning the largest integer exactly representable by dtype.""" if not _is_known_dtype(dt): raise TypeError("Unre...
def csv_column_cleaner(rows): """ clean csv columns parsed omitting empty/dirty rows. """ # check columns if there was empty columns result = [[] for x in range(0, len(rows))] for i_index in range(0, len(rows[0])): partial_values = [] for x_row in rows: partial_val...
clean csv columns parsed omitting empty/dirty rows.
Below is the the instruction that describes the task: ### Input: clean csv columns parsed omitting empty/dirty rows. ### Response: def csv_column_cleaner(rows): """ clean csv columns parsed omitting empty/dirty rows. """ # check columns if there was empty columns result = [[] for x in range(0,...
def channels(self): """channel count or 0 for unknown""" # from ProgramConfigElement() if hasattr(self, "pce_channels"): return self.pce_channels conf = getattr( self, "extensionChannelConfiguration", self.channelConfiguration) if conf == 1: ...
channel count or 0 for unknown
Below is the the instruction that describes the task: ### Input: channel count or 0 for unknown ### Response: def channels(self): """channel count or 0 for unknown""" # from ProgramConfigElement() if hasattr(self, "pce_channels"): return self.pce_channels conf = getatt...
def list_services(self): """ list the services configured in the keychain """ services = list(self.services.keys()) services.sort() return services
list the services configured in the keychain
Below is the the instruction that describes the task: ### Input: list the services configured in the keychain ### Response: def list_services(self): """ list the services configured in the keychain """ services = list(self.services.keys()) services.sort() return services
def VORPD(cpu, dest, src, src2): """ Performs a bitwise logical OR operation on the source operand (second operand) and second source operand (third operand) and stores the result in the destination operand (first operand). """ res = dest.write(src.read() | src2.read())
Performs a bitwise logical OR operation on the source operand (second operand) and second source operand (third operand) and stores the result in the destination operand (first operand).
Below is the the instruction that describes the task: ### Input: Performs a bitwise logical OR operation on the source operand (second operand) and second source operand (third operand) and stores the result in the destination operand (first operand). ### Response: def VORPD(cpu, dest, src, src2): ...
def infer_activations(stmts): """Return inferred RegulateActivity from Modification + ActiveForm. This function looks for combinations of Modification and ActiveForm Statements and infers Activation/Inhibition Statements from them. For example, if we know that A phosphorylates B, and th...
Return inferred RegulateActivity from Modification + ActiveForm. This function looks for combinations of Modification and ActiveForm Statements and infers Activation/Inhibition Statements from them. For example, if we know that A phosphorylates B, and the phosphorylated form of B is act...
Below is the the instruction that describes the task: ### Input: Return inferred RegulateActivity from Modification + ActiveForm. This function looks for combinations of Modification and ActiveForm Statements and infers Activation/Inhibition Statements from them. For example, if we know tha...
def pr_curve_summary(tag, labels, predictions, num_thresholds, weights=None): """Outputs a precision-recall curve `Summary` protocol buffer. Parameters ---------- tag : str A tag attached to the summary. Used by TensorBoard for organization. labels : MXNet `NDArray` or `numpy.nd...
Outputs a precision-recall curve `Summary` protocol buffer. Parameters ---------- tag : str A tag attached to the summary. Used by TensorBoard for organization. labels : MXNet `NDArray` or `numpy.ndarray`. The ground truth values. A tensor of 0/1 values with arbitrary sh...
Below is the the instruction that describes the task: ### Input: Outputs a precision-recall curve `Summary` protocol buffer. Parameters ---------- tag : str A tag attached to the summary. Used by TensorBoard for organization. labels : MXNet `NDArray` or `numpy.ndarray`. ...
def delvlan(self, vlanid): """ Function operates on the IMCDev object. Takes input of vlanid (1-4094), auth and url to execute the delete_dev_vlans method on the IMCDev object. Device must be supported in the HPE IMC Platform VLAN Manager module. :param vlanid: str of VLANId ( va...
Function operates on the IMCDev object. Takes input of vlanid (1-4094), auth and url to execute the delete_dev_vlans method on the IMCDev object. Device must be supported in the HPE IMC Platform VLAN Manager module. :param vlanid: str of VLANId ( valid 1-4094 ) :return:
Below is the the instruction that describes the task: ### Input: Function operates on the IMCDev object. Takes input of vlanid (1-4094), auth and url to execute the delete_dev_vlans method on the IMCDev object. Device must be supported in the HPE IMC Platform VLAN Manager module. :param vlan...
def get_counter(self, counter_name, default=0): """Get the value of the named counter from this job. When a job is running, counter values won't be very accurate. Args: counter_name: name of the counter in string. default: default value if the counter doesn't exist. Returns: Value i...
Get the value of the named counter from this job. When a job is running, counter values won't be very accurate. Args: counter_name: name of the counter in string. default: default value if the counter doesn't exist. Returns: Value in int of the named counter.
Below is the the instruction that describes the task: ### Input: Get the value of the named counter from this job. When a job is running, counter values won't be very accurate. Args: counter_name: name of the counter in string. default: default value if the counter doesn't exist. Returns:...
def firwin_kaiser_bpf(f_stop1, f_pass1, f_pass2, f_stop2, d_stop, fs = 1.0, N_bump=0): """ Design an FIR bandpass filter using the sinc() kernel and a Kaiser window. The filter order is determined based on f_stop1 Hz, f_pass1 Hz, f_pass2 Hz, f_stop2 Hz, and the desired...
Design an FIR bandpass filter using the sinc() kernel and a Kaiser window. The filter order is determined based on f_stop1 Hz, f_pass1 Hz, f_pass2 Hz, f_stop2 Hz, and the desired stopband attenuation d_stop in dB for both stopbands, all relative to a sampling rate of fs Hz. Note: the passband...
Below is the the instruction that describes the task: ### Input: Design an FIR bandpass filter using the sinc() kernel and a Kaiser window. The filter order is determined based on f_stop1 Hz, f_pass1 Hz, f_pass2 Hz, f_stop2 Hz, and the desired stopband attenuation d_stop in dB for both stopbands, ...
def is_on_screen(self): """Tests if the element is within the viewport of the screen (partially hidden by overflow will return true) @return: True if on screen, False otherwise """ width = self.get_width() height = self.get_height() loc = self.location() el_x_lef...
Tests if the element is within the viewport of the screen (partially hidden by overflow will return true) @return: True if on screen, False otherwise
Below is the the instruction that describes the task: ### Input: Tests if the element is within the viewport of the screen (partially hidden by overflow will return true) @return: True if on screen, False otherwise ### Response: def is_on_screen(self): """Tests if the element is within the viewpor...
def get_axis(self, undefined=np.zeros(3)): """Get the axis or vector about which the quaternion rotation occurs For a null rotation (a purely real quaternion), the rotation angle will always be `0`, but the rotation axis is undefined. It is by default assumed to be `[0, 0, 0]`. ...
Get the axis or vector about which the quaternion rotation occurs For a null rotation (a purely real quaternion), the rotation angle will always be `0`, but the rotation axis is undefined. It is by default assumed to be `[0, 0, 0]`. Params: undefined: [optional] specify the...
Below is the the instruction that describes the task: ### Input: Get the axis or vector about which the quaternion rotation occurs For a null rotation (a purely real quaternion), the rotation angle will always be `0`, but the rotation axis is undefined. It is by default assumed to be `[0, 0...
def spherical_tensor(Ji, Jj, K, Q): ur"""Return a matrix representation of the spherical tensor with quantum numbers $J_i, J_j, K, Q$. >>> from sympy import pprint >>> pprint(spherical_tensor(1, 1, 1, 0)) ⎑-√2 ⎀ βŽ’β”€β”€β”€β”€ 0 0 βŽ₯ ⎒ 2 βŽ₯ ⎒ βŽ₯ ⎒ 0 0 0 βŽ₯ ⎒ ...
ur"""Return a matrix representation of the spherical tensor with quantum numbers $J_i, J_j, K, Q$. >>> from sympy import pprint >>> pprint(spherical_tensor(1, 1, 1, 0)) ⎑-√2 ⎀ βŽ’β”€β”€β”€β”€ 0 0 βŽ₯ ⎒ 2 βŽ₯ ⎒ βŽ₯ ⎒ 0 0 0 βŽ₯ ⎒ βŽ₯ ⎒ √2βŽ₯ ⎒ 0 0...
Below is the the instruction that describes the task: ### Input: ur"""Return a matrix representation of the spherical tensor with quantum numbers $J_i, J_j, K, Q$. >>> from sympy import pprint >>> pprint(spherical_tensor(1, 1, 1, 0)) ⎑-√2 ⎀ βŽ’β”€β”€β”€β”€ 0 0 βŽ₯ ⎒ 2 βŽ₯ ⎒ ...
def rm(self, path, cycle=';*'): """ Delete an object at `path` relative to this directory """ rdir = self with preserve_current_directory(): dirname, objname = os.path.split(os.path.normpath(path)) if dirname: rdir = rdir.Get(dirname) ...
Delete an object at `path` relative to this directory
Below is the the instruction that describes the task: ### Input: Delete an object at `path` relative to this directory ### Response: def rm(self, path, cycle=';*'): """ Delete an object at `path` relative to this directory """ rdir = self with preserve_current_directory(): ...
def GetLastKey(self, voice=1): """key as in musical key, not index""" voice_obj = self.GetChild(voice) if voice_obj is not None: key = BackwardSearch(KeyNode, voice_obj, 1) if key is not None: return key else: if hasattr(self, ...
key as in musical key, not index
Below is the the instruction that describes the task: ### Input: key as in musical key, not index ### Response: def GetLastKey(self, voice=1): """key as in musical key, not index""" voice_obj = self.GetChild(voice) if voice_obj is not None: key = BackwardSearch(KeyNode, voice_o...
def get_virtualenv_path(ve_base, ve_name): """Check a virtualenv path, raising exceptions to explain problems. """ if not ve_base: raise exceptions.NoVirtualenvsDirectory( "could not figure out a virtualenvs directory. " "make sure $HOME is set, or $WORKON_HOME," ...
Check a virtualenv path, raising exceptions to explain problems.
Below is the the instruction that describes the task: ### Input: Check a virtualenv path, raising exceptions to explain problems. ### Response: def get_virtualenv_path(ve_base, ve_name): """Check a virtualenv path, raising exceptions to explain problems. """ if not ve_base: raise exceptions.NoV...
def wave_range(bins, cenwave, npix, round='round'): """Get the wavelength range covered by the given number of pixels centered on the given wavelength. Parameters ---------- bins : ndarray Wavelengths of pixel centers. Must be in the same units as ``cenwave``. cenwave : float ...
Get the wavelength range covered by the given number of pixels centered on the given wavelength. Parameters ---------- bins : ndarray Wavelengths of pixel centers. Must be in the same units as ``cenwave``. cenwave : float Central wavelength of range. Must be in the same uni...
Below is the the instruction that describes the task: ### Input: Get the wavelength range covered by the given number of pixels centered on the given wavelength. Parameters ---------- bins : ndarray Wavelengths of pixel centers. Must be in the same units as ``cenwave``. cenwave...
def build(cls, path, tag=None, dockerfile=None): """ Build the image from the provided dockerfile in path :param path : str, path to the directory containing the Dockerfile :param tag: str, A tag to add to the final image :param dockerfile: str, path within the build context to ...
Build the image from the provided dockerfile in path :param path : str, path to the directory containing the Dockerfile :param tag: str, A tag to add to the final image :param dockerfile: str, path within the build context to the Dockerfile :return: instance of DockerImage
Below is the the instruction that describes the task: ### Input: Build the image from the provided dockerfile in path :param path : str, path to the directory containing the Dockerfile :param tag: str, A tag to add to the final image :param dockerfile: str, path within the build context to ...
def name(self): """Name of the xref type.""" return self.TYPES.get(self._type, self.TYPES[idaapi.o_idpspec0])
Name of the xref type.
Below is the the instruction that describes the task: ### Input: Name of the xref type. ### Response: def name(self): """Name of the xref type.""" return self.TYPES.get(self._type, self.TYPES[idaapi.o_idpspec0])
def tokens_create(name, user, scopes, internal): """Create a personal OAuth token.""" token = Token.create_personal( name, user.id, scopes=scopes, is_internal=internal) db.session.commit() click.secho(token.access_token, fg='blue')
Create a personal OAuth token.
Below is the the instruction that describes the task: ### Input: Create a personal OAuth token. ### Response: def tokens_create(name, user, scopes, internal): """Create a personal OAuth token.""" token = Token.create_personal( name, user.id, scopes=scopes, is_internal=internal) db.session.commi...
def save_token(self, access_token): """ Stores the access token and additional data in memcache. See :class:`oauth2.store.AccessTokenStore`. """ key = self._generate_cache_key(access_token.token) self.mc.set(key, access_token.__dict__) unique_token_key = self._...
Stores the access token and additional data in memcache. See :class:`oauth2.store.AccessTokenStore`.
Below is the the instruction that describes the task: ### Input: Stores the access token and additional data in memcache. See :class:`oauth2.store.AccessTokenStore`. ### Response: def save_token(self, access_token): """ Stores the access token and additional data in memcache. See ...
def state_by_node2state_by_state(tpm): """Convert a state-by-node TPM to a state-by-state TPM. .. important:: A nondeterministic state-by-node TPM can have more than one representation as a state-by-state TPM. However, the mapping can be made to be one-to-one if we assume the TPMs to be...
Convert a state-by-node TPM to a state-by-state TPM. .. important:: A nondeterministic state-by-node TPM can have more than one representation as a state-by-state TPM. However, the mapping can be made to be one-to-one if we assume the TPMs to be conditionally independent. Therefore,...
Below is the the instruction that describes the task: ### Input: Convert a state-by-node TPM to a state-by-state TPM. .. important:: A nondeterministic state-by-node TPM can have more than one representation as a state-by-state TPM. However, the mapping can be made to be one-to-one if w...