code
stringlengths
75
104k
docstring
stringlengths
1
46.9k
text
stringlengths
164
112k
def get_result(self): """ raises *NoResult* exception if no result has been set """ self._process() if not self.has_result: raise NoResult return self.res_queue.popleft()
raises *NoResult* exception if no result has been set
Below is the the instruction that describes the task: ### Input: raises *NoResult* exception if no result has been set ### Response: def get_result(self): """ raises *NoResult* exception if no result has been set """ self._process() if not self.has_result: raise ...
def get(self, key, default=None): """Return a value for key, with a default value if it does not exist. Args: key (str): The key of the column to access default (object): The default value to use if the key does not exist. (Defaults to :data:`None...
Return a value for key, with a default value if it does not exist. Args: key (str): The key of the column to access default (object): The default value to use if the key does not exist. (Defaults to :data:`None`.) Returns: object: ...
Below is the the instruction that describes the task: ### Input: Return a value for key, with a default value if it does not exist. Args: key (str): The key of the column to access default (object): The default value to use if the key does not exist. (Defaults ...
def p_attr_field(self, p): """attr_field : ID EQ primitive NL | ID EQ tag_ref NL""" if p[3] is NullToken: p[0] = AstAttrField( self.path, p.lineno(1), p.lexpos(1), p[1], None) else: p[0] = AstAttrField( self.path, p.li...
attr_field : ID EQ primitive NL | ID EQ tag_ref NL
Below is the the instruction that describes the task: ### Input: attr_field : ID EQ primitive NL | ID EQ tag_ref NL ### Response: def p_attr_field(self, p): """attr_field : ID EQ primitive NL | ID EQ tag_ref NL""" if p[3] is NullToken: p[0] = ...
def get(self, query_path=None, return_type=list, preceding_depth=None, throw_null_return_error=False): """ Traverses the list of query paths to find the data requested :param query_path: (list(str), str), list of query path branches or query string Default b...
Traverses the list of query paths to find the data requested :param query_path: (list(str), str), list of query path branches or query string Default behavior: returns list(str) of possible config headers :param return_type: (list, str, dict, OrderedDict), d...
Below is the the instruction that describes the task: ### Input: Traverses the list of query paths to find the data requested :param query_path: (list(str), str), list of query path branches or query string Default behavior: returns list(str) of possible config ...
def is_excluded(root, excludes): """Check if the directory is in the exclude list. Note: by having trailing slashes, we avoid common prefix issues, like e.g. an exlude "foo" also accidentally excluding "foobar". """ root = os.path.normpath(root) for exclude in excludes: if root ==...
Check if the directory is in the exclude list. Note: by having trailing slashes, we avoid common prefix issues, like e.g. an exlude "foo" also accidentally excluding "foobar".
Below is the the instruction that describes the task: ### Input: Check if the directory is in the exclude list. Note: by having trailing slashes, we avoid common prefix issues, like e.g. an exlude "foo" also accidentally excluding "foobar". ### Response: def is_excluded(root, excludes): """Check...
def list_files(tag=None, sat_id=None, data_path=None, format_str=None): """Produce a list of files corresponding to format_str located at data_path. This routine is invoked by pysat and is not intended for direct use by the end user. Multiple data levels may be supported via the 'tag' and 'sat_id' inp...
Produce a list of files corresponding to format_str located at data_path. This routine is invoked by pysat and is not intended for direct use by the end user. Multiple data levels may be supported via the 'tag' and 'sat_id' input strings. Parameters ---------- tag : string ('') tag na...
Below is the the instruction that describes the task: ### Input: Produce a list of files corresponding to format_str located at data_path. This routine is invoked by pysat and is not intended for direct use by the end user. Multiple data levels may be supported via the 'tag' and 'sat_id' input strings...
def init(canvas_size=(512, 512), max_depth=12, face_color=None, background_color=None): """Initializes global state""" global _background_color _background_color = background_color global _ctx global cnt_elements global MAX_DEPTH global WIDTH global HEIGHT _init_state() sys.setr...
Initializes global state
Below is the the instruction that describes the task: ### Input: Initializes global state ### Response: def init(canvas_size=(512, 512), max_depth=12, face_color=None, background_color=None): """Initializes global state""" global _background_color _background_color = background_color global _ctx ...
def renew_compose(self, compose_id): """Renew, or extend, existing compose If the compose has already been removed, ODCS creates a new compose. Otherwise, it extends the time_to_expire of existing compose. In most cases, caller should assume the compose ID will change. :param c...
Renew, or extend, existing compose If the compose has already been removed, ODCS creates a new compose. Otherwise, it extends the time_to_expire of existing compose. In most cases, caller should assume the compose ID will change. :param compose_id: int, compose ID to renew :re...
Below is the the instruction that describes the task: ### Input: Renew, or extend, existing compose If the compose has already been removed, ODCS creates a new compose. Otherwise, it extends the time_to_expire of existing compose. In most cases, caller should assume the compose ID will chan...
def image_psf_shape_tag_from_image_psf_shape(image_psf_shape): """Generate an image psf shape tag, to customize phase names based on size of the image PSF that the original PSF \ is trimmed to for faster run times. This changes the phase name 'phase_name' as follows: image_psf_shape = 1 -> phase_name ...
Generate an image psf shape tag, to customize phase names based on size of the image PSF that the original PSF \ is trimmed to for faster run times. This changes the phase name 'phase_name' as follows: image_psf_shape = 1 -> phase_name image_psf_shape = 2 -> phase_name_image_psf_shape_2 image_psf_...
Below is the the instruction that describes the task: ### Input: Generate an image psf shape tag, to customize phase names based on size of the image PSF that the original PSF \ is trimmed to for faster run times. This changes the phase name 'phase_name' as follows: image_psf_shape = 1 -> phase_name ...
def add_children(self, children): """Adds new children nodes after filtering for duplicates Args: children (list): list of OmniTree nodes to add as children """ self._children += [c for c in children if c not in self._children]
Adds new children nodes after filtering for duplicates Args: children (list): list of OmniTree nodes to add as children
Below is the the instruction that describes the task: ### Input: Adds new children nodes after filtering for duplicates Args: children (list): list of OmniTree nodes to add as children ### Response: def add_children(self, children): """Adds new children nodes after filtering for duplic...
def getCollectionsViaCityId(self, city_id, **kwargs): """ :param city_id: id of the city for which collections are needed :param lat: latitude :param lon: longitude :param count: number of max results to display Returns Zomato Restaurant Collections in a City. The locatio...
:param city_id: id of the city for which collections are needed :param lat: latitude :param lon: longitude :param count: number of max results to display Returns Zomato Restaurant Collections in a City. The location/City input can be provided in the following ways - Using Zomato...
Below is the the instruction that describes the task: ### Input: :param city_id: id of the city for which collections are needed :param lat: latitude :param lon: longitude :param count: number of max results to display Returns Zomato Restaurant Collections in a City. The location/Cit...
def generate_batch(klass, strategy, size, **kwargs): """Create a factory for the given class, and generate instances.""" return make_factory(klass, **kwargs).generate_batch(strategy, size)
Create a factory for the given class, and generate instances.
Below is the the instruction that describes the task: ### Input: Create a factory for the given class, and generate instances. ### Response: def generate_batch(klass, strategy, size, **kwargs): """Create a factory for the given class, and generate instances.""" return make_factory(klass, **kwargs).generate...
def filter_wildcard(names, pattern): """ Return a tuple of strings that match a shell-style wildcard pattern. """ return tuple(name for name in names if fnmatch.fnmatch(name, pattern))
Return a tuple of strings that match a shell-style wildcard pattern.
Below is the the instruction that describes the task: ### Input: Return a tuple of strings that match a shell-style wildcard pattern. ### Response: def filter_wildcard(names, pattern): """ Return a tuple of strings that match a shell-style wildcard pattern. """ return tuple(name for name in names ...
def tree_find(self, symbol, origin, attribute): """Finds the code element corresponding to specified symbol by searching all modules in the parser. :arg symbol: the name of the code element to find. :arg origin: an instance of a Module element who owns the text that is generat...
Finds the code element corresponding to specified symbol by searching all modules in the parser. :arg symbol: the name of the code element to find. :arg origin: an instance of a Module element who owns the text that is generate the find search. :arg attribute: one of ['depende...
Below is the the instruction that describes the task: ### Input: Finds the code element corresponding to specified symbol by searching all modules in the parser. :arg symbol: the name of the code element to find. :arg origin: an instance of a Module element who owns the text that ...
def is_name_in_grace_period(self, name, block_number): """ Given a name and block number, determine if it is in the renewal grace period at that block. * names in revealed but not ready namespaces are never expired, unless the namespace itself is expired; * names in ready namespaces ente...
Given a name and block number, determine if it is in the renewal grace period at that block. * names in revealed but not ready namespaces are never expired, unless the namespace itself is expired; * names in ready namespaces enter the grace period once max(ready_block, renew_block) + lifetime - grace_pe...
Below is the the instruction that describes the task: ### Input: Given a name and block number, determine if it is in the renewal grace period at that block. * names in revealed but not ready namespaces are never expired, unless the namespace itself is expired; * names in ready namespaces enter the ...
def _WritesString(self, content): """Writes a string to the sample file. Args: content (str): content to write to the sample file. """ content_bytes = codecs.encode(content, 'utf-8') self._sample_file.write(content_bytes)
Writes a string to the sample file. Args: content (str): content to write to the sample file.
Below is the the instruction that describes the task: ### Input: Writes a string to the sample file. Args: content (str): content to write to the sample file. ### Response: def _WritesString(self, content): """Writes a string to the sample file. Args: content (str): content to write to th...
def plot_spectrum(self, nmax=None, convention='power', unit='per_l', base=10., lmax=None, xscale='lin', yscale='log', grid=True, legend=None, axes_labelsize=None, tick_labelsize=None, show=True, ax=None, fname=None, **kwargs): ...
Plot the spectrum as a function of spherical harmonic degree. Usage ----- x.plot_spectrum([nmax, convention, unit, base, lmax, xscale, yscale, grid, axes_labelsize, tick_labelsize, legend, show, ax, fname, **kwargs]) Parameters ...
Below is the the instruction that describes the task: ### Input: Plot the spectrum as a function of spherical harmonic degree. Usage ----- x.plot_spectrum([nmax, convention, unit, base, lmax, xscale, yscale, grid, axes_labelsize, tick_labelsize, legend, show, ...
def setSingleShot(self, state): """ Sets whether or not this timer is setup for a single entry or not. :param state | <bool> """ with QtCore.QWriteLocker(self.__lock): self.__singleShot = state self._singleShotChanged.emit(state)
Sets whether or not this timer is setup for a single entry or not. :param state | <bool>
Below is the the instruction that describes the task: ### Input: Sets whether or not this timer is setup for a single entry or not. :param state | <bool> ### Response: def setSingleShot(self, state): """ Sets whether or not this timer is setup for a single entry or not. ...
def encode_file_header(boundary, paramname, filesize, filename=None, filetype=None): """Returns the leading data for a multipart/form-data field that contains file data. ``boundary`` is the boundary string used throughout a single request to separate variables. ``paramname``...
Returns the leading data for a multipart/form-data field that contains file data. ``boundary`` is the boundary string used throughout a single request to separate variables. ``paramname`` is the name of the variable in this request. ``filesize`` is the size of the file data. ``filename`` if ...
Below is the the instruction that describes the task: ### Input: Returns the leading data for a multipart/form-data field that contains file data. ``boundary`` is the boundary string used throughout a single request to separate variables. ``paramname`` is the name of the variable in this request. ...
def offset(requestContext, seriesList, factor): """ Takes one metric or a wildcard seriesList followed by a constant, and adds the constant to each datapoint. Example:: &target=offset(Server.instance01.threads.busy,10) """ for series in seriesList: series.name = "offset(%s,%g)...
Takes one metric or a wildcard seriesList followed by a constant, and adds the constant to each datapoint. Example:: &target=offset(Server.instance01.threads.busy,10)
Below is the the instruction that describes the task: ### Input: Takes one metric or a wildcard seriesList followed by a constant, and adds the constant to each datapoint. Example:: &target=offset(Server.instance01.threads.busy,10) ### Response: def offset(requestContext, seriesList, factor): ...
def build_CLASS(prefix): """ Function to dowwnload CLASS from github and and build the library """ # latest class version and download link args = (package_basedir, package_basedir, CLASS_VERSION, os.path.abspath(prefix)) command = 'sh %s/depends/install_class.sh %s %s %s' %args ret = os.sy...
Function to dowwnload CLASS from github and and build the library
Below is the the instruction that describes the task: ### Input: Function to dowwnload CLASS from github and and build the library ### Response: def build_CLASS(prefix): """ Function to dowwnload CLASS from github and and build the library """ # latest class version and download link args = (pa...
def get_station_board( self, crs, rows=17, include_departures=True, include_arrivals=False, destination_crs=None, origin_crs=None ): """ Query the darwin webservice to obtain a board for a particular station and return a StationBoard in...
Query the darwin webservice to obtain a board for a particular station and return a StationBoard instance Positional arguments: crs -- the three letter CRS code of a UK station Keyword arguments: rows -- the number of rows to retrieve (default 10) include_departures -- ...
Below is the the instruction that describes the task: ### Input: Query the darwin webservice to obtain a board for a particular station and return a StationBoard instance Positional arguments: crs -- the three letter CRS code of a UK station Keyword arguments: rows -- the n...
def OIDC_UNAUTHENTICATED_SESSION_MANAGEMENT_KEY(self): """ OPTIONAL. Supply a fixed string to use as browser-state key for unauthenticated clients. """ # Memoize generated value if not self._unauthenticated_session_management_key: self._unauthenticated_session_manage...
OPTIONAL. Supply a fixed string to use as browser-state key for unauthenticated clients.
Below is the the instruction that describes the task: ### Input: OPTIONAL. Supply a fixed string to use as browser-state key for unauthenticated clients. ### Response: def OIDC_UNAUTHENTICATED_SESSION_MANAGEMENT_KEY(self): """ OPTIONAL. Supply a fixed string to use as browser-state key for unauthen...
def fft_aggregated(self, x, param=None): """ As in tsfresh `fft_aggregated <https://github.com/blue-yonder/tsfresh/blob/master/tsfresh/feature_extraction/\ feature_calculators.py#L896>`_ Returns the spectral centroid (mean), variance, skew, and kurtosis of the absolute fourier transform...
As in tsfresh `fft_aggregated <https://github.com/blue-yonder/tsfresh/blob/master/tsfresh/feature_extraction/\ feature_calculators.py#L896>`_ Returns the spectral centroid (mean), variance, skew, and kurtosis of the absolute fourier transform spectrum. :param x: the time series to calc...
Below is the the instruction that describes the task: ### Input: As in tsfresh `fft_aggregated <https://github.com/blue-yonder/tsfresh/blob/master/tsfresh/feature_extraction/\ feature_calculators.py#L896>`_ Returns the spectral centroid (mean), variance, skew, and kurtosis of the absolute fourier t...
def delete_group_member(self, grp_name, user): """ Delete the given user to the named group. Both group and user must already exist for this to succeed. Args: name (string): Name of group. user_name (string): User to delete from the group. Raises: ...
Delete the given user to the named group. Both group and user must already exist for this to succeed. Args: name (string): Name of group. user_name (string): User to delete from the group. Raises: requests.HTTPError on failure.
Below is the the instruction that describes the task: ### Input: Delete the given user to the named group. Both group and user must already exist for this to succeed. Args: name (string): Name of group. user_name (string): User to delete from the group. Raises: ...
def _parseDataDirectoryImport(self, dataDirectoryEntry, importSection): """Parses the ImportDataDirectory and returns a list of ImportDescriptorData""" if not importSection: return raw_bytes = (c_ubyte * dataDirectoryEntry.Size).from_buffer(importSection.raw, to_offset(dataDirector...
Parses the ImportDataDirectory and returns a list of ImportDescriptorData
Below is the the instruction that describes the task: ### Input: Parses the ImportDataDirectory and returns a list of ImportDescriptorData ### Response: def _parseDataDirectoryImport(self, dataDirectoryEntry, importSection): """Parses the ImportDataDirectory and returns a list of ImportDescriptorData""" ...
def write_incron_file(user, path): ''' Writes the contents of a file to a user's incrontab CLI Example: .. code-block:: bash salt '*' incron.write_incron_file root /tmp/new_incron ''' return __salt__['cmd.retcode'](_get_incron_cmdstr(path), runas=user, python_shell=False) == 0
Writes the contents of a file to a user's incrontab CLI Example: .. code-block:: bash salt '*' incron.write_incron_file root /tmp/new_incron
Below is the the instruction that describes the task: ### Input: Writes the contents of a file to a user's incrontab CLI Example: .. code-block:: bash salt '*' incron.write_incron_file root /tmp/new_incron ### Response: def write_incron_file(user, path): ''' Writes the contents of a file...
def raises(self, exception_type, function, *args, **kwargs): """ Check if a function raises a specified exception type, *args and **kwargs are forwarded to the function """ try: result = function(*args, **kwargs) self.log_error("{} did not throw ex...
Check if a function raises a specified exception type, *args and **kwargs are forwarded to the function
Below is the the instruction that describes the task: ### Input: Check if a function raises a specified exception type, *args and **kwargs are forwarded to the function ### Response: def raises(self, exception_type, function, *args, **kwargs): """ Check if a function raises a specif...
def set(self, e, k, v, real_k=None, check_kw_name=False): """override base to handle escape case: replace \" to " """ if self.escape: v = v.strip().replace("\\" + self.quote, self.quote) return super(kv_transformer, self).set(e, k, v, real_k=real_k, check_kw_name=check_kw_name)
override base to handle escape case: replace \" to "
Below is the the instruction that describes the task: ### Input: override base to handle escape case: replace \" to " ### Response: def set(self, e, k, v, real_k=None, check_kw_name=False): """override base to handle escape case: replace \" to " """ if self.escape: v = v.strip().replace...
def swap(self, side='AB', inplace=False): ''' :side: - optional string :inplace: - optional boolean :return: Triangle with flipped side. The optional side paramater should have one of three values: AB, BC, or AC. Changes the order of the triangle's points, swapp...
:side: - optional string :inplace: - optional boolean :return: Triangle with flipped side. The optional side paramater should have one of three values: AB, BC, or AC. Changes the order of the triangle's points, swapping the specified points. Doing so will change the res...
Below is the the instruction that describes the task: ### Input: :side: - optional string :inplace: - optional boolean :return: Triangle with flipped side. The optional side paramater should have one of three values: AB, BC, or AC. Changes the order of the triangle's points...
def old_format(self, content: BeautifulSoup) -> List[str]: """ Extracts email message information if it uses the old Mailman format Args: content: BeautifulSoup Returns: List[str] """ b = content.find('body') sender, date, nxt, rep_to = None...
Extracts email message information if it uses the old Mailman format Args: content: BeautifulSoup Returns: List[str]
Below is the the instruction that describes the task: ### Input: Extracts email message information if it uses the old Mailman format Args: content: BeautifulSoup Returns: List[str] ### Response: def old_format(self, content: BeautifulSoup) -> List[str]: """ Extracts e...
def pvwatts_ac(self, pdc): """ Calculates AC power according to the PVWatts model using :py:func:`pvwatts_ac`, `self.module_parameters['pdc0']`, and `eta_inv_nom=self.inverter_parameters['eta_inv_nom']`. See :py:func:`pvwatts_ac` for details. """ kwargs = _build_...
Calculates AC power according to the PVWatts model using :py:func:`pvwatts_ac`, `self.module_parameters['pdc0']`, and `eta_inv_nom=self.inverter_parameters['eta_inv_nom']`. See :py:func:`pvwatts_ac` for details.
Below is the the instruction that describes the task: ### Input: Calculates AC power according to the PVWatts model using :py:func:`pvwatts_ac`, `self.module_parameters['pdc0']`, and `eta_inv_nom=self.inverter_parameters['eta_inv_nom']`. See :py:func:`pvwatts_ac` for details. ### Response: ...
def _set_port_profile_status(self, v, load=False): """ Setter method for port_profile_status, mapped from YANG variable /brocade_port_profile_ext_rpc/get_port_profile_status/input/port_profile_status (enumeration) If this variable is read-only (config: false) in the source YANG file, then _set_port_prof...
Setter method for port_profile_status, mapped from YANG variable /brocade_port_profile_ext_rpc/get_port_profile_status/input/port_profile_status (enumeration) If this variable is read-only (config: false) in the source YANG file, then _set_port_profile_status is considered as a private method. Backends look...
Below is the the instruction that describes the task: ### Input: Setter method for port_profile_status, mapped from YANG variable /brocade_port_profile_ext_rpc/get_port_profile_status/input/port_profile_status (enumeration) If this variable is read-only (config: false) in the source YANG file, then _set_por...
def build_finished(app, exception): ''' Generate a ``sitemap.txt`` from the collected HTML page links. ''' filename = join(app.outdir, "sitemap.txt") links_iter = status_iterator(sorted(app.sitemap_links), 'adding links to sitemap... ', ...
Generate a ``sitemap.txt`` from the collected HTML page links.
Below is the the instruction that describes the task: ### Input: Generate a ``sitemap.txt`` from the collected HTML page links. ### Response: def build_finished(app, exception): ''' Generate a ``sitemap.txt`` from the collected HTML page links. ''' filename = join(app.outdir, "sitemap.txt") links...
def circuit_to_latex(circ: Circuit, qubits: Qubits = None, document: bool = True) -> str: """ Create an image of a quantum circuit in LaTeX. Can currently draw X, Y, Z, H, T, S, T_H, S_H, RX, RY, RZ, TX, TY, TZ, TH, CNOT, CZ, SWAP, ISWAP, CCNOT, CSWAP, XX, YY, ...
Create an image of a quantum circuit in LaTeX. Can currently draw X, Y, Z, H, T, S, T_H, S_H, RX, RY, RZ, TX, TY, TZ, TH, CNOT, CZ, SWAP, ISWAP, CCNOT, CSWAP, XX, YY, ZZ, CAN, P0 and P1 gates, and the RESET operation. Args: circ: A quantum Circuit qubits: Optional qubit list ...
Below is the the instruction that describes the task: ### Input: Create an image of a quantum circuit in LaTeX. Can currently draw X, Y, Z, H, T, S, T_H, S_H, RX, RY, RZ, TX, TY, TZ, TH, CNOT, CZ, SWAP, ISWAP, CCNOT, CSWAP, XX, YY, ZZ, CAN, P0 and P1 gates, and the RESET operation. Args: c...
def _encode_params(kw): ''' Encode parameters. ''' args = [] for k, v in kw.items(): try: # Python 2 qv = v.encode('utf-8') if isinstance(v, unicode) else str(v) except: qv = v args.append('%s=%s' % (k, urlquote(qv))) return '&'.join(ar...
Encode parameters.
Below is the the instruction that describes the task: ### Input: Encode parameters. ### Response: def _encode_params(kw): ''' Encode parameters. ''' args = [] for k, v in kw.items(): try: # Python 2 qv = v.encode('utf-8') if isinstance(v, unicode) else str(v) ...
def permutations(x): '''Given a listlike, x, return all permutations of x Returns the permutations of x in the lexical order of their indices: e.g. >>> x = [ 1, 2, 3, 4 ] >>> for p in permutations(x): >>> print p [ 1, 2, 3, 4 ] [ 1, 2, 4, 3 ] [ 1, 3, 2, 4 ] [ 1, 3, 4, 2 ] ...
Given a listlike, x, return all permutations of x Returns the permutations of x in the lexical order of their indices: e.g. >>> x = [ 1, 2, 3, 4 ] >>> for p in permutations(x): >>> print p [ 1, 2, 3, 4 ] [ 1, 2, 4, 3 ] [ 1, 3, 2, 4 ] [ 1, 3, 4, 2 ] [ 1, 4, 2, 3 ] [ 1, 4, 3...
Below is the the instruction that describes the task: ### Input: Given a listlike, x, return all permutations of x Returns the permutations of x in the lexical order of their indices: e.g. >>> x = [ 1, 2, 3, 4 ] >>> for p in permutations(x): >>> print p [ 1, 2, 3, 4 ] [ 1, 2, 4, 3 ] ...
async def sessionstart(self): "Start session. Must start service.utils.session.Session to use this method" if not hasattr(self, 'session') or not self.session: self.session, setcookies = await call_api(self.container, 'session', 'start', {'cookies':self.rawcookie}) for nc in setc...
Start session. Must start service.utils.session.Session to use this method
Below is the the instruction that describes the task: ### Input: Start session. Must start service.utils.session.Session to use this method ### Response: async def sessionstart(self): "Start session. Must start service.utils.session.Session to use this method" if not hasattr(self, 'session') or not...
def submit_evaluation(self, variant_obj, user_obj, institute_obj, case_obj, link, criteria): """Submit an evaluation to the database Get all the relevant information, build a evaluation_obj Args: variant_obj(dict) user_obj(dict) institute_obj(dict) ...
Submit an evaluation to the database Get all the relevant information, build a evaluation_obj Args: variant_obj(dict) user_obj(dict) institute_obj(dict) case_obj(dict) link(str): variant url criteria(list(dict)): ...
Below is the the instruction that describes the task: ### Input: Submit an evaluation to the database Get all the relevant information, build a evaluation_obj Args: variant_obj(dict) user_obj(dict) institute_obj(dict) case_obj(dict) link(...
def read_skysense_buffer(self): """Skysense stream format. :: ---------------------------------------------------------------------------------- Field SS MS MS MS MS MS MS MS MS MS MS MS MS MS MS TS TS TS TS TS TS RS RS RS --------------------------------------...
Skysense stream format. :: ---------------------------------------------------------------------------------- Field SS MS MS MS MS MS MS MS MS MS MS MS MS MS MS TS TS TS TS TS TS RS RS RS ---------------------------------------------------------------------------------...
Below is the the instruction that describes the task: ### Input: Skysense stream format. :: ---------------------------------------------------------------------------------- Field SS MS MS MS MS MS MS MS MS MS MS MS MS MS MS TS TS TS TS TS TS RS RS RS ------------...
def load_and_save_raw(self, parent_level="CellpyData"): """Loads the cellpy or raw-data file(s) and saves to csv""" sep = prms.Reader["sep"] if self.use_cellpy_stat_file is None: use_cellpy_stat_file = prms.Reader.use_cellpy_stat_file else: use_cellpy_stat_file = ...
Loads the cellpy or raw-data file(s) and saves to csv
Below is the the instruction that describes the task: ### Input: Loads the cellpy or raw-data file(s) and saves to csv ### Response: def load_and_save_raw(self, parent_level="CellpyData"): """Loads the cellpy or raw-data file(s) and saves to csv""" sep = prms.Reader["sep"] if self.use_cellp...
def to_bytes(self): ''' Create bytes from properties ''' # Verify that the properties make sense self.sanitize() # Write the version bitstream = BitStream('uint:4=%d' % self.version) # Write the header length options_len = math.ceil(len(self.opti...
Create bytes from properties
Below is the the instruction that describes the task: ### Input: Create bytes from properties ### Response: def to_bytes(self): ''' Create bytes from properties ''' # Verify that the properties make sense self.sanitize() # Write the version bitstream = BitSt...
def _get_recording(self, index): """Return the recording that contains a given index.""" assert index >= 0 recs = np.nonzero((index - self.offsets[:-1]) >= 0)[0] if len(recs) == 0: # pragma: no cover # If the index is greater than the total size, # return the las...
Return the recording that contains a given index.
Below is the the instruction that describes the task: ### Input: Return the recording that contains a given index. ### Response: def _get_recording(self, index): """Return the recording that contains a given index.""" assert index >= 0 recs = np.nonzero((index - self.offsets[:-1]) >= 0)[0] ...
def has_child_banks(self, bank_id): """Tests if a bank has any children. arg: bank_id (osid.id.Id): a ``bank_id`` return: (boolean) - ``true`` if the ``bank_id`` has children, ``false`` otherwise raise: NotFound - ``bank_id`` is not found raise: NullArgument...
Tests if a bank has any children. arg: bank_id (osid.id.Id): a ``bank_id`` return: (boolean) - ``true`` if the ``bank_id`` has children, ``false`` otherwise raise: NotFound - ``bank_id`` is not found raise: NullArgument - ``bank_id`` is ``null`` raise: Oper...
Below is the the instruction that describes the task: ### Input: Tests if a bank has any children. arg: bank_id (osid.id.Id): a ``bank_id`` return: (boolean) - ``true`` if the ``bank_id`` has children, ``false`` otherwise raise: NotFound - ``bank_id`` is not found ...
def delete_object(self, bucket, obj, version_id): """Delete an existing object. :param bucket: The bucket (instance or id) to get the object from. :param obj: A :class:`invenio_files_rest.models.ObjectVersion` instance. :param version_id: The version ID. :returns: A ...
Delete an existing object. :param bucket: The bucket (instance or id) to get the object from. :param obj: A :class:`invenio_files_rest.models.ObjectVersion` instance. :param version_id: The version ID. :returns: A Flask response.
Below is the the instruction that describes the task: ### Input: Delete an existing object. :param bucket: The bucket (instance or id) to get the object from. :param obj: A :class:`invenio_files_rest.models.ObjectVersion` instance. :param version_id: The version ID. :ret...
def utf8(value, encoding=None): """Converts a string argument to a byte string. """ if isinstance(value, _UTF8_TYPES): return value if not isinstance(value, text_type): raise TypeError( "Expected bytes, unicode, or None; got %r" % type(value) ) if encoding is not...
Converts a string argument to a byte string.
Below is the the instruction that describes the task: ### Input: Converts a string argument to a byte string. ### Response: def utf8(value, encoding=None): """Converts a string argument to a byte string. """ if isinstance(value, _UTF8_TYPES): return value if not isinstance(value, text_type)...
def maps_get_default_rules_input_rbridge_id(self, **kwargs): """Auto Generated Code """ config = ET.Element("config") maps_get_default_rules = ET.Element("maps_get_default_rules") config = maps_get_default_rules input = ET.SubElement(maps_get_default_rules, "input") ...
Auto Generated Code
Below is the the instruction that describes the task: ### Input: Auto Generated Code ### Response: def maps_get_default_rules_input_rbridge_id(self, **kwargs): """Auto Generated Code """ config = ET.Element("config") maps_get_default_rules = ET.Element("maps_get_default_rules") ...
def main(): """ NAME k15_s.py DESCRIPTION converts .k15 format data to .s format. assumes Jelinek Kappabridge measurement scheme SYNTAX k15_s.py [-h][-i][command line options][<filename] OPTIONS -h prints help message and quits -i allows inte...
NAME k15_s.py DESCRIPTION converts .k15 format data to .s format. assumes Jelinek Kappabridge measurement scheme SYNTAX k15_s.py [-h][-i][command line options][<filename] OPTIONS -h prints help message and quits -i allows interactive entry of options...
Below is the the instruction that describes the task: ### Input: NAME k15_s.py DESCRIPTION converts .k15 format data to .s format. assumes Jelinek Kappabridge measurement scheme SYNTAX k15_s.py [-h][-i][command line options][<filename] OPTIONS -h prints ...
def str_to_python_object(input_str): """ a conversion that will import a module and class name """ if not input_str: return None if six.PY3 and isinstance(input_str, six.binary_type): input_str = to_str(input_str) if not isinstance(input_str, six.string_types): # gosh, we did...
a conversion that will import a module and class name
Below is the the instruction that describes the task: ### Input: a conversion that will import a module and class name ### Response: def str_to_python_object(input_str): """ a conversion that will import a module and class name """ if not input_str: return None if six.PY3 and isinstance(inp...
def visible(self): """ Only shown on the sharing view """ context_state = api.content.get_view(context=self.context, request=self.request, name="plone_context_state") url = context_state.cur...
Only shown on the sharing view
Below is the the instruction that describes the task: ### Input: Only shown on the sharing view ### Response: def visible(self): """ Only shown on the sharing view """ context_state = api.content.get_view(context=self.context, request=sel...
def generate_thumb(self, image): """ Given a (large) image, generate a 10x10px thumbnail with blur effect (in order to keep the size small) """ image_file = image.file picture = Image.open(image_file).convert('RGB') picture.thumbnail((10, 10)) picture.filt...
Given a (large) image, generate a 10x10px thumbnail with blur effect (in order to keep the size small)
Below is the the instruction that describes the task: ### Input: Given a (large) image, generate a 10x10px thumbnail with blur effect (in order to keep the size small) ### Response: def generate_thumb(self, image): """ Given a (large) image, generate a 10x10px thumbnail with blur ef...
def start(ctx, **kwargs): """ start a vaping process """ update_context(ctx, kwargs) daemon = mk_daemon(ctx) if ctx.debug or kwargs['no_fork']: daemon.run() else: daemon.start()
start a vaping process
Below is the the instruction that describes the task: ### Input: start a vaping process ### Response: def start(ctx, **kwargs): """ start a vaping process """ update_context(ctx, kwargs) daemon = mk_daemon(ctx) if ctx.debug or kwargs['no_fork']: daemon.run() else: daem...
def image_info(call=None, kwargs=None): ''' Retrieves information for a given image. Either a name or an image_id must be supplied. .. versionadded:: 2016.3.0 name The name of the image for which to gather information. Can be used instead of ``image_id``. image_id The ...
Retrieves information for a given image. Either a name or an image_id must be supplied. .. versionadded:: 2016.3.0 name The name of the image for which to gather information. Can be used instead of ``image_id``. image_id The ID of the image for which to gather information. Can...
Below is the the instruction that describes the task: ### Input: Retrieves information for a given image. Either a name or an image_id must be supplied. .. versionadded:: 2016.3.0 name The name of the image for which to gather information. Can be used instead of ``image_id``. imag...
def has_been_completed_by(poll, user): """ This will return a boolean indicating if the passed user has already voted in the given poll. Usage:: {% if poll|has_been_completed_by:user %}...{% endif %} """ user_votes = TopicPollVote.objects.filter( poll_option__poll=poll) if ...
This will return a boolean indicating if the passed user has already voted in the given poll. Usage:: {% if poll|has_been_completed_by:user %}...{% endif %}
Below is the the instruction that describes the task: ### Input: This will return a boolean indicating if the passed user has already voted in the given poll. Usage:: {% if poll|has_been_completed_by:user %}...{% endif %} ### Response: def has_been_completed_by(poll, user): """ This will r...
def _get_all_relationships(self): """Return all relationships seen in GO Dag subset.""" relationships_all = set() for goterm in self.go2obj.values(): if goterm.relationship: relationships_all.update(goterm.relationship) if goterm.relationship_rev: ...
Return all relationships seen in GO Dag subset.
Below is the the instruction that describes the task: ### Input: Return all relationships seen in GO Dag subset. ### Response: def _get_all_relationships(self): """Return all relationships seen in GO Dag subset.""" relationships_all = set() for goterm in self.go2obj.values(): if...
def create_ca_signed_cert(ca_name, CN, days=365, cacert_path=None, ca_filename=None, cert_path=None, cert_filename=None, digest='sha256', ...
Create a Certificate (CERT) signed by a named Certificate Authority (CA) If the certificate file already exists, the function just returns assuming the CERT already exists. The CN *must* match an existing CSR generated by create_csr. If it does not, this method does nothing. ca_name name ...
Below is the the instruction that describes the task: ### Input: Create a Certificate (CERT) signed by a named Certificate Authority (CA) If the certificate file already exists, the function just returns assuming the CERT already exists. The CN *must* match an existing CSR generated by create_csr. If ...
def times_csv(path, times, annotations=None, delimiter=',', fmt='%0.3f'): r"""Save time steps as in CSV format. This can be used to store the output of a beat-tracker or segmentation algorithm. If only `times` are provided, the file will contain each value of `times` on a row:: times[0]\n ...
r"""Save time steps as in CSV format. This can be used to store the output of a beat-tracker or segmentation algorithm. If only `times` are provided, the file will contain each value of `times` on a row:: times[0]\n times[1]\n times[2]\n ... If `annotations` are also ...
Below is the the instruction that describes the task: ### Input: r"""Save time steps as in CSV format. This can be used to store the output of a beat-tracker or segmentation algorithm. If only `times` are provided, the file will contain each value of `times` on a row:: times[0]\n time...
def contextMenuEvent(self, event): """ Handles the default menu options for the orb widget. :param event | <QContextMenuEvent> """ if self.contextMenuPolicy() == Qt.DefaultContextMenu: self.showMenu(event.pos()) else: super(X...
Handles the default menu options for the orb widget. :param event | <QContextMenuEvent>
Below is the the instruction that describes the task: ### Input: Handles the default menu options for the orb widget. :param event | <QContextMenuEvent> ### Response: def contextMenuEvent(self, event): """ Handles the default menu options for the orb widget. ...
def show(self, hide_replace=True): """Overrides Qt Method""" QWidget.show(self) self.visibility_changed.emit(True) self.change_number_matches() if self.editor is not None: if hide_replace: if self.replace_widgets[0].isVisible(): ...
Overrides Qt Method
Below is the the instruction that describes the task: ### Input: Overrides Qt Method ### Response: def show(self, hide_replace=True): """Overrides Qt Method""" QWidget.show(self) self.visibility_changed.emit(True) self.change_number_matches() if self.editor is not None:...
def delay(self, func, args=None, kwargs=None, queue=None, hard_timeout=None, unique=None, lock=None, lock_key=None, when=None, retry=None, retry_on=None, retry_method=None, max_queue_size=None): """ Queues a task. See README.rst for an explanation of the options...
Queues a task. See README.rst for an explanation of the options.
Below is the the instruction that describes the task: ### Input: Queues a task. See README.rst for an explanation of the options. ### Response: def delay(self, func, args=None, kwargs=None, queue=None, hard_timeout=None, unique=None, lock=None, lock_key=None, when=None, retry=None, retr...
def get_favourite_account_aggregates(self) -> List[AccountAggregate]: """ Returns the list of aggregates for favourite accounts """ accounts = self.get_favourite_accounts() aggregates = [] for account in accounts: aggregate = self.get_account_aggregate(account) ag...
Returns the list of aggregates for favourite accounts
Below is the the instruction that describes the task: ### Input: Returns the list of aggregates for favourite accounts ### Response: def get_favourite_account_aggregates(self) -> List[AccountAggregate]: """ Returns the list of aggregates for favourite accounts """ accounts = self.get_favourite_acco...
def create_or_update_vmextension(call=None, kwargs=None): # pylint: disable=unused-argument ''' .. versionadded:: 2019.2.0 Create or update a VM extension object "inside" of a VM object. required kwargs: .. code-block:: yaml extension_name: myvmextension virtual_machine_name: m...
.. versionadded:: 2019.2.0 Create or update a VM extension object "inside" of a VM object. required kwargs: .. code-block:: yaml extension_name: myvmextension virtual_machine_name: myvm settings: {"commandToExecute": "hostname"} optional kwargs: .. code-block:: yaml ...
Below is the the instruction that describes the task: ### Input: .. versionadded:: 2019.2.0 Create or update a VM extension object "inside" of a VM object. required kwargs: .. code-block:: yaml extension_name: myvmextension virtual_machine_name: myvm settings: {"commandToExe...
def delete(self, filename, storage_type=None, bucket_name=None): """Deletes the specified file, either locally or from S3, depending on the file's storage type.""" if not (storage_type and bucket_name): self._delete_local(filename) else: if storage_type != 's3': ...
Deletes the specified file, either locally or from S3, depending on the file's storage type.
Below is the the instruction that describes the task: ### Input: Deletes the specified file, either locally or from S3, depending on the file's storage type. ### Response: def delete(self, filename, storage_type=None, bucket_name=None): """Deletes the specified file, either locally or from S3, depending on...
def WeightedMajority(predictors, weights): "Return a predictor that takes a weighted vote." def predict(example): return weighted_mode((predictor(example) for predictor in predictors), weights) return predict
Return a predictor that takes a weighted vote.
Below is the the instruction that describes the task: ### Input: Return a predictor that takes a weighted vote. ### Response: def WeightedMajority(predictors, weights): "Return a predictor that takes a weighted vote." def predict(example): return weighted_mode((predictor(example) for predictor in p...
def run_later(self, callable_, timeout, *args, **kwargs): """Schedules the specified callable for delayed execution. Returns a TimerTask instance that can be used to cancel pending execution. """ self.lock.acquire() try: if self.die: raise Ru...
Schedules the specified callable for delayed execution. Returns a TimerTask instance that can be used to cancel pending execution.
Below is the the instruction that describes the task: ### Input: Schedules the specified callable for delayed execution. Returns a TimerTask instance that can be used to cancel pending execution. ### Response: def run_later(self, callable_, timeout, *args, **kwargs): """Schedules the speci...
def daemons_reachability_check(self): """Manage the list of Alignak launched daemons Check if the daemon process is running :return: True if all daemons are running, else False """ # First look if it's not too early to ping start = time.time() if self.daemons_l...
Manage the list of Alignak launched daemons Check if the daemon process is running :return: True if all daemons are running, else False
Below is the the instruction that describes the task: ### Input: Manage the list of Alignak launched daemons Check if the daemon process is running :return: True if all daemons are running, else False ### Response: def daemons_reachability_check(self): """Manage the list of Alignak launc...
def filter_event_list(event_list, scene_label=None, event_label=None, filename=None): """Filter event list based on given fields Parameters ---------- event_list : list, shape=(n,) A list containing event dicts scene_label : str Scene label event_label : str Event labe...
Filter event list based on given fields Parameters ---------- event_list : list, shape=(n,) A list containing event dicts scene_label : str Scene label event_label : str Event label filename : str Filename Returns ------- event_list: list, shape=(...
Below is the the instruction that describes the task: ### Input: Filter event list based on given fields Parameters ---------- event_list : list, shape=(n,) A list containing event dicts scene_label : str Scene label event_label : str Event label filename : str ...
def decrypt(self, key, dev_addr): """ Decrypt the actual payload in this LoraPayload. key: 16-byte hex-encoded AES key. (i.e. AABBCCDDEEFFAABBCCDDEEFFAABBCCDD) dev_addr: 4-byte hex-encoded DevAddr (i.e. AABBCCDD) """ sequence_counter = int(self.FCntUp) return lo...
Decrypt the actual payload in this LoraPayload. key: 16-byte hex-encoded AES key. (i.e. AABBCCDDEEFFAABBCCDDEEFFAABBCCDD) dev_addr: 4-byte hex-encoded DevAddr (i.e. AABBCCDD)
Below is the the instruction that describes the task: ### Input: Decrypt the actual payload in this LoraPayload. key: 16-byte hex-encoded AES key. (i.e. AABBCCDDEEFFAABBCCDDEEFFAABBCCDD) dev_addr: 4-byte hex-encoded DevAddr (i.e. AABBCCDD) ### Response: def decrypt(self, key, dev_addr): ""...
def count_frameshift_total(mut_df, bed_path, use_unmapped=False, to_zero_based=False): """Count frameshifts for each gene. Parameters ---------- mut_df : pd.DataFrame mutation input bed_path : str path ...
Count frameshifts for each gene. Parameters ---------- mut_df : pd.DataFrame mutation input bed_path : str path to BED file containing reference tx for genes use_unmapped : Bool flag indicating whether to include frameshifts not mapping to reference tx to_zero_ba...
Below is the the instruction that describes the task: ### Input: Count frameshifts for each gene. Parameters ---------- mut_df : pd.DataFrame mutation input bed_path : str path to BED file containing reference tx for genes use_unmapped : Bool flag indicating whether to i...
def copy_file(self, dest_folder_id, source_file_id, on_duplicate=None): """ Copy a file. Copy a file from elsewhere in Canvas into a folder. Copying a file across contexts (between courses and users) is permitted, but the source and destination must belong to the...
Copy a file. Copy a file from elsewhere in Canvas into a folder. Copying a file across contexts (between courses and users) is permitted, but the source and destination must belong to the same institution.
Below is the the instruction that describes the task: ### Input: Copy a file. Copy a file from elsewhere in Canvas into a folder. Copying a file across contexts (between courses and users) is permitted, but the source and destination must belong to the same institution. ### Re...
def simple_balance(self, as_of=None, raw=False, leg_query=None, **kwargs): """Get the balance for this account, ignoring all child accounts Args: as_of (Date): Only include transactions on or before this date raw (bool): If true the returned balance should not have its sign ...
Get the balance for this account, ignoring all child accounts Args: as_of (Date): Only include transactions on or before this date raw (bool): If true the returned balance should not have its sign adjusted for display purposes. leg_query (models.Q): D...
Below is the the instruction that describes the task: ### Input: Get the balance for this account, ignoring all child accounts Args: as_of (Date): Only include transactions on or before this date raw (bool): If true the returned balance should not have its sign ...
def precision_recall_by_user(observed_user_items, recommendations, cutoffs=[10]): """ Compute precision and recall at a given cutoff for each user. In information retrieval terms, precision represents the ratio of relevant, retrieved items to the...
Compute precision and recall at a given cutoff for each user. In information retrieval terms, precision represents the ratio of relevant, retrieved items to the number of relevant items. Recall represents the ratio of relevant, retrieved items to the number of relevant items. Let :math:`p_k` be a vecto...
Below is the the instruction that describes the task: ### Input: Compute precision and recall at a given cutoff for each user. In information retrieval terms, precision represents the ratio of relevant, retrieved items to the number of relevant items. Recall represents the ratio of relevant, retrieved i...
def prevSolarEclipse(date): """ Returns the Datetime of the maximum phase of the previous global solar eclipse. """ eclipse = swe.solarEclipseGlobal(date.jd, backward=True) return Datetime.fromJD(eclipse['maximum'], date.utcoffset)
Returns the Datetime of the maximum phase of the previous global solar eclipse.
Below is the the instruction that describes the task: ### Input: Returns the Datetime of the maximum phase of the previous global solar eclipse. ### Response: def prevSolarEclipse(date): """ Returns the Datetime of the maximum phase of the previous global solar eclipse. """ eclipse = swe.sola...
def convert2wavenumber(self): """ Convert from wavelengths to wavenumber. Units: Wavelength: micro meters (1e-6 m) Wavenumber: cm-1 """ self.wavenumber = 1. / (1e-4 * self.wavelength[::-1]) self.irradiance = (self.irradiance[::-1] * ...
Convert from wavelengths to wavenumber. Units: Wavelength: micro meters (1e-6 m) Wavenumber: cm-1
Below is the the instruction that describes the task: ### Input: Convert from wavelengths to wavenumber. Units: Wavelength: micro meters (1e-6 m) Wavenumber: cm-1 ### Response: def convert2wavenumber(self): """ Convert from wavelengths to wavenumber. Units: ...
def IsDeletedOrDefault(clean_lines, linenum): """Check if current constructor or operator is deleted or default. Args: clean_lines: A CleansedLines instance containing the file. linenum: The number of the line to check. Returns: True if this is a deleted or default constructor. """ open_paren = c...
Check if current constructor or operator is deleted or default. Args: clean_lines: A CleansedLines instance containing the file. linenum: The number of the line to check. Returns: True if this is a deleted or default constructor.
Below is the the instruction that describes the task: ### Input: Check if current constructor or operator is deleted or default. Args: clean_lines: A CleansedLines instance containing the file. linenum: The number of the line to check. Returns: True if this is a deleted or default constructor. ### ...
def sign(self, identity, blob): """Sign given blob and return the signature (as bytes).""" path = _expand_path(identity.get_bip32_address(ecdh=False)) if identity.identity_dict['proto'] == 'ssh': ins = '04' p1 = '00' else: ins = '08' p1 = '...
Sign given blob and return the signature (as bytes).
Below is the the instruction that describes the task: ### Input: Sign given blob and return the signature (as bytes). ### Response: def sign(self, identity, blob): """Sign given blob and return the signature (as bytes).""" path = _expand_path(identity.get_bip32_address(ecdh=False)) if ident...
def get_default_config(self): """ Returns the default collector settings """ config = super(ProcessStatCollector, self).get_default_config() config.update({ 'path': 'proc' }) return config
Returns the default collector settings
Below is the the instruction that describes the task: ### Input: Returns the default collector settings ### Response: def get_default_config(self): """ Returns the default collector settings """ config = super(ProcessStatCollector, self).get_default_config() config.update({ ...
def run_pylint(filename): """ Runs pylint on a given file :param filename: :return: list of pylint errors """ ARGS = [ '-r', 'n' ] pylint_output = WritableObject() Run([filename]+ARGS, reporter=TextReporter(pylint_output), exit=False) lines = [] for line in p...
Runs pylint on a given file :param filename: :return: list of pylint errors
Below is the the instruction that describes the task: ### Input: Runs pylint on a given file :param filename: :return: list of pylint errors ### Response: def run_pylint(filename): """ Runs pylint on a given file :param filename: :return: list of pylint errors """ ARGS = [ '...
def generate_random_type(valid): """ Generate a random type and samples for it. :param valid: Generate valid samples? :type valid: bool :return: type, sample-generator :rtype: type, generator """ type = choice(['int', 'str']) r = lambda: randrange(-1000000000, 1000000000) if type ...
Generate a random type and samples for it. :param valid: Generate valid samples? :type valid: bool :return: type, sample-generator :rtype: type, generator
Below is the the instruction that describes the task: ### Input: Generate a random type and samples for it. :param valid: Generate valid samples? :type valid: bool :return: type, sample-generator :rtype: type, generator ### Response: def generate_random_type(valid): """ Generate a random type ...
def tcp(q, where, timeout=None, port=53, af=None, source=None, source_port=0, one_rr_per_rrset=False): """Return the response obtained after sending a query via TCP. @param q: the query @type q: dns.message.Message object @param where: where to send the message @type where: string containin...
Return the response obtained after sending a query via TCP. @param q: the query @type q: dns.message.Message object @param where: where to send the message @type where: string containing an IPv4 or IPv6 address @param timeout: The number of seconds to wait before the query times out. If None, t...
Below is the the instruction that describes the task: ### Input: Return the response obtained after sending a query via TCP. @param q: the query @type q: dns.message.Message object @param where: where to send the message @type where: string containing an IPv4 or IPv6 address @param timeout: The...
def from_id(cls, pipeline_id, resolve_outputs=True, _pipeline_record=None): """Returns an instance corresponding to an existing Pipeline. The returned object will have the same properties a Pipeline does while it's running synchronously (e.g., like what it's first allocated), allowing callers to inspec...
Returns an instance corresponding to an existing Pipeline. The returned object will have the same properties a Pipeline does while it's running synchronously (e.g., like what it's first allocated), allowing callers to inspect caller arguments, outputs, fill slots, complete the pipeline, abort, retry, e...
Below is the the instruction that describes the task: ### Input: Returns an instance corresponding to an existing Pipeline. The returned object will have the same properties a Pipeline does while it's running synchronously (e.g., like what it's first allocated), allowing callers to inspect caller argum...
def _str_subgroups(self): """ helper function to render subgroups as a string """ if not self.subgroups: return "" return ['subGroups %s' % ' '.join(['%s=%s' % (k, v) for (k, v) in self.subgroups.items()])]
helper function to render subgroups as a string
Below is the the instruction that describes the task: ### Input: helper function to render subgroups as a string ### Response: def _str_subgroups(self): """ helper function to render subgroups as a string """ if not self.subgroups: return "" return ['subGroups %s...
def parse_translation(f, lineno): """Read a single translation entry from the file F and return a tuple with the comments, msgid and msgstr. The comments is returned as a list of lines which do not end in new-lines. The msgid and msgstr are strings, possibly with embedded newlines""" line = f...
Read a single translation entry from the file F and return a tuple with the comments, msgid and msgstr. The comments is returned as a list of lines which do not end in new-lines. The msgid and msgstr are strings, possibly with embedded newlines
Below is the the instruction that describes the task: ### Input: Read a single translation entry from the file F and return a tuple with the comments, msgid and msgstr. The comments is returned as a list of lines which do not end in new-lines. The msgid and msgstr are strings, possibly with embedde...
def add_ini_profile(self, cp, sec): """Add profile from configuration file. Parameters ----------- cp : ConfigParser object The ConfigParser object holding the workflow configuration settings sec : string The section containing options for this job. ...
Add profile from configuration file. Parameters ----------- cp : ConfigParser object The ConfigParser object holding the workflow configuration settings sec : string The section containing options for this job.
Below is the the instruction that describes the task: ### Input: Add profile from configuration file. Parameters ----------- cp : ConfigParser object The ConfigParser object holding the workflow configuration settings sec : string The section containing optio...
def _verify_service_agreement_signature(self, did, agreement_id, service_definition_id, consumer_address, signature, ddo=None): """ Verify service agreement signature. Verify that the given signature is truly signed by the `consumer_address` a...
Verify service agreement signature. Verify that the given signature is truly signed by the `consumer_address` and represents this did's service agreement.. :param did: DID, str :param agreement_id: id of the agreement, hex str :param service_definition_id: identifier of the ser...
Below is the the instruction that describes the task: ### Input: Verify service agreement signature. Verify that the given signature is truly signed by the `consumer_address` and represents this did's service agreement.. :param did: DID, str :param agreement_id: id of the agreement...
def operation_recorder_stage_result(self, ret, exc): """ **Experimental:** Low-level method used by the operation-specific methods of this class. *New in pywbem 0.9 as experimental.* It forwards the operation results including exceptions that were raised, to all recorde...
**Experimental:** Low-level method used by the operation-specific methods of this class. *New in pywbem 0.9 as experimental.* It forwards the operation results including exceptions that were raised, to all recorders of this connection, and causes the forwarded information to be...
Below is the the instruction that describes the task: ### Input: **Experimental:** Low-level method used by the operation-specific methods of this class. *New in pywbem 0.9 as experimental.* It forwards the operation results including exceptions that were raised, to all recorders o...
def from_callable_parameter(cls, parameter): """ Produces a parameter from a function or method """ if parameter.kind == parameter.KEYWORD_ONLY or \ parameter.kind == parameter.POSITIONAL_OR_KEYWORD and parameter.default is not parameter.empty: if parameter.an...
Produces a parameter from a function or method
Below is the the instruction that describes the task: ### Input: Produces a parameter from a function or method ### Response: def from_callable_parameter(cls, parameter): """ Produces a parameter from a function or method """ if parameter.kind == parameter.KEYWORD_ONLY or \ ...
def commit(self): """Commit current transaction.""" if (not self._add_cache and not self._remove_cache and not self._undefined_cache): return for store_key, hash_values in self._add_cache.items(): for hash_value in hash_values: ...
Commit current transaction.
Below is the the instruction that describes the task: ### Input: Commit current transaction. ### Response: def commit(self): """Commit current transaction.""" if (not self._add_cache and not self._remove_cache and not self._undefined_cache): return ...
def filter(self, **kwargs): """ Returns a list of objects from the database. The kwargs parameter can contain any number of attributes. Only objects which contain all listed attributes and in which all values match for all listed attributes will be returned. """ ...
Returns a list of objects from the database. The kwargs parameter can contain any number of attributes. Only objects which contain all listed attributes and in which all values match for all listed attributes will be returned.
Below is the the instruction that describes the task: ### Input: Returns a list of objects from the database. The kwargs parameter can contain any number of attributes. Only objects which contain all listed attributes and in which all values match for all listed attributes will be re...
def html_singleAll(self,template="basic"): """generate a data view for every ABF in the project folder.""" for fname in smartSort(self.cells): if template=="fixed": self.html_single_fixed(fname) else: self.html_single_basic(fname)
generate a data view for every ABF in the project folder.
Below is the the instruction that describes the task: ### Input: generate a data view for every ABF in the project folder. ### Response: def html_singleAll(self,template="basic"): """generate a data view for every ABF in the project folder.""" for fname in smartSort(self.cells): if temp...
def query_options(self): """Options to apply to the query for the view. Set this to configure relationship and column loading. By default, this calls the ``get_query_options`` method on the serializer with a `Load` object bound to the model, if that serializer method exists. ...
Options to apply to the query for the view. Set this to configure relationship and column loading. By default, this calls the ``get_query_options`` method on the serializer with a `Load` object bound to the model, if that serializer method exists.
Below is the the instruction that describes the task: ### Input: Options to apply to the query for the view. Set this to configure relationship and column loading. By default, this calls the ``get_query_options`` method on the serializer with a `Load` object bound to the model, if that ser...
def replace(parent, idx, value, check_value=_NO_VAL): """Replace a value in a dict.""" if isinstance(parent, dict): if idx not in parent: raise JSONPatchError("Item does not exist") elif isinstance(parent, list): idx = int(idx) if idx < 0 or idx >= len(parent): raise JSONPatchError("List i...
Replace a value in a dict.
Below is the the instruction that describes the task: ### Input: Replace a value in a dict. ### Response: def replace(parent, idx, value, check_value=_NO_VAL): """Replace a value in a dict.""" if isinstance(parent, dict): if idx not in parent: raise JSONPatchError("Item does not exist") elif isinst...
def var_unset(session, name): """ Unsets the given variable """ name = name.strip() try: session.unset(name) except KeyError: session.write_line("Unknown variable: {0}", name) return False else: session.write_line("V...
Unsets the given variable
Below is the the instruction that describes the task: ### Input: Unsets the given variable ### Response: def var_unset(session, name): """ Unsets the given variable """ name = name.strip() try: session.unset(name) except KeyError: session.writ...
def _openfile(h5file): """ Open an archive if input is a path. Parameters ---------- h5file : str or h5py.File Filename or h5py.File instance of the archive. Returns ------- f : h5py.File Returns a h5py.File instance. opened : bool True is `h5fi...
Open an archive if input is a path. Parameters ---------- h5file : str or h5py.File Filename or h5py.File instance of the archive. Returns ------- f : h5py.File Returns a h5py.File instance. opened : bool True is `h5file` is a path; False if `h5file` is...
Below is the the instruction that describes the task: ### Input: Open an archive if input is a path. Parameters ---------- h5file : str or h5py.File Filename or h5py.File instance of the archive. Returns ------- f : h5py.File Returns a h5py.File instance. o...
def name(self, decl_string): """implementation details""" if not self.has_pattern(decl_string): return decl_string args_begin = decl_string.find(self.__begin) return decl_string[0: args_begin].strip()
implementation details
Below is the the instruction that describes the task: ### Input: implementation details ### Response: def name(self, decl_string): """implementation details""" if not self.has_pattern(decl_string): return decl_string args_begin = decl_string.find(self.__begin) return dec...
def main(argv=sys.argv): # type: (List[str]) -> int """Parse and check the command line arguments.""" parser = optparse.OptionParser( usage="""\ usage: %prog [options] -o <output_path> <module_path> [exclude_pattern, ...] Look recursively in <module_path> for Python modules and packages and create ...
Parse and check the command line arguments.
Below is the the instruction that describes the task: ### Input: Parse and check the command line arguments. ### Response: def main(argv=sys.argv): # type: (List[str]) -> int """Parse and check the command line arguments.""" parser = optparse.OptionParser( usage="""\ usage: %prog [options] -o <...
def items(self): '''gets the property value for items''' self.__init() items = [] for item in self._items: items.append( UserItem(url="%s/items/%s" % (self.location, item['id']), securityHandler=self._securityHandler, ...
gets the property value for items
Below is the the instruction that describes the task: ### Input: gets the property value for items ### Response: def items(self): '''gets the property value for items''' self.__init() items = [] for item in self._items: items.append( UserItem(url="%s/item...
def context_chunks(self, context): """ Retrieves all tokens, divided into the chunks in context ``context``. If ``context`` is not found in a feature, then the feature will be treated as a single chunk. Parameters ---------- context : str Context nam...
Retrieves all tokens, divided into the chunks in context ``context``. If ``context`` is not found in a feature, then the feature will be treated as a single chunk. Parameters ---------- context : str Context name. Returns ------- papers : li...
Below is the the instruction that describes the task: ### Input: Retrieves all tokens, divided into the chunks in context ``context``. If ``context`` is not found in a feature, then the feature will be treated as a single chunk. Parameters ---------- context : str ...
def convert_catalog_id_to_object_id_string(catalog_id): """When doing hierarchies, need to convert a catalogId into an ObjectId, so convert to a string, then into a hex format. i.e. Bank Assessment hierarchy should become BANKASSESSME '42414e4b4153534553534d45' """ if not isinst...
When doing hierarchies, need to convert a catalogId into an ObjectId, so convert to a string, then into a hex format. i.e. Bank Assessment hierarchy should become BANKASSESSME '42414e4b4153534553534d45'
Below is the the instruction that describes the task: ### Input: When doing hierarchies, need to convert a catalogId into an ObjectId, so convert to a string, then into a hex format. i.e. Bank Assessment hierarchy should become BANKASSESSME '42414e4b4153534553534d45' ### Response: def co...
def get_output(self): """ Returns the generated JavaScript code. Returns: str """ # generate the JS function string template_function = TEMPLATE_WRAPPER.format( function_name=self.js_function_name, template_code=self.output.getvalue() ...
Returns the generated JavaScript code. Returns: str
Below is the the instruction that describes the task: ### Input: Returns the generated JavaScript code. Returns: str ### Response: def get_output(self): """ Returns the generated JavaScript code. Returns: str """ # generate the JS function s...