code
stringlengths
75
104k
docstring
stringlengths
1
46.9k
text
stringlengths
164
112k
def treble(self): """int: The speaker's treble EQ. An integer between -10 and 10. """ response = self.renderingControl.GetTreble([ ('InstanceID', 0), ('Channel', 'Master'), ]) treble = response['CurrentTreble'] return int(treble)
int: The speaker's treble EQ. An integer between -10 and 10.
Below is the the instruction that describes the task: ### Input: int: The speaker's treble EQ. An integer between -10 and 10. ### Response: def treble(self): """int: The speaker's treble EQ. An integer between -10 and 10. """ response = self.renderingControl.GetTreble([ ...
def logstop(self): """Fully stop logging and close log file. In order to start logging again, a new logstart() call needs to be made, possibly (though not necessarily) with a new filename, mode and other options.""" if self.logfile is not None: self.logfile.close() ...
Fully stop logging and close log file. In order to start logging again, a new logstart() call needs to be made, possibly (though not necessarily) with a new filename, mode and other options.
Below is the the instruction that describes the task: ### Input: Fully stop logging and close log file. In order to start logging again, a new logstart() call needs to be made, possibly (though not necessarily) with a new filename, mode and other options. ### Response: def logstop(self): ...
def get_label_at_address(self, address, offset = None): """ Creates a label from the given memory address. If the address belongs to the module, the label is made relative to it's base address. @type address: int @param address: Memory address. @type offset: ...
Creates a label from the given memory address. If the address belongs to the module, the label is made relative to it's base address. @type address: int @param address: Memory address. @type offset: None or int @param offset: (Optional) Offset value. @rtype:...
Below is the the instruction that describes the task: ### Input: Creates a label from the given memory address. If the address belongs to the module, the label is made relative to it's base address. @type address: int @param address: Memory address. @type offset: None or...
def user(ctx, username, password): """[GROUP] User management operations""" ctx.obj['username'] = username ctx.obj['password'] = password
[GROUP] User management operations
Below is the the instruction that describes the task: ### Input: [GROUP] User management operations ### Response: def user(ctx, username, password): """[GROUP] User management operations""" ctx.obj['username'] = username ctx.obj['password'] = password
def args_range(min_value, max_value, *args): """ 检查参数范围 """ not_null(*args) if not all(map(lambda v: min_value <= v <= max_value, args)): raise ValueError("Argument must be between {0} and {1}!".format(min_value, max_value))
检查参数范围
Below is the the instruction that describes the task: ### Input: 检查参数范围 ### Response: def args_range(min_value, max_value, *args): """ 检查参数范围 """ not_null(*args) if not all(map(lambda v: min_value <= v <= max_value, args)): raise ValueError("Argument must be between {0} and ...
def valid(number): """ Returns true if the number string is luhn valid, and false otherwise. The number string passed to the function must contain only numeric characters otherwise behavior is undefined. """ checksum = 0 number_len = len(number) offset = ord('0') i = number_len - ...
Returns true if the number string is luhn valid, and false otherwise. The number string passed to the function must contain only numeric characters otherwise behavior is undefined.
Below is the the instruction that describes the task: ### Input: Returns true if the number string is luhn valid, and false otherwise. The number string passed to the function must contain only numeric characters otherwise behavior is undefined. ### Response: def valid(number): """ Returns true if...
def bokeh_shot_chart(data, x="LOC_X", y="LOC_Y", fill_color="#1f77b4", scatter_size=10, fill_alpha=0.4, line_alpha=0.4, court_line_color='gray', court_line_width=1, hover_tool=False, tooltips=None, **kwargs): # TODO: Settings for hover tooltip """ ...
Returns a figure with both FGA and basketball court lines drawn onto it. This function expects data to be a ColumnDataSource with the x and y values named "LOC_X" and "LOC_Y". Otherwise specify x and y. Parameters ---------- data : DataFrame The DataFrame that contains the shot chart dat...
Below is the the instruction that describes the task: ### Input: Returns a figure with both FGA and basketball court lines drawn onto it. This function expects data to be a ColumnDataSource with the x and y values named "LOC_X" and "LOC_Y". Otherwise specify x and y. Parameters ---------- da...
def reverseCommit(self): """ Remove the inserted character(s). """ # Move the cursor to the right of the text to delete. tc = self.qteWidget.textCursor() # Delete as many characters as necessary. For an image that would # be exactly 1 even though the HTML code t...
Remove the inserted character(s).
Below is the the instruction that describes the task: ### Input: Remove the inserted character(s). ### Response: def reverseCommit(self): """ Remove the inserted character(s). """ # Move the cursor to the right of the text to delete. tc = self.qteWidget.textCursor() ...
def add_decoherence_noise(prog, T1=30e-6, T2=30e-6, gate_time_1q=50e-9, gate_time_2q=150e-09, ro_fidelity=0.95): """ Add generic damping and dephasing noise to a program. This high-level function is provided as a convenience to investigate the effects of a generic noise model ...
Add generic damping and dephasing noise to a program. This high-level function is provided as a convenience to investigate the effects of a generic noise model on a program. For more fine-grained control, please investigate the other methods available in the ``pyquil.noise`` module. In an attempt to c...
Below is the the instruction that describes the task: ### Input: Add generic damping and dephasing noise to a program. This high-level function is provided as a convenience to investigate the effects of a generic noise model on a program. For more fine-grained control, please investigate the other meth...
def _configure_frozen_scoop(kwargs): """Wrapper function that configures a frozen SCOOP set up. Deletes of data if necessary. """ def _delete_old_scoop_rev_data(old_scoop_rev): if old_scoop_rev is not None: try: elements = shared.elements for key in ...
Wrapper function that configures a frozen SCOOP set up. Deletes of data if necessary.
Below is the the instruction that describes the task: ### Input: Wrapper function that configures a frozen SCOOP set up. Deletes of data if necessary. ### Response: def _configure_frozen_scoop(kwargs): """Wrapper function that configures a frozen SCOOP set up. Deletes of data if necessary. """ ...
def atlas_rank_peers_by_data_availability( peer_list=None, peer_table=None, local_inv=None, con=None, path=None ): """ Get a ranking of peers to contact for a zonefile. Peers are ranked by the number of zonefiles they have which we don't have. This is used to select neighbors. """ with Atl...
Get a ranking of peers to contact for a zonefile. Peers are ranked by the number of zonefiles they have which we don't have. This is used to select neighbors.
Below is the the instruction that describes the task: ### Input: Get a ranking of peers to contact for a zonefile. Peers are ranked by the number of zonefiles they have which we don't have. This is used to select neighbors. ### Response: def atlas_rank_peers_by_data_availability( peer_list=None, peer_...
def get_upcoming_events(self): """ Get upcoming PythonKC meetup events. Returns ------- List of ``pythonkc_meetups.types.MeetupEvent``, ordered by event time, ascending. Exceptions ---------- * PythonKCMeetupsBadJson * PythonKCMeetupsBadR...
Get upcoming PythonKC meetup events. Returns ------- List of ``pythonkc_meetups.types.MeetupEvent``, ordered by event time, ascending. Exceptions ---------- * PythonKCMeetupsBadJson * PythonKCMeetupsBadResponse * PythonKCMeetupsMeetupDown ...
Below is the the instruction that describes the task: ### Input: Get upcoming PythonKC meetup events. Returns ------- List of ``pythonkc_meetups.types.MeetupEvent``, ordered by event time, ascending. Exceptions ---------- * PythonKCMeetupsBadJson * P...
def nanmean(values, axis=None, skipna=True, mask=None): """ Compute the mean of the element along an axis ignoring NaNs Parameters ---------- values : ndarray axis: int, optional skipna : bool, default True mask : ndarray[bool], optional nan-mask if known Returns ------...
Compute the mean of the element along an axis ignoring NaNs Parameters ---------- values : ndarray axis: int, optional skipna : bool, default True mask : ndarray[bool], optional nan-mask if known Returns ------- result : float Unless input is a float array, in which...
Below is the the instruction that describes the task: ### Input: Compute the mean of the element along an axis ignoring NaNs Parameters ---------- values : ndarray axis: int, optional skipna : bool, default True mask : ndarray[bool], optional nan-mask if known Returns -----...
def update_product(product_id, **kwargs): """ Update a Product with new information """ content = update_product_raw(product_id, **kwargs) if content: return utils.format_json(content)
Update a Product with new information
Below is the the instruction that describes the task: ### Input: Update a Product with new information ### Response: def update_product(product_id, **kwargs): """ Update a Product with new information """ content = update_product_raw(product_id, **kwargs) if content: return utils.format...
def is_entailed_by(self, other): """ Means merging other with self does not produce any new information. """ if not set(self.include.keys()).issubset(set(other.include.keys())): return False if not self.exclude.isuperset(other.exclude): return False ...
Means merging other with self does not produce any new information.
Below is the the instruction that describes the task: ### Input: Means merging other with self does not produce any new information. ### Response: def is_entailed_by(self, other): """ Means merging other with self does not produce any new information. """ if not set(self.include.key...
def filter_not_t(func): """ Transformation for Sequence.filter_not :param func: filter_not function :return: transformation """ return Transformation('filter_not({0})'.format(name(func)), partial(six.moves.filterfalse, func), {ExecutionStrategi...
Transformation for Sequence.filter_not :param func: filter_not function :return: transformation
Below is the the instruction that describes the task: ### Input: Transformation for Sequence.filter_not :param func: filter_not function :return: transformation ### Response: def filter_not_t(func): """ Transformation for Sequence.filter_not :param func: filter_not function :return: transfo...
def get_data(latitude=52.091579, longitude=5.119734, usexml=False): """Get buienradar xml data and return results.""" if usexml: log.info("Getting buienradar XML data for latitude=%s, longitude=%s", latitude, longitude) return get_xml_data(latitude, longitude) else: ...
Get buienradar xml data and return results.
Below is the the instruction that describes the task: ### Input: Get buienradar xml data and return results. ### Response: def get_data(latitude=52.091579, longitude=5.119734, usexml=False): """Get buienradar xml data and return results.""" if usexml: log.info("Getting buienradar XML data for latit...
def _set_sharing_keys(self, keys): """ Set the keys to share or unshare Parameters ---------- keys: string or iterable of strings The iterable may contain formatoptions that shall be shared (or unshared), or group names of formatoptions to share all ...
Set the keys to share or unshare Parameters ---------- keys: string or iterable of strings The iterable may contain formatoptions that shall be shared (or unshared), or group names of formatoptions to share all formatoptions of that group (see the :attr:`fmt_...
Below is the the instruction that describes the task: ### Input: Set the keys to share or unshare Parameters ---------- keys: string or iterable of strings The iterable may contain formatoptions that shall be shared (or unshared), or group names of formatoptions to s...
def get_all_kernel_specs_for_envs(self): """Returns the dict of name -> kernel_spec for all environments""" data = self._get_env_data() return {name: data[name][1] for name in data}
Returns the dict of name -> kernel_spec for all environments
Below is the the instruction that describes the task: ### Input: Returns the dict of name -> kernel_spec for all environments ### Response: def get_all_kernel_specs_for_envs(self): """Returns the dict of name -> kernel_spec for all environments""" data = self._get_env_data() return {name: ...
def _driver_signing_reg_reverse_conversion(cls, val, **kwargs): ''' converts the string value seen in the GUI to the correct registry value for secedit ''' if val is not None: if val.upper() == 'SILENTLY SUCCEED': return ','.join(['3', '0']) ...
converts the string value seen in the GUI to the correct registry value for secedit
Below is the the instruction that describes the task: ### Input: converts the string value seen in the GUI to the correct registry value for secedit ### Response: def _driver_signing_reg_reverse_conversion(cls, val, **kwargs): ''' converts the string value seen in the GUI to the correct reg...
def account_lists(self, id): """ Get all of the logged-in users lists which the specified user is a member of. Returns a list of `list dicts`_. """ id = self.__unpack_id(id) params = self.__generate_params(locals(), ['id']) url = '/api/v1/accounts...
Get all of the logged-in users lists which the specified user is a member of. Returns a list of `list dicts`_.
Below is the the instruction that describes the task: ### Input: Get all of the logged-in users lists which the specified user is a member of. Returns a list of `list dicts`_. ### Response: def account_lists(self, id): """ Get all of the logged-in users lists which the spec...
async def begin(request: web.Request) -> web.Response: """ Begin a session """ if None is not session_from_request(request): LOG.warning("begin: requested with active session") return web.json_response( data={'message': 'An update session is already active on th...
Begin a session
Below is the the instruction that describes the task: ### Input: Begin a session ### Response: async def begin(request: web.Request) -> web.Response: """ Begin a session """ if None is not session_from_request(request): LOG.warning("begin: requested with active session") return web.json...
def fromProfileName(cls, name): """Return a `SessionAPI` from a given configuration profile name. :see: `ProfileStore`. """ with profiles.ProfileStore.open() as config: return cls.fromProfile(config.load(name))
Return a `SessionAPI` from a given configuration profile name. :see: `ProfileStore`.
Below is the the instruction that describes the task: ### Input: Return a `SessionAPI` from a given configuration profile name. :see: `ProfileStore`. ### Response: def fromProfileName(cls, name): """Return a `SessionAPI` from a given configuration profile name. :see: `ProfileStore`. ...
def find_field(browser, field, value): """Locate an input field of a given value This first looks for the value as the id of the element, then the name of the element, then a label for the element. """ return find_field_by_id(browser, field, value) + \ find_field_by_name(browser, field, va...
Locate an input field of a given value This first looks for the value as the id of the element, then the name of the element, then a label for the element.
Below is the the instruction that describes the task: ### Input: Locate an input field of a given value This first looks for the value as the id of the element, then the name of the element, then a label for the element. ### Response: def find_field(browser, field, value): """Locate an input field of ...
def _FormatReturnOrExitToken(self, token_data): """Formats a return or exit token as a dictionary of values. Args: token_data (bsm_token_data_exit|bsm_token_data_return32| bsm_token_data_return64): AUT_EXIT, AUT_RETURN32 or AUT_RETURN64 token data. Returns: dict[str...
Formats a return or exit token as a dictionary of values. Args: token_data (bsm_token_data_exit|bsm_token_data_return32| bsm_token_data_return64): AUT_EXIT, AUT_RETURN32 or AUT_RETURN64 token data. Returns: dict[str, str]: token values.
Below is the the instruction that describes the task: ### Input: Formats a return or exit token as a dictionary of values. Args: token_data (bsm_token_data_exit|bsm_token_data_return32| bsm_token_data_return64): AUT_EXIT, AUT_RETURN32 or AUT_RETURN64 token data. Returns: ...
def open(self, mode='read'): """Open the file.""" if self.file: self.close() raise 'Close file before opening.' if mode == 'write': self.file = open(self.path, 'w') elif mode == 'overwrite': # Delete file if exist. self.file = ...
Open the file.
Below is the the instruction that describes the task: ### Input: Open the file. ### Response: def open(self, mode='read'): """Open the file.""" if self.file: self.close() raise 'Close file before opening.' if mode == 'write': self.file = open(self.path, ...
def zhuyin_to_pinyin(s, accented=True): """Convert all Zhuyin syllables in *s* to Pinyin. If *accented* is ``True``, diacritics are added to the Pinyin syllables. If it's ``False``, numbers are used to indicate tone. """ if accented: function = _zhuyin_syllable_to_accented else: ...
Convert all Zhuyin syllables in *s* to Pinyin. If *accented* is ``True``, diacritics are added to the Pinyin syllables. If it's ``False``, numbers are used to indicate tone.
Below is the the instruction that describes the task: ### Input: Convert all Zhuyin syllables in *s* to Pinyin. If *accented* is ``True``, diacritics are added to the Pinyin syllables. If it's ``False``, numbers are used to indicate tone. ### Response: def zhuyin_to_pinyin(s, accented=True): """Conver...
def _TerminateProcess(self, process): """Terminate a process. Args: process (MultiProcessBaseProcess): process to terminate. """ pid = process.pid logger.warning('Terminating process: (PID: {0:d}).'.format(pid)) process.terminate() # Wait for the process to exit. process.join(tim...
Terminate a process. Args: process (MultiProcessBaseProcess): process to terminate.
Below is the the instruction that describes the task: ### Input: Terminate a process. Args: process (MultiProcessBaseProcess): process to terminate. ### Response: def _TerminateProcess(self, process): """Terminate a process. Args: process (MultiProcessBaseProcess): process to terminate. ...
def IsEnabled(self, *args, **kwargs): "check if all menu items are enabled" for i in range(self.GetMenuItemCount()): it = self.FindItemByPosition(i) if not it.IsEnabled(): return False return True
check if all menu items are enabled
Below is the the instruction that describes the task: ### Input: check if all menu items are enabled ### Response: def IsEnabled(self, *args, **kwargs): "check if all menu items are enabled" for i in range(self.GetMenuItemCount()): it = self.FindItemByPosition(i) if not...
def significant_control(self, num, entity_id, entity_type='individual', **kwargs): """Get details of a specific entity with significant control. Args: num (str, int): Company numb...
Get details of a specific entity with significant control. Args: num (str, int): Company number to search on. entity_id (str, int): Entity id to request details for entity_type (str, int): What type of entity to search for. Defaults to 'individual'. Other pos...
Below is the the instruction that describes the task: ### Input: Get details of a specific entity with significant control. Args: num (str, int): Company number to search on. entity_id (str, int): Entity id to request details for entity_type (str, int): What type of enti...
def find_reactions_with_identical_genes(model): """ Return reactions that have identical genes. Identify duplicate reactions globally by checking if any two reactions have the same genes. This can be useful to curate merged models or to clean-up bulk model modifications, but also to identify pr...
Return reactions that have identical genes. Identify duplicate reactions globally by checking if any two reactions have the same genes. This can be useful to curate merged models or to clean-up bulk model modifications, but also to identify promiscuous enzymes. The heuristic compares reactions in a...
Below is the the instruction that describes the task: ### Input: Return reactions that have identical genes. Identify duplicate reactions globally by checking if any two reactions have the same genes. This can be useful to curate merged models or to clean-up bulk model modifications, but also to id...
def _relativePath(self, fullPath): """ Return fullPath relative to Store directory. Return fullPath if fullPath is not inside directory. Return None if fullPath is outside our scope. """ if fullPath is None: return None assert fullPath.startswith("/"), full...
Return fullPath relative to Store directory. Return fullPath if fullPath is not inside directory. Return None if fullPath is outside our scope.
Below is the the instruction that describes the task: ### Input: Return fullPath relative to Store directory. Return fullPath if fullPath is not inside directory. Return None if fullPath is outside our scope. ### Response: def _relativePath(self, fullPath): """ Return fullPath relative to...
def _parse_image_name(self, image, retry=True): '''starting with an image string in either of the following formats: job_id|collection job_id|collection|job_name Parse the job_name, job_id, and collection uri from it. If the user provides the first option, we use th...
starting with an image string in either of the following formats: job_id|collection job_id|collection|job_name Parse the job_name, job_id, and collection uri from it. If the user provides the first option, we use the job_name set by the client (default is build)....
Below is the the instruction that describes the task: ### Input: starting with an image string in either of the following formats: job_id|collection job_id|collection|job_name Parse the job_name, job_id, and collection uri from it. If the user provides the first option,...
def parse(self, content): """Parse raw response content for a list of remote artifact cache URLs. :API: public """ if self.format == 'json_map': try: return assert_list(json.loads(content.decode(self.encoding))[self.index]) except (KeyError, UnicodeDecodeError, ValueError) as e: ...
Parse raw response content for a list of remote artifact cache URLs. :API: public
Below is the the instruction that describes the task: ### Input: Parse raw response content for a list of remote artifact cache URLs. :API: public ### Response: def parse(self, content): """Parse raw response content for a list of remote artifact cache URLs. :API: public """ if self.format ==...
def sign(self, storepass=None, keypass=None, keystore=None, apk=None, alias=None, name='app'): """ Signs (jarsign and zipalign) a target apk file based on keystore information, uses default debug keystore file by default. :param storepass(str): keystore file storepass :param keypass(str): keystore file...
Signs (jarsign and zipalign) a target apk file based on keystore information, uses default debug keystore file by default. :param storepass(str): keystore file storepass :param keypass(str): keystore file keypass :param keystore(str): keystore file path :param apk(str): apk file path to be signed :...
Below is the the instruction that describes the task: ### Input: Signs (jarsign and zipalign) a target apk file based on keystore information, uses default debug keystore file by default. :param storepass(str): keystore file storepass :param keypass(str): keystore file keypass :param keystore(str): key...
def get_torrent(self, torrent_id): """Gets the `.torrent` data for the given `torrent_id`. :param torrent_id: the ID of the torrent to download :raises TorrentNotFoundError: if the torrent does not exist :returns: :class:`Torrent` of the associated torrent """ params = {...
Gets the `.torrent` data for the given `torrent_id`. :param torrent_id: the ID of the torrent to download :raises TorrentNotFoundError: if the torrent does not exist :returns: :class:`Torrent` of the associated torrent
Below is the the instruction that describes the task: ### Input: Gets the `.torrent` data for the given `torrent_id`. :param torrent_id: the ID of the torrent to download :raises TorrentNotFoundError: if the torrent does not exist :returns: :class:`Torrent` of the associated torrent ### Res...
def add_post(self, *args, **kwargs): """ Shortcut for add_route with method POST """ return self.add_route(hdrs.METH_POST, *args, **kwargs)
Shortcut for add_route with method POST
Below is the the instruction that describes the task: ### Input: Shortcut for add_route with method POST ### Response: def add_post(self, *args, **kwargs): """ Shortcut for add_route with method POST """ return self.add_route(hdrs.METH_POST, *args, **kwargs)
def get_environ(self, parent_environ=None): """Get the environ dict resulting from interpreting this context. @param parent_environ Environment to interpret the context within, defaults to os.environ if None. @returns The environment dict generated by this context, when ...
Get the environ dict resulting from interpreting this context. @param parent_environ Environment to interpret the context within, defaults to os.environ if None. @returns The environment dict generated by this context, when interpreted in a python rex interpreter.
Below is the the instruction that describes the task: ### Input: Get the environ dict resulting from interpreting this context. @param parent_environ Environment to interpret the context within, defaults to os.environ if None. @returns The environment dict generated by this context, whe...
def get_outliers(campaign, pipeline='everest2', sigma=5): ''' Computes the number of outliers for a given `campaign` and a given `pipeline`. Stores the results in a file under "/missions/k2/tables/". :param int sigma: The sigma level at which to clip outliers. Default 5 ''' # Imports ...
Computes the number of outliers for a given `campaign` and a given `pipeline`. Stores the results in a file under "/missions/k2/tables/". :param int sigma: The sigma level at which to clip outliers. Default 5
Below is the the instruction that describes the task: ### Input: Computes the number of outliers for a given `campaign` and a given `pipeline`. Stores the results in a file under "/missions/k2/tables/". :param int sigma: The sigma level at which to clip outliers. Default 5 ### Response: def get_outlie...
def set_user_agent(self, user_agent): """Replaces the current user agent in the requests session headers.""" # set a default user_agent if not specified if user_agent is None: requests_ua = requests.utils.default_user_agent() user_agent = '%s (%s/%s)' % (requests_ua, __ti...
Replaces the current user agent in the requests session headers.
Below is the the instruction that describes the task: ### Input: Replaces the current user agent in the requests session headers. ### Response: def set_user_agent(self, user_agent): """Replaces the current user agent in the requests session headers.""" # set a default user_agent if not specified ...
def _move_consonant(self, letters: list, positions: List[int]) -> List[str]: """ Given a list of consonant positions, move the consonants according to certain consonant syllable behavioral rules for gathering and grouping. :param letters: :param positions: :return: ...
Given a list of consonant positions, move the consonants according to certain consonant syllable behavioral rules for gathering and grouping. :param letters: :param positions: :return:
Below is the the instruction that describes the task: ### Input: Given a list of consonant positions, move the consonants according to certain consonant syllable behavioral rules for gathering and grouping. :param letters: :param positions: :return: ### Response: def _move_consonan...
def print_head(self, parent_plate_value, plate_values, interval, n=10, print_func=logging.info): """ Print the first n values from the streams in the given time interval. The parent plate value is the value of the parent plate, and then the plate values are the values for the plate that ...
Print the first n values from the streams in the given time interval. The parent plate value is the value of the parent plate, and then the plate values are the values for the plate that are to be printed. e.g. print_head(None, ("house", "1")) :param parent_plate_value: The (fixed) pare...
Below is the the instruction that describes the task: ### Input: Print the first n values from the streams in the given time interval. The parent plate value is the value of the parent plate, and then the plate values are the values for the plate that are to be printed. e.g. print_head(None,...
def run_preprocessor(self, files_to_download): """ Run file_download_pre_processor for each file we are about to download. :param files_to_download: [ProjectFile]: files that will be downloaded """ for project_file in files_to_download: self.file_download_pre_processo...
Run file_download_pre_processor for each file we are about to download. :param files_to_download: [ProjectFile]: files that will be downloaded
Below is the the instruction that describes the task: ### Input: Run file_download_pre_processor for each file we are about to download. :param files_to_download: [ProjectFile]: files that will be downloaded ### Response: def run_preprocessor(self, files_to_download): """ Run file_download_...
def insert_header(self, hkey, value, index=None): """ This will insert/overwrite a value to the header and hkeys. Parameters ---------- hkey Header key. Will be appended to self.hkeys if non existent, or inserted at the specified index. If h...
This will insert/overwrite a value to the header and hkeys. Parameters ---------- hkey Header key. Will be appended to self.hkeys if non existent, or inserted at the specified index. If hkey is an integer, uses self.hkeys[hkey]. value Va...
Below is the the instruction that describes the task: ### Input: This will insert/overwrite a value to the header and hkeys. Parameters ---------- hkey Header key. Will be appended to self.hkeys if non existent, or inserted at the specified index. If hk...
def create_user(self, email, first_name, last_name, password, role="user", metadata={}): """ Create a new user :type email: str :param email: User's email :type first_name: str :param first_name: User's first name :type last_name: str :param last_name: ...
Create a new user :type email: str :param email: User's email :type first_name: str :param first_name: User's first name :type last_name: str :param last_name: User's last name :type password: str :param password: User's password :type role: s...
Below is the the instruction that describes the task: ### Input: Create a new user :type email: str :param email: User's email :type first_name: str :param first_name: User's first name :type last_name: str :param last_name: User's last name :type password...
def create_git_action_for_new_study(self, new_study_id=None): """Checks out master branch as a side effect""" ga = self.create_git_action() if new_study_id is None: new_study_id = self._mint_new_study_id() self.register_doc_id(ga, new_study_id) return ga, new_study_id
Checks out master branch as a side effect
Below is the the instruction that describes the task: ### Input: Checks out master branch as a side effect ### Response: def create_git_action_for_new_study(self, new_study_id=None): """Checks out master branch as a side effect""" ga = self.create_git_action() if new_study_id is None: ...
def ReadSystemConfigurationArtifact( self, system_configuration, session_identifier=CURRENT_SESSION): """Reads the knowledge base values from a system configuration artifact. Note that this overwrites existing values in the knowledge base. Args: system_configuration (SystemConfigurationArtifac...
Reads the knowledge base values from a system configuration artifact. Note that this overwrites existing values in the knowledge base. Args: system_configuration (SystemConfigurationArtifact): system configuration artifact. session_identifier (Optional[str])): session identifier, where ...
Below is the the instruction that describes the task: ### Input: Reads the knowledge base values from a system configuration artifact. Note that this overwrites existing values in the knowledge base. Args: system_configuration (SystemConfigurationArtifact): system configuration artifact. ...
def info_user(self,userid): '''Get user info using a ID''' headers = {"Content-type": "application/x-www-form-urlencoded","Accept": "text/plain",'Referer': 'http://'+self.domain+'/standings.phtml',"User-Agent": user_agent} req = self.session.get('http://'+self.domain+'/playerInfo.phtml?pid='+use...
Get user info using a ID
Below is the the instruction that describes the task: ### Input: Get user info using a ID ### Response: def info_user(self,userid): '''Get user info using a ID''' headers = {"Content-type": "application/x-www-form-urlencoded","Accept": "text/plain",'Referer': 'http://'+self.domain+'/standings.phtml...
def nacm_rule_list_rule_comment(self, **kwargs): """Auto Generated Code """ config = ET.Element("config") nacm = ET.SubElement(config, "nacm", xmlns="urn:ietf:params:xml:ns:yang:ietf-netconf-acm") rule_list = ET.SubElement(nacm, "rule-list") name_key = ET.SubElement(rule_...
Auto Generated Code
Below is the the instruction that describes the task: ### Input: Auto Generated Code ### Response: def nacm_rule_list_rule_comment(self, **kwargs): """Auto Generated Code """ config = ET.Element("config") nacm = ET.SubElement(config, "nacm", xmlns="urn:ietf:params:xml:ns:yang:ietf-n...
def terminate(self): """Override of PantsService.terminate() that cleans up when the Pailgun server is terminated.""" # Tear down the Pailgun TCPServer. if self.pailgun: self.pailgun.server_close() super(PailgunService, self).terminate()
Override of PantsService.terminate() that cleans up when the Pailgun server is terminated.
Below is the the instruction that describes the task: ### Input: Override of PantsService.terminate() that cleans up when the Pailgun server is terminated. ### Response: def terminate(self): """Override of PantsService.terminate() that cleans up when the Pailgun server is terminated.""" # Tear down the Pai...
def _iter_code(code): """Yield '(op,arg)' pair for each operation in code object 'code'""" from array import array from dis import HAVE_ARGUMENT, EXTENDED_ARG bytes = array('b',code.co_code) eof = len(code.co_code) ptr = 0 extended_arg = 0 while ptr<eof: op = bytes[ptr] ...
Yield '(op,arg)' pair for each operation in code object 'code
Below is the the instruction that describes the task: ### Input: Yield '(op,arg)' pair for each operation in code object 'code ### Response: def _iter_code(code): """Yield '(op,arg)' pair for each operation in code object 'code'""" from array import array from dis import HAVE_ARGUMENT, EXTENDED_ARG ...
def _login_azure_app_token(client_id=None, client_secret=None, tenant_id=None): """ Authenticate APP using token credentials: https://docs.microsoft.com/en-us/python/azure/python-sdk-azure-authenticate?view=azure-python :return: ~ServicePrincipalCredentials credentials """ ...
Authenticate APP using token credentials: https://docs.microsoft.com/en-us/python/azure/python-sdk-azure-authenticate?view=azure-python :return: ~ServicePrincipalCredentials credentials
Below is the the instruction that describes the task: ### Input: Authenticate APP using token credentials: https://docs.microsoft.com/en-us/python/azure/python-sdk-azure-authenticate?view=azure-python :return: ~ServicePrincipalCredentials credentials ### Response: def _login_azure_app_token(client_...
def get_cases(variant_source, case_lines=None, case_type='ped', variant_type='snv', variant_mode='vcf'): """Create a cases and populate it with individuals Args: variant_source (str): Path to vcf files case_lines (Iterable): Ped like lines ...
Create a cases and populate it with individuals Args: variant_source (str): Path to vcf files case_lines (Iterable): Ped like lines case_type (str): Format of case lines Returns: case_objs (list(puzzle.models.Case))
Below is the the instruction that describes the task: ### Input: Create a cases and populate it with individuals Args: variant_source (str): Path to vcf files case_lines (Iterable): Ped like lines case_type (str): Format of case lines Returns...
def _get_image(self): """ Prepare watermark image :return: Image.Image """ if self.image is None: image_path = '%s/%s' % (current_app.static_folder, os.path.normpath(self.image_path)) try: self.image = Image.open(image_path) ...
Prepare watermark image :return: Image.Image
Below is the the instruction that describes the task: ### Input: Prepare watermark image :return: Image.Image ### Response: def _get_image(self): """ Prepare watermark image :return: Image.Image """ if self.image is None: image_path = '%s/%s' % (current_a...
def option_list_all(self): """Get a list of all options, including those in option groups.""" res = self.option_list[:] for i in self.option_groups: res.extend(i.option_list) return res
Get a list of all options, including those in option groups.
Below is the the instruction that describes the task: ### Input: Get a list of all options, including those in option groups. ### Response: def option_list_all(self): """Get a list of all options, including those in option groups.""" res = self.option_list[:] for i in self.option_groups: ...
def set_config_value(name, value): """Set a config by name to a value.""" cli_config = CLIConfig(SF_CLI_CONFIG_DIR, SF_CLI_ENV_VAR_PREFIX) cli_config.set_value('servicefabric', name, value)
Set a config by name to a value.
Below is the the instruction that describes the task: ### Input: Set a config by name to a value. ### Response: def set_config_value(name, value): """Set a config by name to a value.""" cli_config = CLIConfig(SF_CLI_CONFIG_DIR, SF_CLI_ENV_VAR_PREFIX) cli_config.set_value('servicefabric', name, value)
def chain_split(*splits: Iterable[Callable[..., Any]]) -> Callable[[BaseChain], Iterable[BaseChain]]: # noqa: E501 """ Construct and execute multiple concurrent forks of the chain. Any number of forks may be executed. For each fork, provide an iterable of commands. Returns the resulting chain o...
Construct and execute multiple concurrent forks of the chain. Any number of forks may be executed. For each fork, provide an iterable of commands. Returns the resulting chain objects for each fork. .. code-block:: python chain_a, chain_b = build( mining_chain, chain...
Below is the the instruction that describes the task: ### Input: Construct and execute multiple concurrent forks of the chain. Any number of forks may be executed. For each fork, provide an iterable of commands. Returns the resulting chain objects for each fork. .. code-block:: python ...
def process_filter_directive(filter_operation_info, location, context): """Return a Filter basic block that corresponds to the filter operation in the directive. Args: filter_operation_info: FilterOperationInfo object, containing the directive and field info of the field ...
Return a Filter basic block that corresponds to the filter operation in the directive. Args: filter_operation_info: FilterOperationInfo object, containing the directive and field info of the field where the filter is to be applied. location: Location where this filter...
Below is the the instruction that describes the task: ### Input: Return a Filter basic block that corresponds to the filter operation in the directive. Args: filter_operation_info: FilterOperationInfo object, containing the directive and field info of the field where the ...
def controller(self): """Show current linked controllers.""" if hasattr(self, 'controllers'): if len(self.controllers) > 1: # in the future, we should support more controllers raise TypeError("Only one controller per account.") return self.controll...
Show current linked controllers.
Below is the the instruction that describes the task: ### Input: Show current linked controllers. ### Response: def controller(self): """Show current linked controllers.""" if hasattr(self, 'controllers'): if len(self.controllers) > 1: # in the future, we should support ...
def _scoop_single_run(kwargs): """Wrapper function for scoop, that does not configure logging""" try: try: is_origin = scoop.IS_ORIGIN except AttributeError: # scoop is not properly started, i.e. with `python -m scoop...` # in this case scoop uses default `map...
Wrapper function for scoop, that does not configure logging
Below is the the instruction that describes the task: ### Input: Wrapper function for scoop, that does not configure logging ### Response: def _scoop_single_run(kwargs): """Wrapper function for scoop, that does not configure logging""" try: try: is_origin = scoop.IS_ORIGIN excep...
def _set_get_contained_in_ID(self, v, load=False): """ Setter method for get_contained_in_ID, mapped from YANG variable /brocade_entity_rpc/get_contained_in_ID (rpc) If this variable is read-only (config: false) in the source YANG file, then _set_get_contained_in_ID is considered as a private method...
Setter method for get_contained_in_ID, mapped from YANG variable /brocade_entity_rpc/get_contained_in_ID (rpc) If this variable is read-only (config: false) in the source YANG file, then _set_get_contained_in_ID is considered as a private method. Backends looking to populate this variable should do so v...
Below is the the instruction that describes the task: ### Input: Setter method for get_contained_in_ID, mapped from YANG variable /brocade_entity_rpc/get_contained_in_ID (rpc) If this variable is read-only (config: false) in the source YANG file, then _set_get_contained_in_ID is considered as a private ...
def betas_for_cov(self, covariate = '0'): """betas_for_cov returns the beta values (i.e. IRF) associated with a specific covariate. :param covariate: name of covariate. :type covariate: string """ # find the index in the designmatrix of the current covariate this...
betas_for_cov returns the beta values (i.e. IRF) associated with a specific covariate. :param covariate: name of covariate. :type covariate: string
Below is the the instruction that describes the task: ### Input: betas_for_cov returns the beta values (i.e. IRF) associated with a specific covariate. :param covariate: name of covariate. :type covariate: string ### Response: def betas_for_cov(self, covariate = '0'): """betas_for_...
def fix_display(self): """If this is being run on a headless system the Matplotlib backend must be changed to one that doesn't need a display. """ try: tkinter.Tk() except (tkinter.TclError, NameError): # If there is no display. try: impor...
If this is being run on a headless system the Matplotlib backend must be changed to one that doesn't need a display.
Below is the the instruction that describes the task: ### Input: If this is being run on a headless system the Matplotlib backend must be changed to one that doesn't need a display. ### Response: def fix_display(self): """If this is being run on a headless system the Matplotlib backend must...
def _set_modId(self, v, load=False): """ Setter method for modId, mapped from YANG variable /logging/raslog/module/modId (list) If this variable is read-only (config: false) in the source YANG file, then _set_modId is considered as a private method. Backends looking to populate this variable should ...
Setter method for modId, mapped from YANG variable /logging/raslog/module/modId (list) If this variable is read-only (config: false) in the source YANG file, then _set_modId is considered as a private method. Backends looking to populate this variable should do so via calling thisObj._set_modId() direct...
Below is the the instruction that describes the task: ### Input: Setter method for modId, mapped from YANG variable /logging/raslog/module/modId (list) If this variable is read-only (config: false) in the source YANG file, then _set_modId is considered as a private method. Backends looking to populate t...
def fix_lamdaline(source): """Remove the last redundant token from lambda expression lambda x: return x) ^ Return string without irrelevant tokens returned from inspect.getsource on lamda expr returns """ # Using undocumented generate_tokens due to a tokenize.tokenize bug...
Remove the last redundant token from lambda expression lambda x: return x) ^ Return string without irrelevant tokens returned from inspect.getsource on lamda expr returns
Below is the the instruction that describes the task: ### Input: Remove the last redundant token from lambda expression lambda x: return x) ^ Return string without irrelevant tokens returned from inspect.getsource on lamda expr returns ### Response: def fix_lamdaline(source): ...
def set_rotation(self, r=0, redraw=True): """ Sets the LED matrix rotation for viewing, adjust if the Pi is upside down or sideways. 0 is with the Pi HDMI port facing downwards """ if r in self._pix_map.keys(): if redraw: pixel_list = self.get_pixels(...
Sets the LED matrix rotation for viewing, adjust if the Pi is upside down or sideways. 0 is with the Pi HDMI port facing downwards
Below is the the instruction that describes the task: ### Input: Sets the LED matrix rotation for viewing, adjust if the Pi is upside down or sideways. 0 is with the Pi HDMI port facing downwards ### Response: def set_rotation(self, r=0, redraw=True): """ Sets the LED matrix rotation for vi...
def graph_from_edges(edges: Iterable[Edge], **kwargs) -> BELGraph: """Build a BEL graph from edges.""" graph = BELGraph(**kwargs) for edge in edges: edge.insert_into_graph(graph) return graph
Build a BEL graph from edges.
Below is the the instruction that describes the task: ### Input: Build a BEL graph from edges. ### Response: def graph_from_edges(edges: Iterable[Edge], **kwargs) -> BELGraph: """Build a BEL graph from edges.""" graph = BELGraph(**kwargs) for edge in edges: edge.insert_into_graph(graph) r...
def jr6_jr6(mag_file, dir_path=".", input_dir_path="", meas_file="measurements.txt", spec_file="specimens.txt", samp_file="samples.txt", site_file="sites.txt", loc_file="locations.txt", specnum=1, samp_con='1', location='unknown', lat='', lon='', noave=False, meth_code="L...
Convert JR6 .jr6 files to MagIC file(s) Parameters ---------- mag_file : str input file name dir_path : str working directory, default "." input_dir_path : str input file directory IF different from dir_path, default "" meas_file : str output measurement file nam...
Below is the the instruction that describes the task: ### Input: Convert JR6 .jr6 files to MagIC file(s) Parameters ---------- mag_file : str input file name dir_path : str working directory, default "." input_dir_path : str input file directory IF different from dir_pat...
def validate(self): """Validate workflow object. This method currently validates the workflow object with the use of cwltool. It writes the workflow to a tmp CWL file, reads it, validates it and removes the tmp file again. By default, the workflow is written to file using absolu...
Validate workflow object. This method currently validates the workflow object with the use of cwltool. It writes the workflow to a tmp CWL file, reads it, validates it and removes the tmp file again. By default, the workflow is written to file using absolute paths to the steps.
Below is the the instruction that describes the task: ### Input: Validate workflow object. This method currently validates the workflow object with the use of cwltool. It writes the workflow to a tmp CWL file, reads it, validates it and removes the tmp file again. By default, the workflow i...
def process_file(self, file_path, zombies, pickle_dags=False, session=None): """ Process a Python file containing Airflow DAGs. This includes: 1. Execute the file and look for DAG objects in the namespace. 2. Pickle the DAG and save it to the DB (if necessary). 3. For e...
Process a Python file containing Airflow DAGs. This includes: 1. Execute the file and look for DAG objects in the namespace. 2. Pickle the DAG and save it to the DB (if necessary). 3. For each DAG, see what tasks should run and create appropriate task instances in the DB. ...
Below is the the instruction that describes the task: ### Input: Process a Python file containing Airflow DAGs. This includes: 1. Execute the file and look for DAG objects in the namespace. 2. Pickle the DAG and save it to the DB (if necessary). 3. For each DAG, see what tasks shou...
def slug_with_level(self, language=None): """Display the slug of the page prepended with insecable spaces to simluate the level of page in the hierarchy.""" level = '' if self.level: for n in range(0, self.level): level += '&nbsp;&nbsp;&nbsp;' return m...
Display the slug of the page prepended with insecable spaces to simluate the level of page in the hierarchy.
Below is the the instruction that describes the task: ### Input: Display the slug of the page prepended with insecable spaces to simluate the level of page in the hierarchy. ### Response: def slug_with_level(self, language=None): """Display the slug of the page prepended with insecable spac...
def main(ctx, root_project_dir, verbose): """stack-docs is a CLI for building LSST Stack documentation, such as pipelines.lsst.io. This command should be run on the "main" documentation repository, namely https://github.com/lsst/pipelines_lsst_io. The stack-docs command replaces the usual Makefile...
stack-docs is a CLI for building LSST Stack documentation, such as pipelines.lsst.io. This command should be run on the "main" documentation repository, namely https://github.com/lsst/pipelines_lsst_io. The stack-docs command replaces the usual Makefile and sphinx-build system for Sphinx projects....
Below is the the instruction that describes the task: ### Input: stack-docs is a CLI for building LSST Stack documentation, such as pipelines.lsst.io. This command should be run on the "main" documentation repository, namely https://github.com/lsst/pipelines_lsst_io. The stack-docs command replace...
def _release_and_issues(changelog, branch, release_type): """ Return most recent branch-appropriate release, if any, and its contents. :param dict changelog: Changelog contents, as returned by ``releases.util.parse_changelog``. :param str branch: Branch name. :param release_type: ...
Return most recent branch-appropriate release, if any, and its contents. :param dict changelog: Changelog contents, as returned by ``releases.util.parse_changelog``. :param str branch: Branch name. :param release_type: Member of `Release`, e.g. `Release.FEATURE`. :returns: ...
Below is the the instruction that describes the task: ### Input: Return most recent branch-appropriate release, if any, and its contents. :param dict changelog: Changelog contents, as returned by ``releases.util.parse_changelog``. :param str branch: Branch name. :param release_type: ...
def register(self): """Register the persistent identifier with the provider. :raises invenio_pidstore.errors.PIDInvalidAction: If the PID is not already registered or is deleted or is a redirection to another PID. :returns: `True` if the PID is successfully register. ...
Register the persistent identifier with the provider. :raises invenio_pidstore.errors.PIDInvalidAction: If the PID is not already registered or is deleted or is a redirection to another PID. :returns: `True` if the PID is successfully register.
Below is the the instruction that describes the task: ### Input: Register the persistent identifier with the provider. :raises invenio_pidstore.errors.PIDInvalidAction: If the PID is not already registered or is deleted or is a redirection to another PID. :returns: `True` if...
def reversible_deroot(self): """ Stores info required to restore rootedness to derooted Tree. Returns the edge that was originally rooted, the length of e1, and the length of e2. Dendropy Derooting Process: In a rooted tree the root node is bifurcating. Derooting makes it ...
Stores info required to restore rootedness to derooted Tree. Returns the edge that was originally rooted, the length of e1, and the length of e2. Dendropy Derooting Process: In a rooted tree the root node is bifurcating. Derooting makes it trifurcating. Call the two edg...
Below is the the instruction that describes the task: ### Input: Stores info required to restore rootedness to derooted Tree. Returns the edge that was originally rooted, the length of e1, and the length of e2. Dendropy Derooting Process: In a rooted tree the root node is bifurcatin...
def clean(self): """ Delete temp dir if not save_temp set at __init__ """ if not self._save_temp: if hasattr(self, '_written_files'): map(os.unlink, self._written_files) if getattr(self, '_remove_tempdir_on_clean', False): shutil.rmtree(self._tempd...
Delete temp dir if not save_temp set at __init__
Below is the the instruction that describes the task: ### Input: Delete temp dir if not save_temp set at __init__ ### Response: def clean(self): """ Delete temp dir if not save_temp set at __init__ """ if not self._save_temp: if hasattr(self, '_written_files'): map(os.un...
def map(self, function, options=None): """ Add a map phase to the map/reduce operation. :param function: Either a named Javascript function (ie: 'Riak.mapValues'), or an anonymous javascript function (ie: 'function(...) ... ' or an array ['erlang_module', 'function...
Add a map phase to the map/reduce operation. :param function: Either a named Javascript function (ie: 'Riak.mapValues'), or an anonymous javascript function (ie: 'function(...) ... ' or an array ['erlang_module', 'function']. :type function: string, list :param opt...
Below is the the instruction that describes the task: ### Input: Add a map phase to the map/reduce operation. :param function: Either a named Javascript function (ie: 'Riak.mapValues'), or an anonymous javascript function (ie: 'function(...) ... ' or an array ['erlang_module', ...
def get_value(self, context): """Run python eval on the input string.""" if self.value: return expressions.eval_string(self.value, context) else: # Empty input raises cryptic EOF syntax err, this more human # friendly raise ValueError('!py string e...
Run python eval on the input string.
Below is the the instruction that describes the task: ### Input: Run python eval on the input string. ### Response: def get_value(self, context): """Run python eval on the input string.""" if self.value: return expressions.eval_string(self.value, context) else: # Emp...
def on_epoch_end(self, epoch, logs={}): ''' Run on end of each epoch ''' LOG.debug(logs) nni.report_intermediate_result(logs["val_acc"])
Run on end of each epoch
Below is the the instruction that describes the task: ### Input: Run on end of each epoch ### Response: def on_epoch_end(self, epoch, logs={}): ''' Run on end of each epoch ''' LOG.debug(logs) nni.report_intermediate_result(logs["val_acc"])
def select_actions(root, action_space, max_episode_steps): """ Select actions from the tree Normally we select the greedy action that has the highest reward associated with that subtree. We have a small chance to select a random action based on the exploration param and visit count of the curr...
Select actions from the tree Normally we select the greedy action that has the highest reward associated with that subtree. We have a small chance to select a random action based on the exploration param and visit count of the current node at each step. We select actions for the longest possible ...
Below is the the instruction that describes the task: ### Input: Select actions from the tree Normally we select the greedy action that has the highest reward associated with that subtree. We have a small chance to select a random action based on the exploration param and visit count of the curren...
def track_metric(self, name: str, value: float, type: TelemetryDataPointType =None, count: int =None, min: float=None, max: float=None, std_dev: float=None, properties: Dict[str, object]=None) -> NotImplemented: """ Send information about a single metric data poi...
Send information about a single metric data point that was captured for the application. :param name: The name of the metric that was captured. :param value: The value of the metric that was captured. :param type: The type of the metric. (defaults to: TelemetryDataPointType.aggregation`) ...
Below is the the instruction that describes the task: ### Input: Send information about a single metric data point that was captured for the application. :param name: The name of the metric that was captured. :param value: The value of the metric that was captured. :param type: The type of t...
async def send_and_receive(self, message, generate_identifier=True, timeout=5): """Send a message and wait for a response.""" await self._connect_and_encrypt() # Some messages will respond with the same identifier as used in the # corresponding request. Ot...
Send a message and wait for a response.
Below is the the instruction that describes the task: ### Input: Send a message and wait for a response. ### Response: async def send_and_receive(self, message, generate_identifier=True, timeout=5): """Send a message and wait for a response.""" await self._connect_and...
def cc(self, cc_emails, global_substitutions=None, is_multiple=False, p=0): """Adds Cc objects to the Personalization object :param cc_emails: An Cc or list of Cc objects :type cc_emails: Cc, list(Cc), tuple :param global_substitutions: A dict of substitutions for all recipients ...
Adds Cc objects to the Personalization object :param cc_emails: An Cc or list of Cc objects :type cc_emails: Cc, list(Cc), tuple :param global_substitutions: A dict of substitutions for all recipients :type global_substitutions: dict :param is_multiple: Create a new personilizat...
Below is the the instruction that describes the task: ### Input: Adds Cc objects to the Personalization object :param cc_emails: An Cc or list of Cc objects :type cc_emails: Cc, list(Cc), tuple :param global_substitutions: A dict of substitutions for all recipients :type global_subs...
def bind_fields_to_model_cls(cls, model_fields): """Bind fields to model class.""" return dict( (field.name, field.bind_model_cls(cls)) for field in model_fields)
Bind fields to model class.
Below is the the instruction that describes the task: ### Input: Bind fields to model class. ### Response: def bind_fields_to_model_cls(cls, model_fields): """Bind fields to model class.""" return dict( (field.name, field.bind_model_cls(cls)) for field in model_fields)
def get_quoted_columns(self, platform): """ Returns the quoted representation of the column names the constraint is associated with. But only if they were defined with one or a column name is a keyword reserved by the platform. Otherwise the plain unquoted value as inser...
Returns the quoted representation of the column names the constraint is associated with. But only if they were defined with one or a column name is a keyword reserved by the platform. Otherwise the plain unquoted value as inserted is returned. :param platform: The platform to u...
Below is the the instruction that describes the task: ### Input: Returns the quoted representation of the column names the constraint is associated with. But only if they were defined with one or a column name is a keyword reserved by the platform. Otherwise the plain unquoted value...
def get_plotable3d(self): """ :returns: matplotlib Poly3DCollection :rtype: list of mpl_toolkits.mplot3d """ polyhedra = sum([polyhedron.get_plotable3d() for polyhedron in self.polyhedra], []) return polyhedra + self.surface.get_plotable3d...
:returns: matplotlib Poly3DCollection :rtype: list of mpl_toolkits.mplot3d
Below is the the instruction that describes the task: ### Input: :returns: matplotlib Poly3DCollection :rtype: list of mpl_toolkits.mplot3d ### Response: def get_plotable3d(self): """ :returns: matplotlib Poly3DCollection :rtype: list of mpl_toolkits.mplot3d """ ...
def reject(self, func): """ Return all the elements for which a truth test fails. """ return self._wrap(list(filter(lambda val: not func(val), self.obj)))
Return all the elements for which a truth test fails.
Below is the the instruction that describes the task: ### Input: Return all the elements for which a truth test fails. ### Response: def reject(self, func): """ Return all the elements for which a truth test fails. """ return self._wrap(list(filter(lambda val: not func(val), self.obj)))
def as_bool(self, key): """ Accepts a key as input. The corresponding value must be a string or the objects (``True`` or 1) or (``False`` or 0). We allow 0 and 1 to retain compatibility with Python 2.2. If the string is one of ``True``, ``On``, ``Yes``, or ``1`` it returns ...
Accepts a key as input. The corresponding value must be a string or the objects (``True`` or 1) or (``False`` or 0). We allow 0 and 1 to retain compatibility with Python 2.2. If the string is one of ``True``, ``On``, ``Yes``, or ``1`` it returns ``True``. If the string is one ...
Below is the the instruction that describes the task: ### Input: Accepts a key as input. The corresponding value must be a string or the objects (``True`` or 1) or (``False`` or 0). We allow 0 and 1 to retain compatibility with Python 2.2. If the string is one of ``True``, ``On``, ``Yes``,...
def restart_on_change(restart_map, stopstart=False, restart_functions=None): """Restart services based on configuration files changing This function is used a decorator, for example:: @restart_on_change({ '/etc/ceph/ceph.conf': [ 'cinder-api', 'cinder-volume' ] '/etc/apache/sit...
Restart services based on configuration files changing This function is used a decorator, for example:: @restart_on_change({ '/etc/ceph/ceph.conf': [ 'cinder-api', 'cinder-volume' ] '/etc/apache/sites-enabled/*': [ 'apache2' ] }) def config_changed(): ...
Below is the the instruction that describes the task: ### Input: Restart services based on configuration files changing This function is used a decorator, for example:: @restart_on_change({ '/etc/ceph/ceph.conf': [ 'cinder-api', 'cinder-volume' ] '/etc/apache/sites-enabled/*': ...
def artifact_mime_type(instance): """Ensure the 'mime_type' property of artifact objects comes from the Template column in the IANA media type registry. """ for key, obj in instance['objects'].items(): if ('type' in obj and obj['type'] == 'artifact' and 'mime_type' in obj): if enums....
Ensure the 'mime_type' property of artifact objects comes from the Template column in the IANA media type registry.
Below is the the instruction that describes the task: ### Input: Ensure the 'mime_type' property of artifact objects comes from the Template column in the IANA media type registry. ### Response: def artifact_mime_type(instance): """Ensure the 'mime_type' property of artifact objects comes from the Temp...
def dense_to_human_readable(dense_repr: Sequence[Sequence[int]], index_to_label: Dict[int, str]) -> List[List[str]]: """ Converts a dense representation of model decoded output into human readable, using a mapping from indices to labels. """ transcripts = [] for dense_r in dense_repr: non_empty...
Converts a dense representation of model decoded output into human readable, using a mapping from indices to labels.
Below is the the instruction that describes the task: ### Input: Converts a dense representation of model decoded output into human readable, using a mapping from indices to labels. ### Response: def dense_to_human_readable(dense_repr: Sequence[Sequence[int]], index_to_label: Dict[int, str]) -> List[List[str]]...
def add_property(self, *args, **kwargs): # type: (*Any, **Any) -> Property """Add a new property to this model. See :class:`pykechain.Client.create_property` for available parameters. :return: :class:`Property` :raises APIError: in case an Error occurs """ if se...
Add a new property to this model. See :class:`pykechain.Client.create_property` for available parameters. :return: :class:`Property` :raises APIError: in case an Error occurs
Below is the the instruction that describes the task: ### Input: Add a new property to this model. See :class:`pykechain.Client.create_property` for available parameters. :return: :class:`Property` :raises APIError: in case an Error occurs ### Response: def add_property(self, *args, **kwa...
def write_cache(entries, stream, extension_data=None, ShaStreamCls=IndexFileSHA1Writer): """Write the cache represented by entries to a stream :param entries: **sorted** list of entries :param stream: stream to wrap into the AdapterStreamCls - it is used for final output. :param ShaStreamCls: ...
Write the cache represented by entries to a stream :param entries: **sorted** list of entries :param stream: stream to wrap into the AdapterStreamCls - it is used for final output. :param ShaStreamCls: Type to use when writing to the stream. It produces a sha while writing to it, before th...
Below is the the instruction that describes the task: ### Input: Write the cache represented by entries to a stream :param entries: **sorted** list of entries :param stream: stream to wrap into the AdapterStreamCls - it is used for final output. :param ShaStreamCls: Type to use when writing to...
def n_tasks(dec_num): """ Takes a decimal number as input and returns the number of ones in the binary representation. This translates to the number of tasks being done by an organism with a phenotype represented as a decimal number. """ bitstring = "" try: bitstring = dec_num[2:...
Takes a decimal number as input and returns the number of ones in the binary representation. This translates to the number of tasks being done by an organism with a phenotype represented as a decimal number.
Below is the the instruction that describes the task: ### Input: Takes a decimal number as input and returns the number of ones in the binary representation. This translates to the number of tasks being done by an organism with a phenotype represented as a decimal number. ### Response: def n_tasks(dec_...
def register(self, src, trg, trg_mask=None, src_mask=None): """ Implementation of pair-wise registration and warping using point-based matching This function estimates a number of transforms (Euler, PartialAffine and Homography) using point-based matching. Features descriptor are first extracte...
Implementation of pair-wise registration and warping using point-based matching This function estimates a number of transforms (Euler, PartialAffine and Homography) using point-based matching. Features descriptor are first extracted from the pair of images using either SIFT or SURF descriptors. A ...
Below is the the instruction that describes the task: ### Input: Implementation of pair-wise registration and warping using point-based matching This function estimates a number of transforms (Euler, PartialAffine and Homography) using point-based matching. Features descriptor are first extracted f...
def get_query_tables(query): """ :type query str :rtype: list[str] """ tables = [] last_keyword = None last_token = None table_syntax_keywords = [ # SELECT queries 'FROM', 'WHERE', 'JOIN', 'INNER JOIN', 'LEFT JOIN', 'RIGHT JOIN', 'ON', # INSERT queries 'I...
:type query str :rtype: list[str]
Below is the the instruction that describes the task: ### Input: :type query str :rtype: list[str] ### Response: def get_query_tables(query): """ :type query str :rtype: list[str] """ tables = [] last_keyword = None last_token = None table_syntax_keywords = [ # SELECT q...
def add_main_manifest_entry(jar, binary): """Creates a jar manifest for the given binary. If the binary declares a main then a 'Main-Class' manifest entry will be included. """ main = binary.main if main is not None: jar.main(main)
Creates a jar manifest for the given binary. If the binary declares a main then a 'Main-Class' manifest entry will be included.
Below is the the instruction that describes the task: ### Input: Creates a jar manifest for the given binary. If the binary declares a main then a 'Main-Class' manifest entry will be included. ### Response: def add_main_manifest_entry(jar, binary): """Creates a jar manifest for the given binary. If t...
def next(self): """ :return: The next result item. :rtype: dict :raises StopIteration: If there is no more result. """ if self._cur_item is not None: res = self._cur_item self._cur_item = None return res r...
:return: The next result item. :rtype: dict :raises StopIteration: If there is no more result.
Below is the the instruction that describes the task: ### Input: :return: The next result item. :rtype: dict :raises StopIteration: If there is no more result. ### Response: def next(self): """ :return: The next result item. :rtype: dict :raises StopIteration: If t...
def update( self, plan=None, application_fee_percent=None, billing_cycle_anchor=None, coupon=None, prorate=djstripe_settings.PRORATION_POLICY, proration_date=None, metadata=None, quantity=None, tax_percent=None, trial_end=None, ): """ See `Customer.subscribe() <#djstripe.models.Customer.subsc...
See `Customer.subscribe() <#djstripe.models.Customer.subscribe>`__ :param plan: The plan to which to subscribe the customer. :type plan: Plan or string (plan ID) :param application_fee_percent: :type application_fee_percent: :param billing_cycle_anchor: :type billing_cycle_anchor: :param coupon: :type ...
Below is the the instruction that describes the task: ### Input: See `Customer.subscribe() <#djstripe.models.Customer.subscribe>`__ :param plan: The plan to which to subscribe the customer. :type plan: Plan or string (plan ID) :param application_fee_percent: :type application_fee_percent: :param billing_...
def single_cmd(container, command, fail_nonzero=False, download_result=None, **kwargs): """ Runs a script inside a container, which is created with all its dependencies. The container is removed after it has been run, whereas the dependencies are not destroyed. The output is printed to the console. :pa...
Runs a script inside a container, which is created with all its dependencies. The container is removed after it has been run, whereas the dependencies are not destroyed. The output is printed to the console. :param container: Container configuration name. :param command: Command line to run. :param fai...
Below is the the instruction that describes the task: ### Input: Runs a script inside a container, which is created with all its dependencies. The container is removed after it has been run, whereas the dependencies are not destroyed. The output is printed to the console. :param container: Container config...