code
stringlengths
75
104k
docstring
stringlengths
1
46.9k
text
stringlengths
164
112k
def list_files(tag=None, sat_id=None, data_path=None, format_str=None): """Produce a list of ICON EUV files. Notes ----- Currently fixed to level-2 """ desc = None level = tag if level == 'level_1': code = 'L1' desc = None elif level == 'level_2': code = 'L...
Produce a list of ICON EUV files. Notes ----- Currently fixed to level-2
Below is the the instruction that describes the task: ### Input: Produce a list of ICON EUV files. Notes ----- Currently fixed to level-2 ### Response: def list_files(tag=None, sat_id=None, data_path=None, format_str=None): """Produce a list of ICON EUV files. Notes ----- Currently fi...
def register_rml(self, filepath, **kwargs): """ Registers the filepath for an rml mapping Args: ----- filepath: the path the rml file """ name = os.path.split(filepath)[-1] if name in self.rml_maps and self.rml_maps[name] != filepath: rais...
Registers the filepath for an rml mapping Args: ----- filepath: the path the rml file
Below is the the instruction that describes the task: ### Input: Registers the filepath for an rml mapping Args: ----- filepath: the path the rml file ### Response: def register_rml(self, filepath, **kwargs): """ Registers the filepath for an rml mapping Args: ...
def __set_sheet_filenames(sheets, n): """ Use the dataset name to build the filenames in the sheets metadata :param list sheets: Sheet metadata :param str n: Dataset Name :return list: Sheet metadata """ try: for idx, sheet in enumerate(sheets): try: sheet...
Use the dataset name to build the filenames in the sheets metadata :param list sheets: Sheet metadata :param str n: Dataset Name :return list: Sheet metadata
Below is the the instruction that describes the task: ### Input: Use the dataset name to build the filenames in the sheets metadata :param list sheets: Sheet metadata :param str n: Dataset Name :return list: Sheet metadata ### Response: def __set_sheet_filenames(sheets, n): """ Use the dataset ...
def select_parser(self, request, parsers): """ Selects the appropriated parser which matches to the request's content type. :param request: The HTTP request. :param parsers: The lists of parsers. :return: The parser selected or none. """ if not request.content_ty...
Selects the appropriated parser which matches to the request's content type. :param request: The HTTP request. :param parsers: The lists of parsers. :return: The parser selected or none.
Below is the the instruction that describes the task: ### Input: Selects the appropriated parser which matches to the request's content type. :param request: The HTTP request. :param parsers: The lists of parsers. :return: The parser selected or none. ### Response: def select_parser(self, r...
def validate_instance(cls, opts): """Validates an instance of global options for cases that are not prohibited via registration. For example: mutually exclusive options may be registered by passing a `mutually_exclusive_group`, but when multiple flags must be specified together, it can be necessary to spec...
Validates an instance of global options for cases that are not prohibited via registration. For example: mutually exclusive options may be registered by passing a `mutually_exclusive_group`, but when multiple flags must be specified together, it can be necessary to specify post-parse checks. Raises pa...
Below is the the instruction that describes the task: ### Input: Validates an instance of global options for cases that are not prohibited via registration. For example: mutually exclusive options may be registered by passing a `mutually_exclusive_group`, but when multiple flags must be specified together,...
def remove(cls, target, exclude=None, ctx=None, select=lambda *p: True): """Remove from target annotations which inherit from cls. :param target: target from where remove annotations which inherits from cls. :param tuple/type exclude: annotation types to exclude from selection. ...
Remove from target annotations which inherit from cls. :param target: target from where remove annotations which inherits from cls. :param tuple/type exclude: annotation types to exclude from selection. :param ctx: target ctx. :param select: annotation selection function whi...
Below is the the instruction that describes the task: ### Input: Remove from target annotations which inherit from cls. :param target: target from where remove annotations which inherits from cls. :param tuple/type exclude: annotation types to exclude from selection. :param ctx:...
def search(term, provider=None): """Search for genomes that contain TERM in their name or description.""" for row in genomepy.search(term, provider): print("\t".join([x.decode('utf-8', 'ignore') for x in row]))
Search for genomes that contain TERM in their name or description.
Below is the the instruction that describes the task: ### Input: Search for genomes that contain TERM in their name or description. ### Response: def search(term, provider=None): """Search for genomes that contain TERM in their name or description.""" for row in genomepy.search(term, provider): pri...
def create_connection(port=_PORT_, timeout=_TIMEOUT_, restart=False): """ Create Bloomberg connection Returns: (Bloomberg connection, if connection is new) """ if _CON_SYM_ in globals(): if not isinstance(globals()[_CON_SYM_], pdblp.BCon): del globals()[_CON_SYM_] i...
Create Bloomberg connection Returns: (Bloomberg connection, if connection is new)
Below is the the instruction that describes the task: ### Input: Create Bloomberg connection Returns: (Bloomberg connection, if connection is new) ### Response: def create_connection(port=_PORT_, timeout=_TIMEOUT_, restart=False): """ Create Bloomberg connection Returns: (Bloomber...
def wysiwyg_editor(field_id, editor_name=None, config=None, editor_override=None): """ Turn the textarea #field_id into a rich editor. If you do not specify the JavaScript name of the editor, it will be derived from the field_id. If you don't specify the editor_name then you'll have a JavaScript object...
Turn the textarea #field_id into a rich editor. If you do not specify the JavaScript name of the editor, it will be derived from the field_id. If you don't specify the editor_name then you'll have a JavaScript object named "<field_id>_editor" in the global namespace. We give you control of this in case...
Below is the the instruction that describes the task: ### Input: Turn the textarea #field_id into a rich editor. If you do not specify the JavaScript name of the editor, it will be derived from the field_id. If you don't specify the editor_name then you'll have a JavaScript object named "<field_id>_edi...
def load_fixture(fixture_file): """ Populate the database from a JSON file. Reads the JSON file FIXTURE_FILE and uses it to populate the database. Fuxture files should consist of a dictionary mapping database names to arrays of objects to store in those databases. """ utils.check_for_local_s...
Populate the database from a JSON file. Reads the JSON file FIXTURE_FILE and uses it to populate the database. Fuxture files should consist of a dictionary mapping database names to arrays of objects to store in those databases.
Below is the the instruction that describes the task: ### Input: Populate the database from a JSON file. Reads the JSON file FIXTURE_FILE and uses it to populate the database. Fuxture files should consist of a dictionary mapping database names to arrays of objects to store in those databases. ### Respon...
def createSections(self): """Create the sections of the cell.""" self.soma = h.Section(name='soma', cell=self) self.dend = h.Section(name='dend', cell=self)
Create the sections of the cell.
Below is the the instruction that describes the task: ### Input: Create the sections of the cell. ### Response: def createSections(self): """Create the sections of the cell.""" self.soma = h.Section(name='soma', cell=self) self.dend = h.Section(name='dend', cell=self)
def _get_expr_variables(expression: z3.ExprRef) -> List[z3.ExprRef]: """ Gets the variables that make up the current expression :param expression: :return: """ result = [] if not expression.children() and not isinstance(expression, z3.BitVecNumRef): result.append(expression) for ...
Gets the variables that make up the current expression :param expression: :return:
Below is the the instruction that describes the task: ### Input: Gets the variables that make up the current expression :param expression: :return: ### Response: def _get_expr_variables(expression: z3.ExprRef) -> List[z3.ExprRef]: """ Gets the variables that make up the current expression :para...
def grantTablePermission(self, login, user, table, perm): """ Parameters: - login - user - table - perm """ self.send_grantTablePermission(login, user, table, perm) self.recv_grantTablePermission()
Parameters: - login - user - table - perm
Below is the the instruction that describes the task: ### Input: Parameters: - login - user - table - perm ### Response: def grantTablePermission(self, login, user, table, perm): """ Parameters: - login - user - table - perm """ self.send_grantTablePermission...
def validate_filters_or_records(filters_or_records): """Validation for filters_or_records variable from bulk_modify and bulk_delete""" # If filters_or_records is empty, fail if not filters_or_records: raise ValueError('Must provide at least one filter tuples or Records') # If filters_or_records ...
Validation for filters_or_records variable from bulk_modify and bulk_delete
Below is the the instruction that describes the task: ### Input: Validation for filters_or_records variable from bulk_modify and bulk_delete ### Response: def validate_filters_or_records(filters_or_records): """Validation for filters_or_records variable from bulk_modify and bulk_delete""" # If filters_or_r...
def _proxy_addr(self): """ Return proxy address to connect to as tuple object """ proxy_type, proxy_addr, proxy_port, rdns, username, password = self.proxy proxy_port = proxy_port or DEFAULT_PORTS.get(proxy_type) if not proxy_port: raise GeneralProxyError("Inv...
Return proxy address to connect to as tuple object
Below is the the instruction that describes the task: ### Input: Return proxy address to connect to as tuple object ### Response: def _proxy_addr(self): """ Return proxy address to connect to as tuple object """ proxy_type, proxy_addr, proxy_port, rdns, username, password = self.pro...
def evaluate_cached(self, **kwargs): """Wraps evaluate(), caching results""" if not hasattr(self, 'result'): self.result = self.evaluate(cache=True, **kwargs) return self.result
Wraps evaluate(), caching results
Below is the the instruction that describes the task: ### Input: Wraps evaluate(), caching results ### Response: def evaluate_cached(self, **kwargs): """Wraps evaluate(), caching results""" if not hasattr(self, 'result'): self.result = self.evaluate(cache=True, **kwargs) return...
def _generateForTokenSecurity(self, username, password, tokenUrl, expiration=None, client='requestip'): """ generates a token for a feature service """ query_dict = {'...
generates a token for a feature service
Below is the the instruction that describes the task: ### Input: generates a token for a feature service ### Response: def _generateForTokenSecurity(self, username, password, tokenUrl, expiration=None, ...
def create_halton_samples(order, dim=1, burnin=-1, primes=()): """ Create Halton sequence. For ``dim == 1`` the sequence falls back to Van Der Corput sequence. Args: order (int): The order of the Halton sequence. Defines the number of samples. dim (int): The num...
Create Halton sequence. For ``dim == 1`` the sequence falls back to Van Der Corput sequence. Args: order (int): The order of the Halton sequence. Defines the number of samples. dim (int): The number of dimensions in the Halton sequence. burnin (int): ...
Below is the the instruction that describes the task: ### Input: Create Halton sequence. For ``dim == 1`` the sequence falls back to Van Der Corput sequence. Args: order (int): The order of the Halton sequence. Defines the number of samples. dim (int): The number of...
def initialize_worker(self): """initialize the worker thread""" worker_thread = threading.Thread( name="WorkerThread", target=message_worker, args=(self,)) worker_thread.setDaemon(True) worker_thread.start()
initialize the worker thread
Below is the the instruction that describes the task: ### Input: initialize the worker thread ### Response: def initialize_worker(self): """initialize the worker thread""" worker_thread = threading.Thread( name="WorkerThread", target=message_worker, args=(self,)) worker_thread.s...
def ip_acl_ip_access_list_extended_hide_ip_acl_ext_seq_seq_id(self, **kwargs): """Auto Generated Code """ config = ET.Element("config") ip_acl = ET.SubElement(config, "ip-acl", xmlns="urn:brocade.com:mgmt:brocade-ip-access-list") ip = ET.SubElement(ip_acl, "ip") access_li...
Auto Generated Code
Below is the the instruction that describes the task: ### Input: Auto Generated Code ### Response: def ip_acl_ip_access_list_extended_hide_ip_acl_ext_seq_seq_id(self, **kwargs): """Auto Generated Code """ config = ET.Element("config") ip_acl = ET.SubElement(config, "ip-acl", xmlns="...
def generic_type_args(type_: Type) -> List[Type]: """Gets the type argument list for the given generic type. If you give this function List[int], it will return [int], and if you give it Union[int, str] it will give you [int, str]. Note that on Python < 3.7, Union[int, bool] collapses to Union[int] and...
Gets the type argument list for the given generic type. If you give this function List[int], it will return [int], and if you give it Union[int, str] it will give you [int, str]. Note that on Python < 3.7, Union[int, bool] collapses to Union[int] and then to int; this is already done by the time this f...
Below is the the instruction that describes the task: ### Input: Gets the type argument list for the given generic type. If you give this function List[int], it will return [int], and if you give it Union[int, str] it will give you [int, str]. Note that on Python < 3.7, Union[int, bool] collapses to Un...
def get_nics(vm_, **kwargs): ''' Return info about the network interfaces of a named vm :param vm_: name of the domain :param connection: libvirt connection URI, overriding defaults .. versionadded:: 2019.2.0 :param username: username to connect with, overriding defaults .. versio...
Return info about the network interfaces of a named vm :param vm_: name of the domain :param connection: libvirt connection URI, overriding defaults .. versionadded:: 2019.2.0 :param username: username to connect with, overriding defaults .. versionadded:: 2019.2.0 :param password: pa...
Below is the the instruction that describes the task: ### Input: Return info about the network interfaces of a named vm :param vm_: name of the domain :param connection: libvirt connection URI, overriding defaults .. versionadded:: 2019.2.0 :param username: username to connect with, overriding...
def dumps(self): """Represent the environment as a string in LaTeX syntax. Returns ------- str A LaTeX string representing the environment. """ content = self.dumps_content() if not content.strip() and self.omit_if_empty: return '' ...
Represent the environment as a string in LaTeX syntax. Returns ------- str A LaTeX string representing the environment.
Below is the the instruction that describes the task: ### Input: Represent the environment as a string in LaTeX syntax. Returns ------- str A LaTeX string representing the environment. ### Response: def dumps(self): """Represent the environment as a string in LaTeX synt...
def initiate_upgrade_action_and_wait(self, components_mask, action, timeout=2, interval=0.1): """ Initiate Upgrade Action and wait for long running command. """ try: self.initiate_upgrade_action(components_mask, action) except Comp...
Initiate Upgrade Action and wait for long running command.
Below is the the instruction that describes the task: ### Input: Initiate Upgrade Action and wait for long running command. ### Response: def initiate_upgrade_action_and_wait(self, components_mask, action, timeout=2, interval=0.1): """ Initiate Upgrade A...
def get_submissions(self, fullnames, *args, **kwargs): """Generate Submission objects for each item provided in `fullnames`. A submission fullname looks like `t3_<base36_id>`. Submissions are yielded in the same order they appear in `fullnames`. Up to 100 items are batched at a time --...
Generate Submission objects for each item provided in `fullnames`. A submission fullname looks like `t3_<base36_id>`. Submissions are yielded in the same order they appear in `fullnames`. Up to 100 items are batched at a time -- this happens transparently. The additional parameters ar...
Below is the the instruction that describes the task: ### Input: Generate Submission objects for each item provided in `fullnames`. A submission fullname looks like `t3_<base36_id>`. Submissions are yielded in the same order they appear in `fullnames`. Up to 100 items are batched at a time...
def _get_unique(self, *args): """Generate a unique value using the assigned maker""" # Generate a unique values value = '' attempts = 0 while True: attempts += 1 value = self._maker(*args) if value not in self._used_values: bre...
Generate a unique value using the assigned maker
Below is the the instruction that describes the task: ### Input: Generate a unique value using the assigned maker ### Response: def _get_unique(self, *args): """Generate a unique value using the assigned maker""" # Generate a unique values value = '' attempts = 0 while True...
def joinOn(self, model, onIndex): """ Performs an eqJoin on with the given model. The resulting join will be accessible through the models name. """ return self._joinOnAsPriv(model, onIndex, model.__name__)
Performs an eqJoin on with the given model. The resulting join will be accessible through the models name.
Below is the the instruction that describes the task: ### Input: Performs an eqJoin on with the given model. The resulting join will be accessible through the models name. ### Response: def joinOn(self, model, onIndex): """ Performs an eqJoin on with the given model. The resulting join will...
def debug_string(self, max_debug=MAX_DEBUG_TRIALS): """Returns a human readable message for printing to the console.""" messages = self._debug_messages() states = collections.defaultdict(set) limit_per_state = collections.Counter() for t in self._trials: states[t.stat...
Returns a human readable message for printing to the console.
Below is the the instruction that describes the task: ### Input: Returns a human readable message for printing to the console. ### Response: def debug_string(self, max_debug=MAX_DEBUG_TRIALS): """Returns a human readable message for printing to the console.""" messages = self._debug_messages() ...
def dispense(self, volume=None, location=None, rate=1.0): """ Dispense a volume of liquid (in microliters/uL) using this pipette Notes ----- If only a volume is passed, the pipette will dispense from it's current positio...
Dispense a volume of liquid (in microliters/uL) using this pipette Notes ----- If only a volume is passed, the pipette will dispense from it's current position. If only a location is passed, `dispense` will default to it's `current_volume` The location may be a Well, or...
Below is the the instruction that describes the task: ### Input: Dispense a volume of liquid (in microliters/uL) using this pipette Notes ----- If only a volume is passed, the pipette will dispense from it's current position. If only a location is passed, `dispense` will def...
def data(self, namespace): """ Gets the thread.local data (dict) for a given namespace. Args: namespace (string): The namespace, or key, of the data dict. Returns: (dict) """ assert namespace if namespace in self._data: retu...
Gets the thread.local data (dict) for a given namespace. Args: namespace (string): The namespace, or key, of the data dict. Returns: (dict)
Below is the the instruction that describes the task: ### Input: Gets the thread.local data (dict) for a given namespace. Args: namespace (string): The namespace, or key, of the data dict. Returns: (dict) ### Response: def data(self, namespace): """ Gets th...
def task_failure_message(task_report): """Task failure message.""" trace_list = traceback.format_tb(task_report['traceback']) body = 'Error: task failure\n\n' body += 'Task ID: {}\n\n'.format(task_report['task_id']) body += 'Archive: {}\n\n'.format(task_report['archive']) body += 'Docker image: ...
Task failure message.
Below is the the instruction that describes the task: ### Input: Task failure message. ### Response: def task_failure_message(task_report): """Task failure message.""" trace_list = traceback.format_tb(task_report['traceback']) body = 'Error: task failure\n\n' body += 'Task ID: {}\n\n'.format(task_r...
def grant_authority(self, column=None, value=None, **kwargs): """Many-to-many table connecting grants and authority.""" return self._resolve_call('GIC_GRANT_AUTH', column, value, **kwargs)
Many-to-many table connecting grants and authority.
Below is the the instruction that describes the task: ### Input: Many-to-many table connecting grants and authority. ### Response: def grant_authority(self, column=None, value=None, **kwargs): """Many-to-many table connecting grants and authority.""" return self._resolve_call('GIC_GRANT_AUTH', colu...
def load(cls, path_to_file): """ Loads the image data from a file on disk and tries to guess the image MIME type :param path_to_file: path to the source file :type path_to_file: str :return: a `pyowm.image.Image` instance """ import mimetypes mimetypes.in...
Loads the image data from a file on disk and tries to guess the image MIME type :param path_to_file: path to the source file :type path_to_file: str :return: a `pyowm.image.Image` instance
Below is the the instruction that describes the task: ### Input: Loads the image data from a file on disk and tries to guess the image MIME type :param path_to_file: path to the source file :type path_to_file: str :return: a `pyowm.image.Image` instance ### Response: def load(cls, path_to_...
def get_remote_revision(url, branch): """ GET REVISION OF A REMOTE BRANCH """ proc = Process("git remote revision", ["git", "ls-remote", url, "refs/heads/" + branch]) try: while True: raw_line = proc.stdout.pop() line = raw_line.strip().decode('utf8') if ...
GET REVISION OF A REMOTE BRANCH
Below is the the instruction that describes the task: ### Input: GET REVISION OF A REMOTE BRANCH ### Response: def get_remote_revision(url, branch): """ GET REVISION OF A REMOTE BRANCH """ proc = Process("git remote revision", ["git", "ls-remote", url, "refs/heads/" + branch]) try: whi...
def _get_content(cls, url, headers=HTTP_HEADERS): """ Get http content :param url: contents url :param headers: http header :return: BeautifulSoup object """ session = requests.Session() return session.get(url, headers=headers)
Get http content :param url: contents url :param headers: http header :return: BeautifulSoup object
Below is the the instruction that describes the task: ### Input: Get http content :param url: contents url :param headers: http header :return: BeautifulSoup object ### Response: def _get_content(cls, url, headers=HTTP_HEADERS): """ Get http content :param url: conte...
def get_members(cls, session, team_or_id): """List the members for the team. Args: team_or_id (helpscout.models.Person or int): Team or the ID of the team to get the folders for. Returns: RequestPaginator(output_type=helpscout.models.Users): Users ...
List the members for the team. Args: team_or_id (helpscout.models.Person or int): Team or the ID of the team to get the folders for. Returns: RequestPaginator(output_type=helpscout.models.Users): Users iterator.
Below is the the instruction that describes the task: ### Input: List the members for the team. Args: team_or_id (helpscout.models.Person or int): Team or the ID of the team to get the folders for. Returns: RequestPaginator(output_type=helpscout.models.Users...
def _create_request(self, verb, url, query_params=None, data=None, send_as_file=False): """Helper method to create a single post/get requests. Args: verb - MultiRequest._VERB_POST or MultiRequest._VERB_GET url - A string URL query_params - None or a dict ...
Helper method to create a single post/get requests. Args: verb - MultiRequest._VERB_POST or MultiRequest._VERB_GET url - A string URL query_params - None or a dict data - None or a string or a dict send_as_file - A boolean, should the data be sent as ...
Below is the the instruction that describes the task: ### Input: Helper method to create a single post/get requests. Args: verb - MultiRequest._VERB_POST or MultiRequest._VERB_GET url - A string URL query_params - None or a dict data - None or a string or a d...
def _getStrandType(self, strand): """ :param strand: :return: """ # TODO make this a dictionary/enum: PLUS, MINUS, BOTH, UNKNOWN strand_id = None if strand == '+': strand_id = self.globaltt['plus_strand'] elif strand == '-': stran...
:param strand: :return:
Below is the the instruction that describes the task: ### Input: :param strand: :return: ### Response: def _getStrandType(self, strand): """ :param strand: :return: """ # TODO make this a dictionary/enum: PLUS, MINUS, BOTH, UNKNOWN strand_id = None ...
def put(consul_url=None, token=None, key=None, value=None, **kwargs): ''' Put values into Consul :param consul_url: The Consul server URL. :param key: The key to use as the starting point for the list. :param value: The value to set the key to. :param flags: This can be used to specify an unsig...
Put values into Consul :param consul_url: The Consul server URL. :param key: The key to use as the starting point for the list. :param value: The value to set the key to. :param flags: This can be used to specify an unsigned value between 0 and 2^64-1. Clients can choose to use ...
Below is the the instruction that describes the task: ### Input: Put values into Consul :param consul_url: The Consul server URL. :param key: The key to use as the starting point for the list. :param value: The value to set the key to. :param flags: This can be used to specify an unsigned value ...
def close(self): """Close connection to server.""" try: self._socket.sendall('quit\r\n') except socket.error: pass try: self._socket.close() except socket.error: pass
Close connection to server.
Below is the the instruction that describes the task: ### Input: Close connection to server. ### Response: def close(self): """Close connection to server.""" try: self._socket.sendall('quit\r\n') except socket.error: pass try: self._socket.close()...
def attribute_map_set(self, address, attribute_maps, route_dist=None, route_family=RF_VPN_V4): """This method sets attribute mapping to a neighbor. attribute mapping can be used when you want to apply attribute to BGPUpdate under specific conditions. ``address`...
This method sets attribute mapping to a neighbor. attribute mapping can be used when you want to apply attribute to BGPUpdate under specific conditions. ``address`` specifies the IP address of the neighbor ``attribute_maps`` specifies attribute_map list that are used before pat...
Below is the the instruction that describes the task: ### Input: This method sets attribute mapping to a neighbor. attribute mapping can be used when you want to apply attribute to BGPUpdate under specific conditions. ``address`` specifies the IP address of the neighbor ``attribute...
def _orthogonalize(X): """ Orthogonalize every column of design `X` w.r.t preceding columns Parameters ---------- X: array of shape(n, p) the data to be orthogonalized Returns ------- X: array of shape(n, p) the data after orthogonalization Notes ----- X is chang...
Orthogonalize every column of design `X` w.r.t preceding columns Parameters ---------- X: array of shape(n, p) the data to be orthogonalized Returns ------- X: array of shape(n, p) the data after orthogonalization Notes ----- X is changed in place. The columns are no...
Below is the the instruction that describes the task: ### Input: Orthogonalize every column of design `X` w.r.t preceding columns Parameters ---------- X: array of shape(n, p) the data to be orthogonalized Returns ------- X: array of shape(n, p) the data after orthogonalizati...
def process_vasprun(self, dir_name, taskname, filename): """ Process a vasprun.xml file. """ vasprun_file = os.path.join(dir_name, filename) if self.parse_projected_eigen and (self.parse_projected_eigen != 'final' or \ taskname == self.runs[-1]): ...
Process a vasprun.xml file.
Below is the the instruction that describes the task: ### Input: Process a vasprun.xml file. ### Response: def process_vasprun(self, dir_name, taskname, filename): """ Process a vasprun.xml file. """ vasprun_file = os.path.join(dir_name, filename) if self.parse_projected_eig...
def update_alarm(self, alarm, criteria=None, disabled=False, label=None, name=None, metadata=None): """ Updates an existing alarm on this entity. """ return self._alarm_manager.update(alarm, criteria=criteria, disabled=disabled, label=label, name=name, metadat...
Updates an existing alarm on this entity.
Below is the the instruction that describes the task: ### Input: Updates an existing alarm on this entity. ### Response: def update_alarm(self, alarm, criteria=None, disabled=False, label=None, name=None, metadata=None): """ Updates an existing alarm on this entity. """ ...
def reverse(array): """ returns a reversed numpy array """ l = list(array) l.reverse() return _n.array(l)
returns a reversed numpy array
Below is the the instruction that describes the task: ### Input: returns a reversed numpy array ### Response: def reverse(array): """ returns a reversed numpy array """ l = list(array) l.reverse() return _n.array(l)
def processes(self): """Initialise and return the list of processes associated with this pool""" if self._processes is None: self._processes = [] for p in range(self.workers): t = Task(self._target, self._args, self._kwargs) t.name = "%s-%d" % (sel...
Initialise and return the list of processes associated with this pool
Below is the the instruction that describes the task: ### Input: Initialise and return the list of processes associated with this pool ### Response: def processes(self): """Initialise and return the list of processes associated with this pool""" if self._processes is None: self._process...
def _isophote_list_to_table(isophote_list): """ Convert an `~photutils.isophote.IsophoteList` instance to a `~astropy.table.QTable`. Parameters ---------- isophote_list : list of `~photutils.isophote.Isophote` or a `~photutils.isophote.IsophoteList` instance A list of isophotes. Re...
Convert an `~photutils.isophote.IsophoteList` instance to a `~astropy.table.QTable`. Parameters ---------- isophote_list : list of `~photutils.isophote.Isophote` or a `~photutils.isophote.IsophoteList` instance A list of isophotes. Returns ------- result : `~astropy.table.QTable` ...
Below is the the instruction that describes the task: ### Input: Convert an `~photutils.isophote.IsophoteList` instance to a `~astropy.table.QTable`. Parameters ---------- isophote_list : list of `~photutils.isophote.Isophote` or a `~photutils.isophote.IsophoteList` instance A list of isoph...
async def _receive_packet(self, pkt): """Handle incoming packets from the server.""" packet_name = packet.packet_names[pkt.packet_type] \ if pkt.packet_type < len(packet.packet_names) else 'UNKNOWN' self.logger.info( 'Received packet %s data %s', packet_name, ...
Handle incoming packets from the server.
Below is the the instruction that describes the task: ### Input: Handle incoming packets from the server. ### Response: async def _receive_packet(self, pkt): """Handle incoming packets from the server.""" packet_name = packet.packet_names[pkt.packet_type] \ if pkt.packet_type < len(pack...
def _update_text_record(self, witness, text_id): """Updates the record with `text_id` with `witness`\'s checksum and token count. :param withness: witness to update from :type witness: `WitnessText` :param text_id: database ID of Text record :type text_id: `int` ...
Updates the record with `text_id` with `witness`\'s checksum and token count. :param withness: witness to update from :type witness: `WitnessText` :param text_id: database ID of Text record :type text_id: `int`
Below is the the instruction that describes the task: ### Input: Updates the record with `text_id` with `witness`\'s checksum and token count. :param withness: witness to update from :type witness: `WitnessText` :param text_id: database ID of Text record :type text_id: `int`...
def find(self, search_str, by='name', language='en'): '''Select values by attribute Args: searchstr(str): the string to search for by(str): the name of the attribute to search by, defaults to 'name' The specified attribute must be either a string ...
Select values by attribute Args: searchstr(str): the string to search for by(str): the name of the attribute to search by, defaults to 'name' The specified attribute must be either a string or a dict mapping language codes to strings. ...
Below is the the instruction that describes the task: ### Input: Select values by attribute Args: searchstr(str): the string to search for by(str): the name of the attribute to search by, defaults to 'name' The specified attribute must be either a string ...
def readme(): """Try to read README.rst or return empty string if failed. :return: File contents. :rtype: str """ path = os.path.realpath(os.path.join(os.path.dirname(__file__), 'README.rst')) handle = None try: handle = codecs.open(path, encoding='utf-8') return handle.read...
Try to read README.rst or return empty string if failed. :return: File contents. :rtype: str
Below is the the instruction that describes the task: ### Input: Try to read README.rst or return empty string if failed. :return: File contents. :rtype: str ### Response: def readme(): """Try to read README.rst or return empty string if failed. :return: File contents. :rtype: str """ ...
def from_unknown_text(text, strict=False): """ Detect crs string format and parse into crs object with appropriate function. Arguments: - *text*: The crs text representation of unknown type. - *strict* (optional): When True, the parser is strict about names having to match exactly with up...
Detect crs string format and parse into crs object with appropriate function. Arguments: - *text*: The crs text representation of unknown type. - *strict* (optional): When True, the parser is strict about names having to match exactly with upper and lowercases. Default is not strict (False). ...
Below is the the instruction that describes the task: ### Input: Detect crs string format and parse into crs object with appropriate function. Arguments: - *text*: The crs text representation of unknown type. - *strict* (optional): When True, the parser is strict about names having to match e...
def sgn_prod(p1, p2): r""" Multiply two Paulis and track the phase. $P_3 = P_1 \otimes P_2$: X*Y Args: p1 (Pauli): pauli 1 p2 (Pauli): pauli 2 Returns: Pauli: the multiplied pauli complex: the sign of the multiplication, 1, -1, 1...
r""" Multiply two Paulis and track the phase. $P_3 = P_1 \otimes P_2$: X*Y Args: p1 (Pauli): pauli 1 p2 (Pauli): pauli 2 Returns: Pauli: the multiplied pauli complex: the sign of the multiplication, 1, -1, 1j or -1j
Below is the the instruction that describes the task: ### Input: r""" Multiply two Paulis and track the phase. $P_3 = P_1 \otimes P_2$: X*Y Args: p1 (Pauli): pauli 1 p2 (Pauli): pauli 2 Returns: Pauli: the multiplied pauli complex: t...
def _on_decisions_event(self, event=None, **kwargs): """Called when an Event is received on the decisions channel. Saves the value in group_decisions. If num_subperiods is None, immediately broadcasts the event back out on the group_decisions channel. """ if not self.ran_ready_fu...
Called when an Event is received on the decisions channel. Saves the value in group_decisions. If num_subperiods is None, immediately broadcasts the event back out on the group_decisions channel.
Below is the the instruction that describes the task: ### Input: Called when an Event is received on the decisions channel. Saves the value in group_decisions. If num_subperiods is None, immediately broadcasts the event back out on the group_decisions channel. ### Response: def _on_decisions_event(...
def is_config_container(v): """ checks whether v is of type list,dict or Config """ cls = type(v) return ( issubclass(cls, list) or issubclass(cls, dict) or issubclass(cls, Config) )
checks whether v is of type list,dict or Config
Below is the the instruction that describes the task: ### Input: checks whether v is of type list,dict or Config ### Response: def is_config_container(v): """ checks whether v is of type list,dict or Config """ cls = type(v) return ( issubclass(cls, list) or issubclass(cls, di...
def _maxiter_default(self): """ Trait initialiser. """ mode = self.mode if mode == "KK": return 100 * len(self.nodes) elif mode == "major": return 200 else: return 600
Trait initialiser.
Below is the the instruction that describes the task: ### Input: Trait initialiser. ### Response: def _maxiter_default(self): """ Trait initialiser. """ mode = self.mode if mode == "KK": return 100 * len(self.nodes) elif mode == "major": return 200 ...
def ts_stream_keys(self, table, timeout=None): """ Streams keys from a timeseries table, returning an iterator that yields lists of keys. """ msg_code = riak.pb.messages.MSG_CODE_TS_LIST_KEYS_REQ codec = self._get_codec(msg_code) msg = codec.encode_timeseries_list...
Streams keys from a timeseries table, returning an iterator that yields lists of keys.
Below is the the instruction that describes the task: ### Input: Streams keys from a timeseries table, returning an iterator that yields lists of keys. ### Response: def ts_stream_keys(self, table, timeout=None): """ Streams keys from a timeseries table, returning an iterator that y...
def _ParseIdentifierMappingsTable(self, parser_mediator, esedb_table): """Extracts identifier mappings from the SruDbIdMapTable table. Args: parser_mediator (ParserMediator): mediates interactions between parsers and other components, such as storage and dfvfs. esedb_table (pyesedb.table)...
Extracts identifier mappings from the SruDbIdMapTable table. Args: parser_mediator (ParserMediator): mediates interactions between parsers and other components, such as storage and dfvfs. esedb_table (pyesedb.table): table. Returns: dict[int, str]: mapping of numeric identifiers to...
Below is the the instruction that describes the task: ### Input: Extracts identifier mappings from the SruDbIdMapTable table. Args: parser_mediator (ParserMediator): mediates interactions between parsers and other components, such as storage and dfvfs. esedb_table (pyesedb.table): table. ...
def do_implicit_flow_authorization(self, session): """ Standard OAuth2 authorization method. It's used for getting access token More info: https://vk.com/dev/implicit_flow_user """ logger.info('Doing implicit flow authorization, app_id=%s', self.app_id) auth_data = { ...
Standard OAuth2 authorization method. It's used for getting access token More info: https://vk.com/dev/implicit_flow_user
Below is the the instruction that describes the task: ### Input: Standard OAuth2 authorization method. It's used for getting access token More info: https://vk.com/dev/implicit_flow_user ### Response: def do_implicit_flow_authorization(self, session): """ Standard OAuth2 authorization method. It's ...
def _api_get(self, url, **kwargs): """ Convenience method for getting """ response = self.session.get( url=url, headers=self._get_api_headers(), **kwargs ) if not response.ok: raise ServerException( '{0}: {1}...
Convenience method for getting
Below is the the instruction that describes the task: ### Input: Convenience method for getting ### Response: def _api_get(self, url, **kwargs): """ Convenience method for getting """ response = self.session.get( url=url, headers=self._get_api_headers(), ...
def generate(self, nb_steps=100, averaging=50, rescale=True): """Generate data from an FCM containing cycles.""" if self.cfunctions is None: self.init_variables() new_df = pd.DataFrame() causes = [[c for c in np.nonzero(self.adjacency_matrix[:, j])[0]] for j...
Generate data from an FCM containing cycles.
Below is the the instruction that describes the task: ### Input: Generate data from an FCM containing cycles. ### Response: def generate(self, nb_steps=100, averaging=50, rescale=True): """Generate data from an FCM containing cycles.""" if self.cfunctions is None: self.init_variables() ...
def deleteEdge(self, edge, waitForSync = False) : """removes an edge from the graph""" url = "%s/edge/%s" % (self.URL, edge._id) r = self.connection.session.delete(url, params = {'waitForSync' : waitForSync}) if r.status_code == 200 or r.status_code == 202 : return True ...
removes an edge from the graph
Below is the the instruction that describes the task: ### Input: removes an edge from the graph ### Response: def deleteEdge(self, edge, waitForSync = False) : """removes an edge from the graph""" url = "%s/edge/%s" % (self.URL, edge._id) r = self.connection.session.delete(url, params = {'w...
def lrange(self, key, start, stop): """Emulate lrange.""" redis_list = self._get_list(key, 'LRANGE') start, stop = self._translate_range(len(redis_list), start, stop) return redis_list[start:stop + 1]
Emulate lrange.
Below is the the instruction that describes the task: ### Input: Emulate lrange. ### Response: def lrange(self, key, start, stop): """Emulate lrange.""" redis_list = self._get_list(key, 'LRANGE') start, stop = self._translate_range(len(redis_list), start, stop) return redis_list[sta...
def close(self): """ Call :func:`os.close` on :attr:`fd` if it is not :data:`None`, then set it to :data:`None`. """ if not self.closed: _vv and IOLOG.debug('%r.close()', self) self.closed = True os.close(self.fd)
Call :func:`os.close` on :attr:`fd` if it is not :data:`None`, then set it to :data:`None`.
Below is the the instruction that describes the task: ### Input: Call :func:`os.close` on :attr:`fd` if it is not :data:`None`, then set it to :data:`None`. ### Response: def close(self): """ Call :func:`os.close` on :attr:`fd` if it is not :data:`None`, then set it to :data:`None`....
def break_bond(self, ind1, ind2, tol=0.2): """ Returns two molecules based on breaking the bond between atoms at index ind1 and ind2. Args: ind1 (int): Index of first site. ind2 (int): Index of second site. tol (float): Relative tolerance to test. Bas...
Returns two molecules based on breaking the bond between atoms at index ind1 and ind2. Args: ind1 (int): Index of first site. ind2 (int): Index of second site. tol (float): Relative tolerance to test. Basically, the code checks if the distance between...
Below is the the instruction that describes the task: ### Input: Returns two molecules based on breaking the bond between atoms at index ind1 and ind2. Args: ind1 (int): Index of first site. ind2 (int): Index of second site. tol (float): Relative tolerance to tes...
def _prepare_wsdl_objects(self): """ Preps the WSDL data structures for the user. """ self.DeletionControlType = self.client.factory.create('DeletionControlType') self.TrackingId = self.client.factory.create('TrackingId') self.TrackingId.TrackingIdType = self.client.fact...
Preps the WSDL data structures for the user.
Below is the the instruction that describes the task: ### Input: Preps the WSDL data structures for the user. ### Response: def _prepare_wsdl_objects(self): """ Preps the WSDL data structures for the user. """ self.DeletionControlType = self.client.factory.create('DeletionControlTy...
def filter_service_by_hostgroup_name(group): """Filter for service Filter on hostgroup :param group: hostgroup to filter :type group: str :return: Filter :rtype: bool """ def inner_filter(items): """Inner filter for service. Accept if hostgroup in service.host.hostgroups""" ...
Filter for service Filter on hostgroup :param group: hostgroup to filter :type group: str :return: Filter :rtype: bool
Below is the the instruction that describes the task: ### Input: Filter for service Filter on hostgroup :param group: hostgroup to filter :type group: str :return: Filter :rtype: bool ### Response: def filter_service_by_hostgroup_name(group): """Filter for service Filter on hostgroup ...
def lat_from_inc(inc, a95=None): """ Calculate paleolatitude from inclination using the dipole equation Required Parameter ---------- inc: (paleo)magnetic inclination in degrees Optional Parameter ---------- a95: 95% confidence interval from Fisher mean Returns ---------- ...
Calculate paleolatitude from inclination using the dipole equation Required Parameter ---------- inc: (paleo)magnetic inclination in degrees Optional Parameter ---------- a95: 95% confidence interval from Fisher mean Returns ---------- if a95 is provided paleo_lat, paleo_lat_max, ...
Below is the the instruction that describes the task: ### Input: Calculate paleolatitude from inclination using the dipole equation Required Parameter ---------- inc: (paleo)magnetic inclination in degrees Optional Parameter ---------- a95: 95% confidence interval from Fisher mean Ret...
def close_all_pages(self): """Closes all tabs of the states editor""" states_to_be_closed = [] for state_identifier in self.tabs: states_to_be_closed.append(state_identifier) for state_identifier in states_to_be_closed: self.close_page(state_identifier, delete=Fal...
Closes all tabs of the states editor
Below is the the instruction that describes the task: ### Input: Closes all tabs of the states editor ### Response: def close_all_pages(self): """Closes all tabs of the states editor""" states_to_be_closed = [] for state_identifier in self.tabs: states_to_be_closed.append(state_...
def is_cached(self, version=None): ''' Set the cache property to start/stop file caching for this archive ''' version = _process_version(self, version) if self.api.cache and self.api.cache.fs.isfile( self.get_version_path(version)): return True ...
Set the cache property to start/stop file caching for this archive
Below is the the instruction that describes the task: ### Input: Set the cache property to start/stop file caching for this archive ### Response: def is_cached(self, version=None): ''' Set the cache property to start/stop file caching for this archive ''' version = _process_version(...
def from_rdd_of_dataframes(self, rdd, column_idxs=None): """Take an RDD of Panda's DataFrames and return a Dataframe. If the columns and indexes are already known (e.g. applyMap) then supplying them with columnsIndexes will skip eveluating the first partition to determine index info.""" ...
Take an RDD of Panda's DataFrames and return a Dataframe. If the columns and indexes are already known (e.g. applyMap) then supplying them with columnsIndexes will skip eveluating the first partition to determine index info.
Below is the the instruction that describes the task: ### Input: Take an RDD of Panda's DataFrames and return a Dataframe. If the columns and indexes are already known (e.g. applyMap) then supplying them with columnsIndexes will skip eveluating the first partition to determine index info. ##...
def _parse_src(cls, src_contents, src_filename): """ Return a stream of `(token_type, value)` tuples parsed from `src_contents` (str) Uses `src_filename` to guess the type of file so it can highlight syntax correctly. """ # Parse the source into tokens t...
Return a stream of `(token_type, value)` tuples parsed from `src_contents` (str) Uses `src_filename` to guess the type of file so it can highlight syntax correctly.
Below is the the instruction that describes the task: ### Input: Return a stream of `(token_type, value)` tuples parsed from `src_contents` (str) Uses `src_filename` to guess the type of file so it can highlight syntax correctly. ### Response: def _parse_src(cls, src_contents, src_filename...
def on_trial_remove(self, trial_runner, trial): """Marks trial as completed if it is paused and has previously ran.""" if trial.status is Trial.PAUSED and trial in self._results: self._completed_trials.add(trial)
Marks trial as completed if it is paused and has previously ran.
Below is the the instruction that describes the task: ### Input: Marks trial as completed if it is paused and has previously ran. ### Response: def on_trial_remove(self, trial_runner, trial): """Marks trial as completed if it is paused and has previously ran.""" if trial.status is Trial.PAUSED and ...
def make_outpoint(tx_id_le, index, tree=None): ''' byte-like, int, int -> Outpoint ''' if 'decred' in riemann.get_current_network_name(): return tx.DecredOutpoint(tx_id=tx_id_le, index=utils.i2le_padded(index, 4), tree=utils.i2le_...
byte-like, int, int -> Outpoint
Below is the the instruction that describes the task: ### Input: byte-like, int, int -> Outpoint ### Response: def make_outpoint(tx_id_le, index, tree=None): ''' byte-like, int, int -> Outpoint ''' if 'decred' in riemann.get_current_network_name(): return tx.DecredOutpoint(tx_id=tx_id_le, ...
def getFeatureID(self, location): """ Returns the feature index associated with the provided location. In the case of a sphere, it is always the same if the location is valid. """ if not self.contains(location): return self.EMPTY_FEATURE return self.SPHERICAL_SURFACE
Returns the feature index associated with the provided location. In the case of a sphere, it is always the same if the location is valid.
Below is the the instruction that describes the task: ### Input: Returns the feature index associated with the provided location. In the case of a sphere, it is always the same if the location is valid. ### Response: def getFeatureID(self, location): """ Returns the feature index associated with the p...
def postComponents(self, name, status, **kwargs): '''Create a new component. :param name: Name of the component :param status: Status of the component; 1-4 :param description: (optional) Description of the component :param link: (optional) A hyperlink to the component :p...
Create a new component. :param name: Name of the component :param status: Status of the component; 1-4 :param description: (optional) Description of the component :param link: (optional) A hyperlink to the component :param order: (optional) Order of the component :param ...
Below is the the instruction that describes the task: ### Input: Create a new component. :param name: Name of the component :param status: Status of the component; 1-4 :param description: (optional) Description of the component :param link: (optional) A hyperlink to the component ...
def _package_to_staging(staging_package_url): """Repackage this package from local installed location and copy it to GCS. Args: staging_package_url: GCS path. """ import google.datalab.ml as ml # Find the package root. __file__ is under [package_root]/mltoolbox/_structured_data/this_file ...
Repackage this package from local installed location and copy it to GCS. Args: staging_package_url: GCS path.
Below is the the instruction that describes the task: ### Input: Repackage this package from local installed location and copy it to GCS. Args: staging_package_url: GCS path. ### Response: def _package_to_staging(staging_package_url): """Repackage this package from local installed location and copy ...
def with_legacy_dict(self, legacy_dict_object): """Configure a source that consumes the dict that where used on Lexicon 2.x""" warnings.warn(DeprecationWarning('Legacy configuration object has been used ' 'to load the ConfigResolver.')) return self.with_c...
Configure a source that consumes the dict that where used on Lexicon 2.x
Below is the the instruction that describes the task: ### Input: Configure a source that consumes the dict that where used on Lexicon 2.x ### Response: def with_legacy_dict(self, legacy_dict_object): """Configure a source that consumes the dict that where used on Lexicon 2.x""" warnings.warn(Deprec...
def _get_jid_snapshots(jid, config='root'): ''' Returns pre/post snapshots made by a given Salt jid Looks for 'salt_jid' entries into snapshots userdata which are created when 'snapper.run' is executed. ''' jid_snapshots = [x for x in list_snapshots(config) if x['userdata'].get("salt_jid") == j...
Returns pre/post snapshots made by a given Salt jid Looks for 'salt_jid' entries into snapshots userdata which are created when 'snapper.run' is executed.
Below is the the instruction that describes the task: ### Input: Returns pre/post snapshots made by a given Salt jid Looks for 'salt_jid' entries into snapshots userdata which are created when 'snapper.run' is executed. ### Response: def _get_jid_snapshots(jid, config='root'): ''' Returns pre/post...
def can_execute(self): """True if we can execute the callback.""" return not self._disabled and all(dep.status == dep.node.S_OK for dep in self.deps)
True if we can execute the callback.
Below is the the instruction that describes the task: ### Input: True if we can execute the callback. ### Response: def can_execute(self): """True if we can execute the callback.""" return not self._disabled and all(dep.status == dep.node.S_OK for dep in self.deps)
def get_operation_mtf_dimension_names(self, operation_name): """The Mesh TensorFlow dimensions associated with an operation. Args: operation_name: a string, name of an operation in the graph. Returns: a set(string), the names of Mesh TensorFlow dimensions. """ mtf_dimension_names = set...
The Mesh TensorFlow dimensions associated with an operation. Args: operation_name: a string, name of an operation in the graph. Returns: a set(string), the names of Mesh TensorFlow dimensions.
Below is the the instruction that describes the task: ### Input: The Mesh TensorFlow dimensions associated with an operation. Args: operation_name: a string, name of an operation in the graph. Returns: a set(string), the names of Mesh TensorFlow dimensions. ### Response: def get_operation_mtf...
def powerupsFor(self, interface): """ Returns powerups installed using C{powerUp}, in order of descending priority. Powerups found to have been deleted, either during the course of this powerupsFor iteration, during an upgrader, or previously, will not be returned. ...
Returns powerups installed using C{powerUp}, in order of descending priority. Powerups found to have been deleted, either during the course of this powerupsFor iteration, during an upgrader, or previously, will not be returned.
Below is the the instruction that describes the task: ### Input: Returns powerups installed using C{powerUp}, in order of descending priority. Powerups found to have been deleted, either during the course of this powerupsFor iteration, during an upgrader, or previously, will not be ...
def data_uuids(self, uuids, start, end, archiver="", timeout=DEFAULT_TIMEOUT): """ With the given list of UUIDs, retrieves all RAW data between the 2 given timestamps Arguments: [uuids]: list of UUIDs [start, end]: time references: [archiver]: if specified, this is the a...
With the given list of UUIDs, retrieves all RAW data between the 2 given timestamps Arguments: [uuids]: list of UUIDs [start, end]: time references: [archiver]: if specified, this is the archiver to use. Else, it will run on the first archiver passed into the constru...
Below is the the instruction that describes the task: ### Input: With the given list of UUIDs, retrieves all RAW data between the 2 given timestamps Arguments: [uuids]: list of UUIDs [start, end]: time references: [archiver]: if specified, this is the archiver to use. Else, it will ...
def bcftoolsMpileup(outFile, referenceFile, alignmentFile, executor): """ Use bcftools mpileup to generate VCF. @param outFile: The C{str} name to write the output to. @param referenceFile: The C{str} name of the FASTA file with the reference sequence. @param alignmentFile: The C{str} name ...
Use bcftools mpileup to generate VCF. @param outFile: The C{str} name to write the output to. @param referenceFile: The C{str} name of the FASTA file with the reference sequence. @param alignmentFile: The C{str} name of the SAM or BAM alignment file. @param executor: An C{Executor} instance.
Below is the the instruction that describes the task: ### Input: Use bcftools mpileup to generate VCF. @param outFile: The C{str} name to write the output to. @param referenceFile: The C{str} name of the FASTA file with the reference sequence. @param alignmentFile: The C{str} name of the SAM or...
def metadata_ports_to_k8s_ports(ports): """ :param ports: list of str, list of exposed ports, example: - ['1234/tcp', '8080/udp'] :return: list of V1ServicePort """ exposed_ports = [] for port in ports: splits = port.split("/", 1) port = int(splits[0]) proto...
:param ports: list of str, list of exposed ports, example: - ['1234/tcp', '8080/udp'] :return: list of V1ServicePort
Below is the the instruction that describes the task: ### Input: :param ports: list of str, list of exposed ports, example: - ['1234/tcp', '8080/udp'] :return: list of V1ServicePort ### Response: def metadata_ports_to_k8s_ports(ports): """ :param ports: list of str, list of exposed ports, e...
def disable_wx(self): """Disable event loop integration with wxPython. This merely sets PyOS_InputHook to NULL. """ if self._apps.has_key(GUI_WX): self._apps[GUI_WX]._in_event_loop = False self.clear_inputhook()
Disable event loop integration with wxPython. This merely sets PyOS_InputHook to NULL.
Below is the the instruction that describes the task: ### Input: Disable event loop integration with wxPython. This merely sets PyOS_InputHook to NULL. ### Response: def disable_wx(self): """Disable event loop integration with wxPython. This merely sets PyOS_InputHook to NULL. """...
def _getarray(loci, tree): """ parse the loci file list and return presence/absence matrix ordered by the tips on the tree """ ## order tips tree.ladderize() ## get tip names snames = tree.get_leaf_names() ## make an empty matrix lxs = np.zeros((len(snames), len(loci)), dtype...
parse the loci file list and return presence/absence matrix ordered by the tips on the tree
Below is the the instruction that describes the task: ### Input: parse the loci file list and return presence/absence matrix ordered by the tips on the tree ### Response: def _getarray(loci, tree): """ parse the loci file list and return presence/absence matrix ordered by the tips on the tree ...
def get_trips(self, authentication_info, start, end): """Get trips for this device between start and end.""" import requests if (authentication_info is None or not authentication_info.is_valid()): return [] data_url = "https://api.ritassist.nl/api/trips/GetTrips...
Get trips for this device between start and end.
Below is the the instruction that describes the task: ### Input: Get trips for this device between start and end. ### Response: def get_trips(self, authentication_info, start, end): """Get trips for this device between start and end.""" import requests if (authentication_info is None or ...
def update_viewer_state(rec, context): """ Given viewer session information, make sure the session information is compatible with the current version of the viewers, and if not, update the session information in-place. """ if '_protocol' not in rec: rec.pop('properties') rec['...
Given viewer session information, make sure the session information is compatible with the current version of the viewers, and if not, update the session information in-place.
Below is the the instruction that describes the task: ### Input: Given viewer session information, make sure the session information is compatible with the current version of the viewers, and if not, update the session information in-place. ### Response: def update_viewer_state(rec, context): """ G...
def predict_features(self, df_features, df_target, idx=0, **kwargs): """For one variable, predict its neighbouring nodes. Args: df_features (pandas.DataFrame): df_target (pandas.Series): idx (int): (optional) for printing purposes kwargs (dict): additiona...
For one variable, predict its neighbouring nodes. Args: df_features (pandas.DataFrame): df_target (pandas.Series): idx (int): (optional) for printing purposes kwargs (dict): additional options for algorithms Returns: list: scores of each feat...
Below is the the instruction that describes the task: ### Input: For one variable, predict its neighbouring nodes. Args: df_features (pandas.DataFrame): df_target (pandas.Series): idx (int): (optional) for printing purposes kwargs (dict): additional options f...
def get_partition_function(self): r""" Returns the partition function for a given undirected graph. A partition function is defined as .. math:: \sum_{X}(\prod_{i=1}^{m} \phi_i) where m is the number of factors present in the graph and X are all the random variables pr...
r""" Returns the partition function for a given undirected graph. A partition function is defined as .. math:: \sum_{X}(\prod_{i=1}^{m} \phi_i) where m is the number of factors present in the graph and X are all the random variables present. Examples -------- ...
Below is the the instruction that describes the task: ### Input: r""" Returns the partition function for a given undirected graph. A partition function is defined as .. math:: \sum_{X}(\prod_{i=1}^{m} \phi_i) where m is the number of factors present in the graph and X are ...
def tsv_pairs_to_dict(line: str, key_lower: bool = True) -> Dict[str, str]: r""" Converts a TSV line into sequential key/value pairs as a dictionary. For example, .. code-block:: none field1\tvalue1\tfield2\tvalue2 becomes .. code-block:: none {"field1": "value1", "field2":...
r""" Converts a TSV line into sequential key/value pairs as a dictionary. For example, .. code-block:: none field1\tvalue1\tfield2\tvalue2 becomes .. code-block:: none {"field1": "value1", "field2": "value2"} Args: line: the line key_lower: should the keys ...
Below is the the instruction that describes the task: ### Input: r""" Converts a TSV line into sequential key/value pairs as a dictionary. For example, .. code-block:: none field1\tvalue1\tfield2\tvalue2 becomes .. code-block:: none {"field1": "value1", "field2": "value2"} ...
def read_stdin(): """ Read text from stdin, and print a helpful message for ttys. """ if sys.stdin.isatty() and sys.stdout.isatty(): print('\nReading from stdin until end of file (Ctrl + D)...') return sys.stdin.read()
Read text from stdin, and print a helpful message for ttys.
Below is the the instruction that describes the task: ### Input: Read text from stdin, and print a helpful message for ttys. ### Response: def read_stdin(): """ Read text from stdin, and print a helpful message for ttys. """ if sys.stdin.isatty() and sys.stdout.isatty(): print('\nReading from stdin...
def shell(ctx): """ open an engineer shell """ shell = code.InteractiveConsole({"engineer": getattr(ctx.parent, "widget", None)}) shell.interact("\n".join([ "Engineer connected to %s" % ctx.parent.params["host"], "Dispatch available through the 'engineer' object" ]))
open an engineer shell
Below is the the instruction that describes the task: ### Input: open an engineer shell ### Response: def shell(ctx): """ open an engineer shell """ shell = code.InteractiveConsole({"engineer": getattr(ctx.parent, "widget", None)}) shell.interact("\n".join([ "Engineer connected to %s" ...
def run(self, options, args): """Prints the completion code of the given shell""" shells = COMPLETION_SCRIPTS.keys() shell_options = ['--' + shell for shell in sorted(shells)] if options.shell in shells: script = COMPLETION_SCRIPTS.get(options.shell, '') print(BAS...
Prints the completion code of the given shell
Below is the the instruction that describes the task: ### Input: Prints the completion code of the given shell ### Response: def run(self, options, args): """Prints the completion code of the given shell""" shells = COMPLETION_SCRIPTS.keys() shell_options = ['--' + shell for shell in sorted...
def get_stats(self, nid=None): """Get statistics for class :type nid: str :param nid: This is the ID of the network to get stats from. This is optional and only to override the existing `network_id` entered when created the class """ r = self.request( ...
Get statistics for class :type nid: str :param nid: This is the ID of the network to get stats from. This is optional and only to override the existing `network_id` entered when created the class
Below is the the instruction that describes the task: ### Input: Get statistics for class :type nid: str :param nid: This is the ID of the network to get stats from. This is optional and only to override the existing `network_id` entered when created the class ### Response:...
def on(cls, event, handler_func=None): """ Registers a handler function whenever an instance of the model emits the given event. This method can either called directly, passing a function reference: MyModel.on('did_save', my_function) ...or as a decorator of the fu...
Registers a handler function whenever an instance of the model emits the given event. This method can either called directly, passing a function reference: MyModel.on('did_save', my_function) ...or as a decorator of the function to be registered. @MyModel.on('did_save...
Below is the the instruction that describes the task: ### Input: Registers a handler function whenever an instance of the model emits the given event. This method can either called directly, passing a function reference: MyModel.on('did_save', my_function) ...or as a decorator...
def plotConvergenceByColumnTopology(results, columnRange, featureRange, networkType, numTrials): """ Plots the convergence graph: iterations vs number of columns. Each curve shows the convergence for a given number of unique features. """ #######################################################################...
Plots the convergence graph: iterations vs number of columns. Each curve shows the convergence for a given number of unique features.
Below is the the instruction that describes the task: ### Input: Plots the convergence graph: iterations vs number of columns. Each curve shows the convergence for a given number of unique features. ### Response: def plotConvergenceByColumnTopology(results, columnRange, featureRange, networkType, numTrials): "...
def _encryption_context_hash(hasher, encryption_context): """Generates the expected hash for the provided encryption context. :param hasher: Existing hasher to use :type hasher: cryptography.hazmat.primitives.hashes.Hash :param dict encryption_context: Encryption context to hash :returns: Complete ...
Generates the expected hash for the provided encryption context. :param hasher: Existing hasher to use :type hasher: cryptography.hazmat.primitives.hashes.Hash :param dict encryption_context: Encryption context to hash :returns: Complete hash :rtype: bytes
Below is the the instruction that describes the task: ### Input: Generates the expected hash for the provided encryption context. :param hasher: Existing hasher to use :type hasher: cryptography.hazmat.primitives.hashes.Hash :param dict encryption_context: Encryption context to hash :returns: Compl...
def ubnd(self): """ the upper bound vector while respecting log transform Returns ------- ubnd : pandas.Series """ if not self.istransformed: return self.pst.parameter_data.parubnd.copy() else: ub = self.pst.parameter_data.parubnd.copy() ...
the upper bound vector while respecting log transform Returns ------- ubnd : pandas.Series
Below is the the instruction that describes the task: ### Input: the upper bound vector while respecting log transform Returns ------- ubnd : pandas.Series ### Response: def ubnd(self): """ the upper bound vector while respecting log transform Returns ------- ...