code
stringlengths
75
104k
docstring
stringlengths
1
46.9k
text
stringlengths
164
112k
def from_axis_angle(self, axis, angle): '''create a rotation matrix from axis and angle''' ux = axis.x uy = axis.y uz = axis.z ct = cos(angle) st = sin(angle) self.a.x = ct + (1-ct) * ux**2 self.a.y = ux*uy*(1-ct) - uz*st self.a.z = ux*uz*(1-ct) + ...
create a rotation matrix from axis and angle
Below is the the instruction that describes the task: ### Input: create a rotation matrix from axis and angle ### Response: def from_axis_angle(self, axis, angle): '''create a rotation matrix from axis and angle''' ux = axis.x uy = axis.y uz = axis.z ct = cos(angle) ...
def base_path(main_path, fmt): """Given a path and options for a format (ext, suffix, prefix), return the corresponding base path""" if not fmt: return os.path.splitext(main_path)[0] fmt = long_form_one_format(fmt) fmt_ext = fmt['extension'] suffix = fmt.get('suffix') prefix = fmt.get('...
Given a path and options for a format (ext, suffix, prefix), return the corresponding base path
Below is the the instruction that describes the task: ### Input: Given a path and options for a format (ext, suffix, prefix), return the corresponding base path ### Response: def base_path(main_path, fmt): """Given a path and options for a format (ext, suffix, prefix), return the corresponding base path""" ...
def fetch_items(self, category, **kwargs): """Fetch Google hit items :param category: the category of items to fetch :param kwargs: backend arguments :returns: a generator of items """ logger.info("Fetching data for '%s'", self.keywords) hits_raw = self.client....
Fetch Google hit items :param category: the category of items to fetch :param kwargs: backend arguments :returns: a generator of items
Below is the the instruction that describes the task: ### Input: Fetch Google hit items :param category: the category of items to fetch :param kwargs: backend arguments :returns: a generator of items ### Response: def fetch_items(self, category, **kwargs): """Fetch Google hit item...
def _get_room_ids_for_address( self, address: Address, filter_private: bool = None, ) -> List[_RoomID]: """ Uses GMatrixClient.get_account_data to get updated mapping of address->rooms It'll filter only existing rooms. If filter_private=True, also filter ...
Uses GMatrixClient.get_account_data to get updated mapping of address->rooms It'll filter only existing rooms. If filter_private=True, also filter out public rooms. If filter_private=None, filter according to self._private_rooms
Below is the the instruction that describes the task: ### Input: Uses GMatrixClient.get_account_data to get updated mapping of address->rooms It'll filter only existing rooms. If filter_private=True, also filter out public rooms. If filter_private=None, filter according to self._private_roo...
def show_linkinfo_output_show_link_info_linkinfo_isl_linkinfo_isl_linknumber(self, **kwargs): """Auto Generated Code """ config = ET.Element("config") show_linkinfo = ET.Element("show_linkinfo") config = show_linkinfo output = ET.SubElement(show_linkinfo, "output") ...
Auto Generated Code
Below is the the instruction that describes the task: ### Input: Auto Generated Code ### Response: def show_linkinfo_output_show_link_info_linkinfo_isl_linkinfo_isl_linknumber(self, **kwargs): """Auto Generated Code """ config = ET.Element("config") show_linkinfo = ET.Element("show_...
def warn_if_outdated(package, version, raise_exceptions=False, background=True, ): """ Higher level convenience function using check_outdated. The package and version arguments are the same. If the package is outdated,...
Higher level convenience function using check_outdated. The package and version arguments are the same. If the package is outdated, a warning (OutdatedPackageWarning) will be emitted. Any exception in check_outdated will be converted to a warning (OutdatedCheckFailedWarning) unless raise_exceptio...
Below is the the instruction that describes the task: ### Input: Higher level convenience function using check_outdated. The package and version arguments are the same. If the package is outdated, a warning (OutdatedPackageWarning) will be emitted. Any exception in check_outdated will be converte...
def stream(self, device_sid=values.unset, limit=None, page_size=None): """ Streams KeyInstance records from the API as a generator stream. This operation lazily loads records as efficiently as possible until the limit is reached. The results are returned as a generator, so this o...
Streams KeyInstance records from the API as a generator stream. This operation lazily loads records as efficiently as possible until the limit is reached. The results are returned as a generator, so this operation is memory efficient. :param unicode device_sid: Find all Keys authenticat...
Below is the the instruction that describes the task: ### Input: Streams KeyInstance records from the API as a generator stream. This operation lazily loads records as efficiently as possible until the limit is reached. The results are returned as a generator, so this operation is memory eff...
def parse_content(self, content): """ Parse the output of the ``alternatives`` command. """ self.program = None self.status = None self.link = None self.best = None self.paths = [] current_path = None # Set up instance variable for...
Parse the output of the ``alternatives`` command.
Below is the the instruction that describes the task: ### Input: Parse the output of the ``alternatives`` command. ### Response: def parse_content(self, content): """ Parse the output of the ``alternatives`` command. """ self.program = None self.status = None self.li...
def pots(self, refresh=False): """ Returns a list of pots owned by the currently authorised user. Official docs: https://monzo.com/docs/#pots :param refresh: decides if the pots information should be refreshed. :type refresh: bool :returns: list of Monzo pot...
Returns a list of pots owned by the currently authorised user. Official docs: https://monzo.com/docs/#pots :param refresh: decides if the pots information should be refreshed. :type refresh: bool :returns: list of Monzo pots :rtype: list of MonzoPot
Below is the the instruction that describes the task: ### Input: Returns a list of pots owned by the currently authorised user. Official docs: https://monzo.com/docs/#pots :param refresh: decides if the pots information should be refreshed. :type refresh: bool :returns:...
def parse_source(self, filename): """ Extract the statements from the given file, look for function calls `sass_processor(scss_file)` and compile the filename into CSS. """ callvisitor = FuncCallVisitor('sass_processor') tree = ast.parse(open(filename, 'rb').read()) ...
Extract the statements from the given file, look for function calls `sass_processor(scss_file)` and compile the filename into CSS.
Below is the the instruction that describes the task: ### Input: Extract the statements from the given file, look for function calls `sass_processor(scss_file)` and compile the filename into CSS. ### Response: def parse_source(self, filename): """ Extract the statements from the given file,...
def list_path(root_dir): """List directory if exists. :param dir: str :return: list """ res = [] if os.path.isdir(root_dir): for name in os.listdir(root_dir): res.append(name) return res
List directory if exists. :param dir: str :return: list
Below is the the instruction that describes the task: ### Input: List directory if exists. :param dir: str :return: list ### Response: def list_path(root_dir): """List directory if exists. :param dir: str :return: list """ res = [] if os.path.isdir(root_dir): for name in os....
def _score_for_model(meta): """ Returns mean score between tasks in pipeline that can be used for early stopping. """ mean_acc = list() pipes = meta["pipeline"] acc = meta["accuracy"] if "tagger" in pipes: mean_acc.append(acc["tags_acc"]) if "parser" in pipes: mean_acc.append((ac...
Returns mean score between tasks in pipeline that can be used for early stopping.
Below is the the instruction that describes the task: ### Input: Returns mean score between tasks in pipeline that can be used for early stopping. ### Response: def _score_for_model(meta): """ Returns mean score between tasks in pipeline that can be used for early stopping. """ mean_acc = list() pipes ...
def highlight_current_line(editor): """ Highlights given editor current line. :param editor: Document editor. :type editor: QWidget :return: Method success. :rtype: bool """ format = editor.language.theme.get("accelerator.line") if not format: return False extra_select...
Highlights given editor current line. :param editor: Document editor. :type editor: QWidget :return: Method success. :rtype: bool
Below is the the instruction that describes the task: ### Input: Highlights given editor current line. :param editor: Document editor. :type editor: QWidget :return: Method success. :rtype: bool ### Response: def highlight_current_line(editor): """ Highlights given editor current line. ...
def process(self): """ populate the report from the xml :return: """ suites = None if isinstance(self.tree, ET.Element): root = self.tree else: root = self.tree.getroot() if root.tag == "testrun": root = root[0] ...
populate the report from the xml :return:
Below is the the instruction that describes the task: ### Input: populate the report from the xml :return: ### Response: def process(self): """ populate the report from the xml :return: """ suites = None if isinstance(self.tree, ET.Element): root ...
def save_graph_only(sess, output_file_path, output_node_names, as_text=False): """Save a small version of the graph based on a session and the output node names.""" for node in sess.graph_def.node: node.device = '' graph_def = graph_util.extract_sub_graph(sess.graph_def, output_node_names) outpu...
Save a small version of the graph based on a session and the output node names.
Below is the the instruction that describes the task: ### Input: Save a small version of the graph based on a session and the output node names. ### Response: def save_graph_only(sess, output_file_path, output_node_names, as_text=False): """Save a small version of the graph based on a session and the output no...
def has_no_error( state, incorrect_msg="Your code generated an error. Fix it and try again!" ): """Check whether the submission did not generate a runtime error. Simply use ``Ex().has_no_error()`` in your SCT whenever you want to check for errors. By default, after the entire SCT finished executing, ``...
Check whether the submission did not generate a runtime error. Simply use ``Ex().has_no_error()`` in your SCT whenever you want to check for errors. By default, after the entire SCT finished executing, ``sqlwhat`` will check for errors before marking the exercise as correct. You can disable this behavior ...
Below is the the instruction that describes the task: ### Input: Check whether the submission did not generate a runtime error. Simply use ``Ex().has_no_error()`` in your SCT whenever you want to check for errors. By default, after the entire SCT finished executing, ``sqlwhat`` will check for errors be...
def make_batched_timer(self, bucket_seconds, chunk_size=100): """ Creates and returns an object implementing :class:`txaio.IBatchedTimer`. :param bucket_seconds: the number of seconds in each bucket. That is, a value of 5 means that any timeout within a 5 second ...
Creates and returns an object implementing :class:`txaio.IBatchedTimer`. :param bucket_seconds: the number of seconds in each bucket. That is, a value of 5 means that any timeout within a 5 second window will be in the same bucket, and get notified at the same time. ...
Below is the the instruction that describes the task: ### Input: Creates and returns an object implementing :class:`txaio.IBatchedTimer`. :param bucket_seconds: the number of seconds in each bucket. That is, a value of 5 means that any timeout within a 5 second window will b...
def db_exists(name, user=None, password=None, host=None, port=None): ''' Checks if a database exists in Influxdb name Database name to create user The user to connect as password The password of the user host The host to connect to port The port t...
Checks if a database exists in Influxdb name Database name to create user The user to connect as password The password of the user host The host to connect to port The port to connect to CLI Example: .. code-block:: bash salt '*' influx...
Below is the the instruction that describes the task: ### Input: Checks if a database exists in Influxdb name Database name to create user The user to connect as password The password of the user host The host to connect to port The port to connect to...
def get_dummy_run(nthread, nsamples, **kwargs): """Generate dummy data for a nested sampling run. Log-likelihood values of points are generated from a uniform distribution in (0, 1), sorted, scaled by logl_range and shifted by logl_start (if it is not -np.inf). Theta values of each point are each gener...
Generate dummy data for a nested sampling run. Log-likelihood values of points are generated from a uniform distribution in (0, 1), sorted, scaled by logl_range and shifted by logl_start (if it is not -np.inf). Theta values of each point are each generated from a uniform distribution in (0, 1). Pa...
Below is the the instruction that describes the task: ### Input: Generate dummy data for a nested sampling run. Log-likelihood values of points are generated from a uniform distribution in (0, 1), sorted, scaled by logl_range and shifted by logl_start (if it is not -np.inf). Theta values of each point ...
async def _build_state(self, request: Request, message: BaseMessage, responder: Responder) \ -> Tuple[ Optional[BaseState], Optional[BaseTrigger], Optional[bool], ]: ...
Build the state for this request.
Below is the the instruction that describes the task: ### Input: Build the state for this request. ### Response: async def _build_state(self, request: Request, message: BaseMessage, responder: Responder) \ -> Tuple[ ...
def await_results(url, pings=45, sleep=2): """ Ping {url} until it returns a results payload, timing out after {pings} pings and waiting {sleep} seconds between pings. """ print("Checking...", end="", flush=True) for _ in range(pings): # Query for check results. res = requests.p...
Ping {url} until it returns a results payload, timing out after {pings} pings and waiting {sleep} seconds between pings.
Below is the the instruction that describes the task: ### Input: Ping {url} until it returns a results payload, timing out after {pings} pings and waiting {sleep} seconds between pings. ### Response: def await_results(url, pings=45, sleep=2): """ Ping {url} until it returns a results payload, timing ou...
def _split_docker_uuid(uuid): ''' Split a smartos docker uuid into repo and tag ''' if uuid: uuid = uuid.split(':') if len(uuid) == 2: tag = uuid[1] repo = uuid[0] return repo, tag return None, None
Split a smartos docker uuid into repo and tag
Below is the the instruction that describes the task: ### Input: Split a smartos docker uuid into repo and tag ### Response: def _split_docker_uuid(uuid): ''' Split a smartos docker uuid into repo and tag ''' if uuid: uuid = uuid.split(':') if len(uuid) == 2: tag = uuid[...
def load_code_info(self): """Load coded info for all contained phases.""" return PhaseGroup( setup=load_code_info(self.setup), main=load_code_info(self.main), teardown=load_code_info(self.teardown), name=self.name)
Load coded info for all contained phases.
Below is the the instruction that describes the task: ### Input: Load coded info for all contained phases. ### Response: def load_code_info(self): """Load coded info for all contained phases.""" return PhaseGroup( setup=load_code_info(self.setup), main=load_code_info(self.main), tea...
def _read_mat_mnu0(filename): """Import a .mat file with single potentials (a b m) into a pandas DataFrame Also export some variables of the MD struct into a separate structure """ print('read_mag_single_file: {0}'.format(filename)) mat = sio.loadmat(filename, squeeze_me=True) # check the ...
Import a .mat file with single potentials (a b m) into a pandas DataFrame Also export some variables of the MD struct into a separate structure
Below is the the instruction that describes the task: ### Input: Import a .mat file with single potentials (a b m) into a pandas DataFrame Also export some variables of the MD struct into a separate structure ### Response: def _read_mat_mnu0(filename): """Import a .mat file with single potentials (a b...
def copy_plus(orig, new): """Copy a fils, including biological index files. """ for ext in ["", ".idx", ".gbi", ".tbi", ".bai"]: if os.path.exists(orig + ext) and (not os.path.lexists(new + ext) or not os.path.exists(new + ext)): shutil.copyfile(orig + ext, new + ext)
Copy a fils, including biological index files.
Below is the the instruction that describes the task: ### Input: Copy a fils, including biological index files. ### Response: def copy_plus(orig, new): """Copy a fils, including biological index files. """ for ext in ["", ".idx", ".gbi", ".tbi", ".bai"]: if os.path.exists(orig + ext) and (not o...
def encode(self, s): """ Encode special characters found in string I{s}. @param s: A string to encode. @type s: str @return: The encoded string. @rtype: str """ if isinstance(s, basestring) and self.needsEncoding(s): for x in self.encodings: ...
Encode special characters found in string I{s}. @param s: A string to encode. @type s: str @return: The encoded string. @rtype: str
Below is the the instruction that describes the task: ### Input: Encode special characters found in string I{s}. @param s: A string to encode. @type s: str @return: The encoded string. @rtype: str ### Response: def encode(self, s): """ Encode special characters found...
def check_int(integer): """ Check if number is integer or not. :param integer: Number as str :return: Boolean """ if not isinstance(integer, str): return False if integer[0] in ('-', '+'): return integer[1:].isdigit() return integer.isdigit()
Check if number is integer or not. :param integer: Number as str :return: Boolean
Below is the the instruction that describes the task: ### Input: Check if number is integer or not. :param integer: Number as str :return: Boolean ### Response: def check_int(integer): """ Check if number is integer or not. :param integer: Number as str :return: Boolean """ if not...
def process_tick(self, tup): """Called every window_duration """ curtime = int(time.time()) window_info = WindowContext(curtime - self.window_duration, curtime) self.processWindow(window_info, list(self.current_tuples)) for tup in self.current_tuples: self.ack(tup) self.current_tuples....
Called every window_duration
Below is the the instruction that describes the task: ### Input: Called every window_duration ### Response: def process_tick(self, tup): """Called every window_duration """ curtime = int(time.time()) window_info = WindowContext(curtime - self.window_duration, curtime) self.processWindow(window_...
def get_item(self, tablename, key, attributes=None, consistent=False, return_capacity=None): """ Fetch a single item from a table This uses the older version of the DynamoDB API. See also: :meth:`~.get_item2`. Parameters ---------- tablename : s...
Fetch a single item from a table This uses the older version of the DynamoDB API. See also: :meth:`~.get_item2`. Parameters ---------- tablename : str Name of the table to fetch from key : dict Primary key dict specifying the hash key and, if app...
Below is the the instruction that describes the task: ### Input: Fetch a single item from a table This uses the older version of the DynamoDB API. See also: :meth:`~.get_item2`. Parameters ---------- tablename : str Name of the table to fetch from key : ...
def handle(self, *args, **options): """ Processes the converted data into the yacms database correctly. Attributes: yacms_user: the user to put this data in against date_format: the format the dates are in for posts and comments """ yacms_user = options....
Processes the converted data into the yacms database correctly. Attributes: yacms_user: the user to put this data in against date_format: the format the dates are in for posts and comments
Below is the the instruction that describes the task: ### Input: Processes the converted data into the yacms database correctly. Attributes: yacms_user: the user to put this data in against date_format: the format the dates are in for posts and comments ### Response: def handle(sel...
def has_code(state, text, incorrect_msg="The checker expected to find `{{text}}` in your command.", fixed=False): """Check whether the student code contains text. This function is a simpler override of the `has_code` function in protowhat, because ``ast_node._get_text()`` is not implemented in the OSH pars...
Check whether the student code contains text. This function is a simpler override of the `has_code` function in protowhat, because ``ast_node._get_text()`` is not implemented in the OSH parser Using ``has_code()`` should be a last resort. It is always better to look at the result of code or the side e...
Below is the the instruction that describes the task: ### Input: Check whether the student code contains text. This function is a simpler override of the `has_code` function in protowhat, because ``ast_node._get_text()`` is not implemented in the OSH parser Using ``has_code()`` should be a last resort...
def transform(self, work, xml, objectId, subreference=None): """ Transform input according to potentially registered XSLT .. note:: Since 1.0.0, transform takes an objectId parameter which represent the passage which is called .. note:: Due to XSLT not being able to be used twice, we rexsltise...
Transform input according to potentially registered XSLT .. note:: Since 1.0.0, transform takes an objectId parameter which represent the passage which is called .. note:: Due to XSLT not being able to be used twice, we rexsltise the xml at every call of xslt .. warning:: Until a C libxslt er...
Below is the the instruction that describes the task: ### Input: Transform input according to potentially registered XSLT .. note:: Since 1.0.0, transform takes an objectId parameter which represent the passage which is called .. note:: Due to XSLT not being able to be used twice, we rexsltise the...
async def attach_tip(data): """ Attach a tip to the current pipette :param data: Information obtained from a POST request. The content type is application/json. The correct packet form should be as follows: { 'token': UUID token from current session start 'command': 'attach tip' ...
Attach a tip to the current pipette :param data: Information obtained from a POST request. The content type is application/json. The correct packet form should be as follows: { 'token': UUID token from current session start 'command': 'attach tip' 'tipLength': a float representing how...
Below is the the instruction that describes the task: ### Input: Attach a tip to the current pipette :param data: Information obtained from a POST request. The content type is application/json. The correct packet form should be as follows: { 'token': UUID token from current session start ...
def asserts(input_value, rule, message=''): """ this function allows you to write asserts in generators since there are moments where you actually want the program to halt when certain values are seen. """ assert callable(rule) or type(rule)==bool, 'asserts needs rule to be a callable functi...
this function allows you to write asserts in generators since there are moments where you actually want the program to halt when certain values are seen.
Below is the the instruction that describes the task: ### Input: this function allows you to write asserts in generators since there are moments where you actually want the program to halt when certain values are seen. ### Response: def asserts(input_value, rule, message=''): """ this function ...
def accept_override(self): """Unbind all conflicted shortcuts, and accept the new one""" conflicts = self.check_conflicts() if conflicts: for shortcut in conflicts: shortcut.key = '' self.accept()
Unbind all conflicted shortcuts, and accept the new one
Below is the the instruction that describes the task: ### Input: Unbind all conflicted shortcuts, and accept the new one ### Response: def accept_override(self): """Unbind all conflicted shortcuts, and accept the new one""" conflicts = self.check_conflicts() if conflicts: fo...
def parse(lines, root=None): """ Parses a list of lines from ls into dictionaries representing their components. Args: lines (list): A list of lines generated by ls. root (str): The directory name to be used for ls output stanzas that don't have a name. Returns: ...
Parses a list of lines from ls into dictionaries representing their components. Args: lines (list): A list of lines generated by ls. root (str): The directory name to be used for ls output stanzas that don't have a name. Returns: A dictionary representing the ls output....
Below is the the instruction that describes the task: ### Input: Parses a list of lines from ls into dictionaries representing their components. Args: lines (list): A list of lines generated by ls. root (str): The directory name to be used for ls output stanzas that don't have a...
def parse_radl(data): """ Parse a RADL document. Args: - data(str): filepath to a RADL content or a string with content. Return: RADL object. """ if data is None: return None elif os.path.isfile(data): f = open(data) data = "".join(f.readlines()) f.clos...
Parse a RADL document. Args: - data(str): filepath to a RADL content or a string with content. Return: RADL object.
Below is the the instruction that describes the task: ### Input: Parse a RADL document. Args: - data(str): filepath to a RADL content or a string with content. Return: RADL object. ### Response: def parse_radl(data): """ Parse a RADL document. Args: - data(str): filepath to a RADL co...
def drop_bad_characters(text): """Takes a text and drops all non-printable and non-ascii characters and also any whitespace characters that aren't space. :arg str text: the text to fix :returns: text with all bad characters dropped """ # Strip all non-ascii and non-printable characters te...
Takes a text and drops all non-printable and non-ascii characters and also any whitespace characters that aren't space. :arg str text: the text to fix :returns: text with all bad characters dropped
Below is the the instruction that describes the task: ### Input: Takes a text and drops all non-printable and non-ascii characters and also any whitespace characters that aren't space. :arg str text: the text to fix :returns: text with all bad characters dropped ### Response: def drop_bad_characters(...
def save(self, *args, **kwargs): """ Takes an optional last_save keyword argument other wise last_save will be set to timezone.now() Calls super to actually save the object. """ self.last_save = kwargs.pop('last_save', timezone.now()) super(Cloneable, self).save(...
Takes an optional last_save keyword argument other wise last_save will be set to timezone.now() Calls super to actually save the object.
Below is the the instruction that describes the task: ### Input: Takes an optional last_save keyword argument other wise last_save will be set to timezone.now() Calls super to actually save the object. ### Response: def save(self, *args, **kwargs): """ Takes an optional last_save k...
def _get_ex_data(self): """Return hierarchical function name.""" func_id, func_name = self._get_callable_path() if self._full_cname: func_name = self.encode_call(func_name) return func_id, func_name
Return hierarchical function name.
Below is the the instruction that describes the task: ### Input: Return hierarchical function name. ### Response: def _get_ex_data(self): """Return hierarchical function name.""" func_id, func_name = self._get_callable_path() if self._full_cname: func_name = self.encode_call(fun...
def GetSysFeeAmountByHeight(self, height): """ Get the system fee for the specified block. Args: height (int): block height. Returns: int: """ hash = self.GetBlockHash(height) return self.GetSysFeeAmount(hash)
Get the system fee for the specified block. Args: height (int): block height. Returns: int:
Below is the the instruction that describes the task: ### Input: Get the system fee for the specified block. Args: height (int): block height. Returns: int: ### Response: def GetSysFeeAmountByHeight(self, height): """ Get the system fee for the specified bl...
def special_links_replace(text, urls): ''' Replace simplified Regulations and Guidelines links into actual links. 'urls' dictionary is expected to provide actual links to the targeted Regulations and Guidelines, as well as to the PDF file. ''' match_number = r'([A-Za-z0-9]+)' + r'(\+*)' refe...
Replace simplified Regulations and Guidelines links into actual links. 'urls' dictionary is expected to provide actual links to the targeted Regulations and Guidelines, as well as to the PDF file.
Below is the the instruction that describes the task: ### Input: Replace simplified Regulations and Guidelines links into actual links. 'urls' dictionary is expected to provide actual links to the targeted Regulations and Guidelines, as well as to the PDF file. ### Response: def special_links_replace(text,...
def apply_effect_expression_filters( effects, gene_expression_dict, gene_expression_threshold, transcript_expression_dict, transcript_expression_threshold): """ Filter collection of varcode effects by given gene and transcript expression thresholds. Parameters ...
Filter collection of varcode effects by given gene and transcript expression thresholds. Parameters ---------- effects : varcode.EffectCollection gene_expression_dict : dict gene_expression_threshold : float transcript_expression_dict : dict transcript_expression_threshold : float
Below is the the instruction that describes the task: ### Input: Filter collection of varcode effects by given gene and transcript expression thresholds. Parameters ---------- effects : varcode.EffectCollection gene_expression_dict : dict gene_expression_threshold : float transcript_...
def flatten_reshape(variable, name='flatten'): """Reshapes a high-dimension vector input. [batch_size, mask_row, mask_col, n_mask] ---> [batch_size, mask_row x mask_col x n_mask] Parameters ---------- variable : TensorFlow variable or tensor The variable or tensor to be flatten. name :...
Reshapes a high-dimension vector input. [batch_size, mask_row, mask_col, n_mask] ---> [batch_size, mask_row x mask_col x n_mask] Parameters ---------- variable : TensorFlow variable or tensor The variable or tensor to be flatten. name : str A unique layer name. Returns ---...
Below is the the instruction that describes the task: ### Input: Reshapes a high-dimension vector input. [batch_size, mask_row, mask_col, n_mask] ---> [batch_size, mask_row x mask_col x n_mask] Parameters ---------- variable : TensorFlow variable or tensor The variable or tensor to be flat...
def do_login(self, line): "login aws-acces-key aws-secret" if line: args = self.getargs(line) self.conn = boto.connect_dynamodb( aws_access_key_id=args[0], aws_secret_access_key=args[1]) else: self.conn = boto.connect_dynamodb(...
login aws-acces-key aws-secret
Below is the the instruction that describes the task: ### Input: login aws-acces-key aws-secret ### Response: def do_login(self, line): "login aws-acces-key aws-secret" if line: args = self.getargs(line) self.conn = boto.connect_dynamodb( aws_access_key_id=a...
def _locked(func): """! Decorator to automatically lock an AccessPort method.""" def _locking(self, *args, **kwargs): try: self.lock() return func(self, *args, **kwargs) finally: self.unlock() return _locking
! Decorator to automatically lock an AccessPort method.
Below is the the instruction that describes the task: ### Input: ! Decorator to automatically lock an AccessPort method. ### Response: def _locked(func): """! Decorator to automatically lock an AccessPort method.""" def _locking(self, *args, **kwargs): try: self.lock() retur...
def _init_backends(self): """ Initialize auth backends. """ # fetch auth backends from config file self._backends = {} for section in self._config.sections(): # does the section define an auth backend? section_components = section.rsplit('.', 1) ...
Initialize auth backends.
Below is the the instruction that describes the task: ### Input: Initialize auth backends. ### Response: def _init_backends(self): """ Initialize auth backends. """ # fetch auth backends from config file self._backends = {} for section in self._config.sections(): ...
def _write_color (self, text, color=None): """Print text with given color. If color is None, print text as-is.""" if color is None: self.fp.write(text) else: write_color(self.fp, text, color)
Print text with given color. If color is None, print text as-is.
Below is the the instruction that describes the task: ### Input: Print text with given color. If color is None, print text as-is. ### Response: def _write_color (self, text, color=None): """Print text with given color. If color is None, print text as-is.""" if color is None: self.fp.wri...
def tickets_update_many(self, data, ids=None, **kwargs): "https://developer.zendesk.com/rest_api/docs/core/tickets#update-many-tickets" api_path = "/api/v2/tickets/update_many.json" api_query = {} if "query" in kwargs.keys(): api_query.update(kwargs["query"]) del ...
https://developer.zendesk.com/rest_api/docs/core/tickets#update-many-tickets
Below is the the instruction that describes the task: ### Input: https://developer.zendesk.com/rest_api/docs/core/tickets#update-many-tickets ### Response: def tickets_update_many(self, data, ids=None, **kwargs): "https://developer.zendesk.com/rest_api/docs/core/tickets#update-many-tickets" api_pat...
def wait_processed(self, timeout): """Wait until time outs, or this event is processed. Event must be waitable for this operation to have described semantics, for non-waitable returns true immediately. in timeout of type int Maximum time to wait for event processing, in ms; ...
Wait until time outs, or this event is processed. Event must be waitable for this operation to have described semantics, for non-waitable returns true immediately. in timeout of type int Maximum time to wait for event processing, in ms; 0 = no wait, -1 = indefinite wait. ...
Below is the the instruction that describes the task: ### Input: Wait until time outs, or this event is processed. Event must be waitable for this operation to have described semantics, for non-waitable returns true immediately. in timeout of type int Maximum time to wait for event proc...
def _domain_event_job_completed_cb(conn, domain, params, opaque): ''' Domain job completion events handler ''' _salt_send_domain_event(opaque, conn, domain, opaque['event'], { 'params': params })
Domain job completion events handler
Below is the the instruction that describes the task: ### Input: Domain job completion events handler ### Response: def _domain_event_job_completed_cb(conn, domain, params, opaque): ''' Domain job completion events handler ''' _salt_send_domain_event(opaque, conn, domain, opaque['event'], { ...
async def send_request(self, method, args=()): '''Send an RPC request over the network.''' message, event = self.connection.send_request(Request(method, args)) return await self._send_concurrent(message, event, 1)
Send an RPC request over the network.
Below is the the instruction that describes the task: ### Input: Send an RPC request over the network. ### Response: async def send_request(self, method, args=()): '''Send an RPC request over the network.''' message, event = self.connection.send_request(Request(method, args)) return await s...
def hr_diagram(cluster_name, output=None): """Create a :class:`~bokeh.plotting.figure.Figure` to create an H-R diagram using the cluster_name; then show it. Re """ cluster = get_hr_data(cluster_name) pf = hr_diagram_figure(cluster) show_with_bokeh_server(pf)
Create a :class:`~bokeh.plotting.figure.Figure` to create an H-R diagram using the cluster_name; then show it. Re
Below is the the instruction that describes the task: ### Input: Create a :class:`~bokeh.plotting.figure.Figure` to create an H-R diagram using the cluster_name; then show it. Re ### Response: def hr_diagram(cluster_name, output=None): """Create a :class:`~bokeh.plotting.figure.Figure` to create an H-...
def get_function_policy(self, function_name): # type: (str) -> Dict[str, Any] """Return the function policy for a lambda function. This function will extract the policy string as a json document and return the json.loads(...) version of the policy. """ client = self._cl...
Return the function policy for a lambda function. This function will extract the policy string as a json document and return the json.loads(...) version of the policy.
Below is the the instruction that describes the task: ### Input: Return the function policy for a lambda function. This function will extract the policy string as a json document and return the json.loads(...) version of the policy. ### Response: def get_function_policy(self, function_name): ...
def __create_index(self, keys, index_options, session, **kwargs): """Internal create index helper. :Parameters: - `keys`: a list of tuples [(key, type), (key, type), ...] - `index_options`: a dict of index options. - `session` (optional): a :class:`~pymongo.cli...
Internal create index helper. :Parameters: - `keys`: a list of tuples [(key, type), (key, type), ...] - `index_options`: a dict of index options. - `session` (optional): a :class:`~pymongo.client_session.ClientSession`.
Below is the the instruction that describes the task: ### Input: Internal create index helper. :Parameters: - `keys`: a list of tuples [(key, type), (key, type), ...] - `index_options`: a dict of index options. - `session` (optional): a :class:`~pymongo.client_sess...
def ReqOrderAction(self, OrderID: str): """撤单 :param OrderID: """ of = self.orders[OrderID] if not of: return -1 else: pOrderId = of.OrderID return self.t.ReqOrderAction( self.broker, self.investor, ...
撤单 :param OrderID:
Below is the the instruction that describes the task: ### Input: 撤单 :param OrderID: ### Response: def ReqOrderAction(self, OrderID: str): """撤单 :param OrderID: """ of = self.orders[OrderID] if not of: return -1 else: pOrderId = of.O...
def filter_human_only(stmts_in, **kwargs): """Filter out statements that are grounded, but not to a human gene. Parameters ---------- stmts_in : list[indra.statements.Statement] A list of statements to filter. save : Optional[str] The name of a pickle file to save the results (stmts...
Filter out statements that are grounded, but not to a human gene. Parameters ---------- stmts_in : list[indra.statements.Statement] A list of statements to filter. save : Optional[str] The name of a pickle file to save the results (stmts_out) into. remove_bound: Optional[bool] ...
Below is the the instruction that describes the task: ### Input: Filter out statements that are grounded, but not to a human gene. Parameters ---------- stmts_in : list[indra.statements.Statement] A list of statements to filter. save : Optional[str] The name of a pickle file to save...
def escape(s, quote=False): """Replace special characters "&", "<" and ">" to HTML-safe sequences. If the optional flag `quote` is `True`, the quotation mark character is also translated. There is a special handling for `None` which escapes to an empty string. :param s: the string to escape. ...
Replace special characters "&", "<" and ">" to HTML-safe sequences. If the optional flag `quote` is `True`, the quotation mark character is also translated. There is a special handling for `None` which escapes to an empty string. :param s: the string to escape. :param quote: set to true to also e...
Below is the the instruction that describes the task: ### Input: Replace special characters "&", "<" and ">" to HTML-safe sequences. If the optional flag `quote` is `True`, the quotation mark character is also translated. There is a special handling for `None` which escapes to an empty string. :p...
def ProbGreater(self, x): """Probability that a sample from this Pmf exceeds x. x: number returns: float probability """ t = [prob for (val, prob) in self.d.iteritems() if val > x] return sum(t)
Probability that a sample from this Pmf exceeds x. x: number returns: float probability
Below is the the instruction that describes the task: ### Input: Probability that a sample from this Pmf exceeds x. x: number returns: float probability ### Response: def ProbGreater(self, x): """Probability that a sample from this Pmf exceeds x. x: number returns: float...
def logout(session, cookies, csrf_token): ''' Closes the session with the device. ''' payload = {"jsonrpc": "2.0", "id": "ID0", "method": "logout", "params": [] } session.post(DETAILS['url'], data=json.dumps(payload), ...
Closes the session with the device.
Below is the the instruction that describes the task: ### Input: Closes the session with the device. ### Response: def logout(session, cookies, csrf_token): ''' Closes the session with the device. ''' payload = {"jsonrpc": "2.0", "id": "ID0", "method": "logout", ...
def delete_orderrun(self, orderrun_id): """ :param self: self :param orderrun_id: string ; 'good' return a good value ; 'bad' return a bad value :rtype: DKReturnCode """ rc = DKReturnCode() if orderrun_id == 'good': rc.set(rc.DK_SUCCESS, None, None) ...
:param self: self :param orderrun_id: string ; 'good' return a good value ; 'bad' return a bad value :rtype: DKReturnCode
Below is the the instruction that describes the task: ### Input: :param self: self :param orderrun_id: string ; 'good' return a good value ; 'bad' return a bad value :rtype: DKReturnCode ### Response: def delete_orderrun(self, orderrun_id): """ :param self: self :param order...
def parse_resource(library, session, resource_name): """Parse a resource string to get the interface information. Corresponds to viParseRsrc function of the VISA library. :param library: the visa library wrapped by ctypes. :param session: Resource Manager session (should always be the Default Resource...
Parse a resource string to get the interface information. Corresponds to viParseRsrc function of the VISA library. :param library: the visa library wrapped by ctypes. :param session: Resource Manager session (should always be the Default Resource Manager for VISA returned from open_def...
Below is the the instruction that describes the task: ### Input: Parse a resource string to get the interface information. Corresponds to viParseRsrc function of the VISA library. :param library: the visa library wrapped by ctypes. :param session: Resource Manager session (should always be the Default...
def get_terms(self, kwargs): """Checks URL parameters for slug and/or version to pull the right TermsAndConditions object""" slug = kwargs.get("slug") version = kwargs.get("version") if slug and version: terms = [TermsAndConditions.objects.filter(slug=slug, version_number=v...
Checks URL parameters for slug and/or version to pull the right TermsAndConditions object
Below is the the instruction that describes the task: ### Input: Checks URL parameters for slug and/or version to pull the right TermsAndConditions object ### Response: def get_terms(self, kwargs): """Checks URL parameters for slug and/or version to pull the right TermsAndConditions object""" slug...
def iter_events(self, number=-1): """Iterate over events associated with this issue only. :param int number: (optional), number of events to return. Default: -1 returns all events available. :returns: generator of :class:`IssueEvent <github3.issues.event.IssueEvent>`\ s ...
Iterate over events associated with this issue only. :param int number: (optional), number of events to return. Default: -1 returns all events available. :returns: generator of :class:`IssueEvent <github3.issues.event.IssueEvent>`\ s
Below is the the instruction that describes the task: ### Input: Iterate over events associated with this issue only. :param int number: (optional), number of events to return. Default: -1 returns all events available. :returns: generator of :class:`IssueEvent <github3.issue...
def _set_values_on_model(self, model, values, fields=None): """ Updates the values with the specified values. :param Model model: The sqlalchemy model instance :param dict values: The dictionary of attributes and the values to set. :param list fields: A list of strin...
Updates the values with the specified values. :param Model model: The sqlalchemy model instance :param dict values: The dictionary of attributes and the values to set. :param list fields: A list of strings indicating the valid fields. Defaults to self.fields. :re...
Below is the the instruction that describes the task: ### Input: Updates the values with the specified values. :param Model model: The sqlalchemy model instance :param dict values: The dictionary of attributes and the values to set. :param list fields: A list of strings indicati...
def detectRamPorts(stm: IfContainer, current_en: RtlSignalBase): """ Detect RAM ports in If statement :param stm: statement to detect the ram ports in :param current_en: curent en/clk signal """ if stm.ifFalse or stm.elIfs: return for _stm in stm.ifTrue: if isinstance(_stm, ...
Detect RAM ports in If statement :param stm: statement to detect the ram ports in :param current_en: curent en/clk signal
Below is the the instruction that describes the task: ### Input: Detect RAM ports in If statement :param stm: statement to detect the ram ports in :param current_en: curent en/clk signal ### Response: def detectRamPorts(stm: IfContainer, current_en: RtlSignalBase): """ Detect RAM ports in If state...
def _parse_qualimap_coverage(table): """Parse summary qualimap coverage metrics. """ out = {} for row in table.find_all("tr"): col, val = [x.text for x in row.find_all("td")] if col == "Mean": out["Coverage (Mean)"] = val return out
Parse summary qualimap coverage metrics.
Below is the the instruction that describes the task: ### Input: Parse summary qualimap coverage metrics. ### Response: def _parse_qualimap_coverage(table): """Parse summary qualimap coverage metrics. """ out = {} for row in table.find_all("tr"): col, val = [x.text for x in row.find_all("td...
def addModel(self, moduleName, modelName, model): """ Add a model instance to the application model pool. :param moduleName: <str> module name in which the model is located :param modelName: <str> model name :param model: <object> model instance :return: <void> "...
Add a model instance to the application model pool. :param moduleName: <str> module name in which the model is located :param modelName: <str> model name :param model: <object> model instance :return: <void>
Below is the the instruction that describes the task: ### Input: Add a model instance to the application model pool. :param moduleName: <str> module name in which the model is located :param modelName: <str> model name :param model: <object> model instance :return: <void> ### Respon...
def run(self): """Configures and enables a CloudTrail trail and logging on a single AWS Account. Has the capability to create both single region and multi-region trails. Will automatically create SNS topics, subscribe to SQS queues and turn on logging for the account in question, as we...
Configures and enables a CloudTrail trail and logging on a single AWS Account. Has the capability to create both single region and multi-region trails. Will automatically create SNS topics, subscribe to SQS queues and turn on logging for the account in question, as well as reverting any manual...
Below is the the instruction that describes the task: ### Input: Configures and enables a CloudTrail trail and logging on a single AWS Account. Has the capability to create both single region and multi-region trails. Will automatically create SNS topics, subscribe to SQS queues and turn on logging...
def write_translations(self, catalogue, format, options={}): """ Writes translation from the catalogue according to the selected format. @type catalogue: MessageCatalogue @param catalogue: The message catalogue to dump @type format: string @param format: The format to u...
Writes translation from the catalogue according to the selected format. @type catalogue: MessageCatalogue @param catalogue: The message catalogue to dump @type format: string @param format: The format to use to dump the messages @type options: array @param options: Opt...
Below is the the instruction that describes the task: ### Input: Writes translation from the catalogue according to the selected format. @type catalogue: MessageCatalogue @param catalogue: The message catalogue to dump @type format: string @param format: The format to use to dump t...
def MakeID3v1(id3): """Return an ID3v1.1 tag string from a dict of ID3v2.4 frames.""" v1 = {} for v2id, name in {"TIT2": "title", "TPE1": "artist", "TALB": "album"}.items(): if v2id in id3: text = id3[v2id].text[0].encode('latin1', 'replace')[:30] else: ...
Return an ID3v1.1 tag string from a dict of ID3v2.4 frames.
Below is the the instruction that describes the task: ### Input: Return an ID3v1.1 tag string from a dict of ID3v2.4 frames. ### Response: def MakeID3v1(id3): """Return an ID3v1.1 tag string from a dict of ID3v2.4 frames.""" v1 = {} for v2id, name in {"TIT2": "title", "TPE1": "artist", ...
def change_user_password(self, ID, data): """Change password of a User.""" # http://teampasswordmanager.com/docs/api-users/#change_password log.info('Change user %s password' % ID) self.put('users/%s/change_password.json' % ID, data)
Change password of a User.
Below is the the instruction that describes the task: ### Input: Change password of a User. ### Response: def change_user_password(self, ID, data): """Change password of a User.""" # http://teampasswordmanager.com/docs/api-users/#change_password log.info('Change user %s password' % ID) ...
def get_step_f(step_f, lR2, lS2): """Update the stepsize of given the primal and dual errors. See Boyd (2011), section 3.4.1 """ mu, tau = 10, 2 if lR2 > mu*lS2: return step_f * tau elif lS2 > mu*lR2: return step_f / tau return step_f
Update the stepsize of given the primal and dual errors. See Boyd (2011), section 3.4.1
Below is the the instruction that describes the task: ### Input: Update the stepsize of given the primal and dual errors. See Boyd (2011), section 3.4.1 ### Response: def get_step_f(step_f, lR2, lS2): """Update the stepsize of given the primal and dual errors. See Boyd (2011), section 3.4.1 """ ...
def setEmergencyDecel(self, vehID, decel): """setEmergencyDecel(string, double) -> None Sets the maximal physically possible deceleration in m/s^2 for this vehicle. """ self._connection._sendDoubleCmd( tc.CMD_SET_VEHICLE_VARIABLE, tc.VAR_EMERGENCY_DECEL, vehID, decel)
setEmergencyDecel(string, double) -> None Sets the maximal physically possible deceleration in m/s^2 for this vehicle.
Below is the the instruction that describes the task: ### Input: setEmergencyDecel(string, double) -> None Sets the maximal physically possible deceleration in m/s^2 for this vehicle. ### Response: def setEmergencyDecel(self, vehID, decel): """setEmergencyDecel(string, double) -> None Set...
def get_belapi_handle(client, username=None, password=None): """Get BEL API arango db handle""" (username, password) = get_user_creds(username, password) sys_db = client.db("_system", username=username, password=password) # Create a new database named "belapi" try: if username and passwor...
Get BEL API arango db handle
Below is the the instruction that describes the task: ### Input: Get BEL API arango db handle ### Response: def get_belapi_handle(client, username=None, password=None): """Get BEL API arango db handle""" (username, password) = get_user_creds(username, password) sys_db = client.db("_system", username=...
def push(self): """ Adding the no_thin argument to the GIT push because we had some issues pushing previously. According to http://stackoverflow.com/questions/16586642/git-unpack-error-on-push-to-gerrit#comment42953435_23610917, "a new optimization which causes git to send as little d...
Adding the no_thin argument to the GIT push because we had some issues pushing previously. According to http://stackoverflow.com/questions/16586642/git-unpack-error-on-push-to-gerrit#comment42953435_23610917, "a new optimization which causes git to send as little data as possible over the network caus...
Below is the the instruction that describes the task: ### Input: Adding the no_thin argument to the GIT push because we had some issues pushing previously. According to http://stackoverflow.com/questions/16586642/git-unpack-error-on-push-to-gerrit#comment42953435_23610917, "a new optimization whic...
def _update_cov_model(self, strata_to_update='all'): """ strata_to_update : array-like or 'all' array containing stratum indices to update """ if strata_to_update == 'all': strata_to_update = self.strata.indices_ #: Otherwise assume strata_to_update is val...
strata_to_update : array-like or 'all' array containing stratum indices to update
Below is the the instruction that describes the task: ### Input: strata_to_update : array-like or 'all' array containing stratum indices to update ### Response: def _update_cov_model(self, strata_to_update='all'): """ strata_to_update : array-like or 'all' array containing s...
def run_command(self, run_with=None, join_args=False): """ Run the task command. :param run_with: list of tokens to run the task command with e.g. ``['bash', '-c']`` :type run_with: list :param join_args: whether to concatenate the list of command tokens e.g. ``['airflow', 'run'...
Run the task command. :param run_with: list of tokens to run the task command with e.g. ``['bash', '-c']`` :type run_with: list :param join_args: whether to concatenate the list of command tokens e.g. ``['airflow', 'run']`` vs ``['airflow run']`` :param join_args: bool ...
Below is the the instruction that describes the task: ### Input: Run the task command. :param run_with: list of tokens to run the task command with e.g. ``['bash', '-c']`` :type run_with: list :param join_args: whether to concatenate the list of command tokens e.g. ``['airflow', 'run']`` vs...
def find_description(self, name): "Find a description for the given appliance name." for desc in self.virtual_system_descriptions: values = desc.get_values_by_type(DescType.name, DescValueType.original) if name in values: ...
Find a description for the given appliance name.
Below is the the instruction that describes the task: ### Input: Find a description for the given appliance name. ### Response: def find_description(self, name): "Find a description for the given appliance name." for desc in self.virtual_system_descriptions: values = desc.get_values_by_...
def del_all_host_downtimes(self, host): """Delete all host downtimes Format of the line that triggers function call:: DEL_ALL_HOST_DOWNTIMES;<host_name> :param host: host to edit :type host: alignak.objects.host.Host :return: None """ for downtime in hos...
Delete all host downtimes Format of the line that triggers function call:: DEL_ALL_HOST_DOWNTIMES;<host_name> :param host: host to edit :type host: alignak.objects.host.Host :return: None
Below is the the instruction that describes the task: ### Input: Delete all host downtimes Format of the line that triggers function call:: DEL_ALL_HOST_DOWNTIMES;<host_name> :param host: host to edit :type host: alignak.objects.host.Host :return: None ### Response: def de...
def _body(self): """ Generate the information required to create an ISBN-10 or ISBN-13. """ ean = self.random_element(RULES.keys()) reg_group = self.random_element(RULES[ean].keys()) # Given the chosen ean/group, decide how long the # registrant/publication str...
Generate the information required to create an ISBN-10 or ISBN-13.
Below is the the instruction that describes the task: ### Input: Generate the information required to create an ISBN-10 or ISBN-13. ### Response: def _body(self): """ Generate the information required to create an ISBN-10 or ISBN-13. """ ean = self.random_element(RULES.keys(...
def get_remote_settings(self, name): import posixpath """ Args: name (str): The name of the remote that we want to retrieve Returns: dict: The content beneath the given remote name. Example: >>> config = {'remote "server"': {'url': 'ssh://lo...
Args: name (str): The name of the remote that we want to retrieve Returns: dict: The content beneath the given remote name. Example: >>> config = {'remote "server"': {'url': 'ssh://localhost/'}} >>> get_remote_settings("server") {'url': 'ssh:...
Below is the the instruction that describes the task: ### Input: Args: name (str): The name of the remote that we want to retrieve Returns: dict: The content beneath the given remote name. Example: >>> config = {'remote "server"': {'url': 'ssh://localhost/'}} ...
def _map_center(self, coord, val): ''' Identitify the center of the Image correspond to one coordinate. ''' if self.ppd in [4, 16, 64, 128]: res = {'lat': 0, 'long': 360} return res[coord] / 2.0 elif self.ppd in [256]: res = {'lat': 90, 'long': 180} ...
Identitify the center of the Image correspond to one coordinate.
Below is the the instruction that describes the task: ### Input: Identitify the center of the Image correspond to one coordinate. ### Response: def _map_center(self, coord, val): ''' Identitify the center of the Image correspond to one coordinate. ''' if self.ppd in [4, 16, 64, 128]: r...
def abort(self, jobs=None, targets=None, block=None): """Abort specific jobs from the execution queues of target(s). This is a mechanism to prevent jobs that have already been submitted from executing. Parameters ---------- jobs : msg_id, list of msg_ids, or AsyncResul...
Abort specific jobs from the execution queues of target(s). This is a mechanism to prevent jobs that have already been submitted from executing. Parameters ---------- jobs : msg_id, list of msg_ids, or AsyncResult The jobs to be aborted If ...
Below is the the instruction that describes the task: ### Input: Abort specific jobs from the execution queues of target(s). This is a mechanism to prevent jobs that have already been submitted from executing. Parameters ---------- jobs : msg_id, list of msg_ids, or AsyncR...
def _get_raw_key(self, key_id): """Retrieves a static, randomly generated, RSA key for the specified key id. :param str key_id: User-defined ID for the static key :returns: Wrapping key that contains the specified static key :rtype: :class:`aws_encryption_sdk.internal.crypto.WrappingKey...
Retrieves a static, randomly generated, RSA key for the specified key id. :param str key_id: User-defined ID for the static key :returns: Wrapping key that contains the specified static key :rtype: :class:`aws_encryption_sdk.internal.crypto.WrappingKey`
Below is the the instruction that describes the task: ### Input: Retrieves a static, randomly generated, RSA key for the specified key id. :param str key_id: User-defined ID for the static key :returns: Wrapping key that contains the specified static key :rtype: :class:`aws_encryption_sdk.i...
def get_matches(pattern, language, max_count=8): """ take a word pattern or a Python regexp and a language name, and return a list of all matching words. """ if str(pattern) == pattern: pattern = compile_pattern(pattern) results = [] if not dicts.exists(language): print("Th...
take a word pattern or a Python regexp and a language name, and return a list of all matching words.
Below is the the instruction that describes the task: ### Input: take a word pattern or a Python regexp and a language name, and return a list of all matching words. ### Response: def get_matches(pattern, language, max_count=8): """ take a word pattern or a Python regexp and a language name, and return...
def quantitate(data): """CWL target for quantitation. XXX Needs to be split and parallelized by expression caller, with merging of multiple calls. """ data = to_single_data(to_single_data(data)) data = generate_transcript_counts(data)[0][0] data["quant"] = {} if "sailfish" in dd.get_exp...
CWL target for quantitation. XXX Needs to be split and parallelized by expression caller, with merging of multiple calls.
Below is the the instruction that describes the task: ### Input: CWL target for quantitation. XXX Needs to be split and parallelized by expression caller, with merging of multiple calls. ### Response: def quantitate(data): """CWL target for quantitation. XXX Needs to be split and parallelized by ...
def unmarshal(self, value, custom_formatters=None, strict=True): """Unmarshal parameter from the value.""" if self.deprecated: warnings.warn("The schema is deprecated", DeprecationWarning) casted = self.cast(value, custom_formatters=custom_formatters, strict=strict) if cast...
Unmarshal parameter from the value.
Below is the the instruction that describes the task: ### Input: Unmarshal parameter from the value. ### Response: def unmarshal(self, value, custom_formatters=None, strict=True): """Unmarshal parameter from the value.""" if self.deprecated: warnings.warn("The schema is deprecated", Dep...
def rewind(self): '''rewind to start''' self._index = 0 self.percent = 0 self.messages = {} self._flightmode_index = 0 self._timestamp = None self.flightmode = None self.params = {}
rewind to start
Below is the the instruction that describes the task: ### Input: rewind to start ### Response: def rewind(self): '''rewind to start''' self._index = 0 self.percent = 0 self.messages = {} self._flightmode_index = 0 self._timestamp = None self.flightmode = None...
def create_event_subscription(self, url): """Register a callback URL as an event subscriber. :param str url: callback URL :returns: the created event subscription :rtype: dict """ params = {'callbackUrl': url} response = self._do_request('POST', '/v2/eventSubscr...
Register a callback URL as an event subscriber. :param str url: callback URL :returns: the created event subscription :rtype: dict
Below is the the instruction that describes the task: ### Input: Register a callback URL as an event subscriber. :param str url: callback URL :returns: the created event subscription :rtype: dict ### Response: def create_event_subscription(self, url): """Register a callback URL as...
def _new_from_xml(cls, xmlnode): """Create a new `Item` object from an XML element. :Parameters: - `xmlnode`: the XML element. :Types: - `xmlnode`: `libxml2.xmlNode` :return: the object created. :returntype: `Item` """ child = xmlnode.chi...
Create a new `Item` object from an XML element. :Parameters: - `xmlnode`: the XML element. :Types: - `xmlnode`: `libxml2.xmlNode` :return: the object created. :returntype: `Item`
Below is the the instruction that describes the task: ### Input: Create a new `Item` object from an XML element. :Parameters: - `xmlnode`: the XML element. :Types: - `xmlnode`: `libxml2.xmlNode` :return: the object created. :returntype: `Item` ### Response: ...
def present(name, auth=None, **kwargs): ''' Ensure image exists and is up-to-date name Name of the image enabled Boolean to control if image is enabled description An arbitrary description of the image ''' ret = {'name': name, 'changes': {}, '...
Ensure image exists and is up-to-date name Name of the image enabled Boolean to control if image is enabled description An arbitrary description of the image
Below is the the instruction that describes the task: ### Input: Ensure image exists and is up-to-date name Name of the image enabled Boolean to control if image is enabled description An arbitrary description of the image ### Response: def present(name, auth=None, **kwargs):...
def actionAngleTorus_xvFreqs_c(pot,jr,jphi,jz, angler,anglephi,anglez, tol=0.003): """ NAME: actionAngleTorus_xvFreqs_c PURPOSE: compute configuration (x,v) and frequencies of a set of angles on a single torus INPUT: pot ...
NAME: actionAngleTorus_xvFreqs_c PURPOSE: compute configuration (x,v) and frequencies of a set of angles on a single torus INPUT: pot - Potential object or list thereof jr - radial action (scalar) jphi - azimuthal action (scalar) jz - vertical action (scalar) ang...
Below is the the instruction that describes the task: ### Input: NAME: actionAngleTorus_xvFreqs_c PURPOSE: compute configuration (x,v) and frequencies of a set of angles on a single torus INPUT: pot - Potential object or list thereof jr - radial action (scalar) jphi - azim...
def _create_p(s, h): """Parabolic derivative""" p = np.zeros_like(s) p[1:] = (s[:-1]*h[1:] + s[1:] * h[:-1]) / (h[1:] + h[:-1]) return p
Parabolic derivative
Below is the the instruction that describes the task: ### Input: Parabolic derivative ### Response: def _create_p(s, h): """Parabolic derivative""" p = np.zeros_like(s) p[1:] = (s[:-1]*h[1:] + s[1:] * h[:-1]) / (h[1:] + h[:-1]) return p
def clean_file_name(filename, unique=True, replace="_", force_nt=False): """ Return a filename version, which has no characters in it which are forbidden. On Windows these are for example <, /, ?, ... The intention of this function is to allow distribution of files to different OSes. :param filena...
Return a filename version, which has no characters in it which are forbidden. On Windows these are for example <, /, ?, ... The intention of this function is to allow distribution of files to different OSes. :param filename: string to clean :param unique: check if the filename is already taken and app...
Below is the the instruction that describes the task: ### Input: Return a filename version, which has no characters in it which are forbidden. On Windows these are for example <, /, ?, ... The intention of this function is to allow distribution of files to different OSes. :param filename: string to cl...
def setfocus(self, focus): """ Set the 'focus' attribute of the data file. The 'focus' attribute of the object points towards data from a particular stage of analysis. It is used to identify the 'working stage' of the data. Processing functions operate on the 'focus' sta...
Set the 'focus' attribute of the data file. The 'focus' attribute of the object points towards data from a particular stage of analysis. It is used to identify the 'working stage' of the data. Processing functions operate on the 'focus' stage, so if steps are done out of sequence, thing...
Below is the the instruction that describes the task: ### Input: Set the 'focus' attribute of the data file. The 'focus' attribute of the object points towards data from a particular stage of analysis. It is used to identify the 'working stage' of the data. Processing functions operate on t...
def yAxisIsMinor(self): ''' Returns True if the minor axis is parallel to the Y axis, boolean. ''' return min(self.radius.x, self.radius.y) == self.radius.y
Returns True if the minor axis is parallel to the Y axis, boolean.
Below is the the instruction that describes the task: ### Input: Returns True if the minor axis is parallel to the Y axis, boolean. ### Response: def yAxisIsMinor(self): ''' Returns True if the minor axis is parallel to the Y axis, boolean. ''' return min(self.radius.x, self.radius....
def pad_position_w(self, i): """ Determines the position of the ith pad in the width direction. Assumes equally spaced pads. :param i: ith number of pad in width direction (0-indexed) :return: """ if i >= self.n_pads_w: raise ModelError("pad index out...
Determines the position of the ith pad in the width direction. Assumes equally spaced pads. :param i: ith number of pad in width direction (0-indexed) :return:
Below is the the instruction that describes the task: ### Input: Determines the position of the ith pad in the width direction. Assumes equally spaced pads. :param i: ith number of pad in width direction (0-indexed) :return: ### Response: def pad_position_w(self, i): """ De...
def expand(self, m): """Using the template, expand the string.""" if m is None: raise ValueError("Match is None!") sep = m.string[:0] if isinstance(sep, bytes) != self._bytes: raise TypeError('Match string type does not match expander string type!') text...
Using the template, expand the string.
Below is the the instruction that describes the task: ### Input: Using the template, expand the string. ### Response: def expand(self, m): """Using the template, expand the string.""" if m is None: raise ValueError("Match is None!") sep = m.string[:0] if isinstance(sep...
def _findSubnetMask(self, ip): """ Retrieve the broadcast IP address connected to internet... used as a default IP address when defining Script :param ip: (str) optionnal IP address. If not provided, default to getIPAddr() :param mask: (str) optionnal subnet mask. If not provide...
Retrieve the broadcast IP address connected to internet... used as a default IP address when defining Script :param ip: (str) optionnal IP address. If not provided, default to getIPAddr() :param mask: (str) optionnal subnet mask. If not provided, will try to find one using ipconfig (Windows) or...
Below is the the instruction that describes the task: ### Input: Retrieve the broadcast IP address connected to internet... used as a default IP address when defining Script :param ip: (str) optionnal IP address. If not provided, default to getIPAddr() :param mask: (str) optionnal subnet ma...