code
stringlengths
75
104k
docstring
stringlengths
1
46.9k
text
stringlengths
164
112k
def getWriteSession(self): ''' return unscope session, TODO, make it clear ''' if self.WriteSession is None: self.WriteSession=sessionmaker(bind=self.engine) self.writeSession=self.WriteSession() return self.writeSession
return unscope session, TODO, make it clear
Below is the the instruction that describes the task: ### Input: return unscope session, TODO, make it clear ### Response: def getWriteSession(self): ''' return unscope session, TODO, make it clear ''' if self.WriteSession is None: self.WriteSession=sessionmaker(bind=self.engine) ...
def search(self, start_ts, end_ts): """Searches through all documents and finds all documents that were modified or deleted within the range. Since we have very few documents in the doc dict when this is called, linear search is fine. This method is only used by rollbacks to query ...
Searches through all documents and finds all documents that were modified or deleted within the range. Since we have very few documents in the doc dict when this is called, linear search is fine. This method is only used by rollbacks to query all the documents in the target engine withi...
Below is the the instruction that describes the task: ### Input: Searches through all documents and finds all documents that were modified or deleted within the range. Since we have very few documents in the doc dict when this is called, linear search is fine. This method is only used by ro...
def submitter(self): """ | Comment: The user who submitted the ticket. The submitter always becomes the author of the first comment on the ticket """ if self.api and self.submitter_id: return self.api._get_user(self.submitter_id)
| Comment: The user who submitted the ticket. The submitter always becomes the author of the first comment on the ticket
Below is the the instruction that describes the task: ### Input: | Comment: The user who submitted the ticket. The submitter always becomes the author of the first comment on the ticket ### Response: def submitter(self): """ | Comment: The user who submitted the ticket. The submitter always becom...
def set_dtype(self, opt, dtype): """Set the `dtype` attribute. If opt['DataType'] has a value other than None, it overrides the `dtype` parameter of this method. No changes are made if the `dtype` attribute already exists and has a value other than 'None'. Parameters ---...
Set the `dtype` attribute. If opt['DataType'] has a value other than None, it overrides the `dtype` parameter of this method. No changes are made if the `dtype` attribute already exists and has a value other than 'None'. Parameters ---------- opt : :class:`cdict.Constrai...
Below is the the instruction that describes the task: ### Input: Set the `dtype` attribute. If opt['DataType'] has a value other than None, it overrides the `dtype` parameter of this method. No changes are made if the `dtype` attribute already exists and has a value other than 'None'. ...
def is_alert_present(self): """Tests if an alert is present @return: True if alert is present, False otherwise """ current_frame = None try: current_frame = self.driver.current_window_handle a = self.driver.switch_to_alert() a.text exc...
Tests if an alert is present @return: True if alert is present, False otherwise
Below is the the instruction that describes the task: ### Input: Tests if an alert is present @return: True if alert is present, False otherwise ### Response: def is_alert_present(self): """Tests if an alert is present @return: True if alert is present, False otherwise """ ...
def write_long(self, number): """ Writes a long integer to the underlying output file as a 8-byte value. """ buf = pack(self.byte_order + "q", number) self.write(buf)
Writes a long integer to the underlying output file as a 8-byte value.
Below is the the instruction that describes the task: ### Input: Writes a long integer to the underlying output file as a 8-byte value. ### Response: def write_long(self, number): """ Writes a long integer to the underlying output file as a 8-byte value. """ buf = pack(self.byte_order + "q", number...
def update(self, value=None, force=False, **kwargs): 'Updates the ProgressBar to a new value.' if self.start_time is None: self.start() return self.update(value, force=force, **kwargs) if value is not None and value is not base.UnknownLength: if self.max_valu...
Updates the ProgressBar to a new value.
Below is the the instruction that describes the task: ### Input: Updates the ProgressBar to a new value. ### Response: def update(self, value=None, force=False, **kwargs): 'Updates the ProgressBar to a new value.' if self.start_time is None: self.start() return self.update(v...
def cls_register(cls, frameset, new_class, init_args, name=None): """ Register a new FrameSet or FrameSet subclass as a member/attribute of a class. Returns the new FrameSet or FrameSet subclass. Arguments: frameset : An existing FrameSet, or an iterable of strings. ...
Register a new FrameSet or FrameSet subclass as a member/attribute of a class. Returns the new FrameSet or FrameSet subclass. Arguments: frameset : An existing FrameSet, or an iterable of strings. init_args : A list of properties from the `frameset` to try to use ...
Below is the the instruction that describes the task: ### Input: Register a new FrameSet or FrameSet subclass as a member/attribute of a class. Returns the new FrameSet or FrameSet subclass. Arguments: frameset : An existing FrameSet, or an iterable of strings. init_...
def lifted_state_operator(state: TensorProductState, qubits: List[int]): """Take a TensorProductState along with a list of qubits and return a matrix corresponding to the tensored-up representation of the states' density operator form. Developer note: Quil and the QVM like qubits to be ordered such that qu...
Take a TensorProductState along with a list of qubits and return a matrix corresponding to the tensored-up representation of the states' density operator form. Developer note: Quil and the QVM like qubits to be ordered such that qubit 0 is on the right. Therefore, in ``qubit_adjacent_lifted_gate``, ``lifte...
Below is the the instruction that describes the task: ### Input: Take a TensorProductState along with a list of qubits and return a matrix corresponding to the tensored-up representation of the states' density operator form. Developer note: Quil and the QVM like qubits to be ordered such that qubit 0 is on...
def task_delete(self, **kw): """ Marks a task as deleted. """ id, task = self.get_task(**kw) if task['status'] == Status.DELETED: raise ValueError("Task is already deleted.") self._execute(id, 'delete') return self.get_task(uuid=task['uuid'])[1]
Marks a task as deleted.
Below is the the instruction that describes the task: ### Input: Marks a task as deleted. ### Response: def task_delete(self, **kw): """ Marks a task as deleted. """ id, task = self.get_task(**kw) if task['status'] == Status.DELETED: raise ValueError("Task is already deleted....
def runMultiplePassSPonly(df, model, nMultiplePass, nTrain): """ run CLA model SP through data record 0:nTrain nMultiplePass passes """ predictedField = model.getInferenceArgs()['predictedField'] print "run TM through the train data multiple times" for nPass in xrange(nMultiplePass): for j in xrange(nT...
run CLA model SP through data record 0:nTrain nMultiplePass passes
Below is the the instruction that describes the task: ### Input: run CLA model SP through data record 0:nTrain nMultiplePass passes ### Response: def runMultiplePassSPonly(df, model, nMultiplePass, nTrain): """ run CLA model SP through data record 0:nTrain nMultiplePass passes """ predictedField = model.g...
def _is_dynamic(v: Var) -> bool: """Return True if the Var holds a value which should be compiled to a dynamic Var access.""" return ( Maybe(v.meta) .map(lambda m: m.get(SYM_DYNAMIC_META_KEY, None)) # type: ignore .or_else_get(False) )
Return True if the Var holds a value which should be compiled to a dynamic Var access.
Below is the the instruction that describes the task: ### Input: Return True if the Var holds a value which should be compiled to a dynamic Var access. ### Response: def _is_dynamic(v: Var) -> bool: """Return True if the Var holds a value which should be compiled to a dynamic Var access.""" return ...
def _command_line(): # pragma: no cover pylint: disable=too-many-branches,too-many-statements """ Provide the command line interface. """ if __name__ == "PyFunceble": # We initiate the end of the coloration at the end of each line. initiate(autoreset=True) # We load the config...
Provide the command line interface.
Below is the the instruction that describes the task: ### Input: Provide the command line interface. ### Response: def _command_line(): # pragma: no cover pylint: disable=too-many-branches,too-many-statements """ Provide the command line interface. """ if __name__ == "PyFunceble": # We in...
def clear_completion(self): """Clears the completion. raise: NoAccess - ``Metadata.isRequired()`` or ``Metadata.isReadOnly()`` is ``true`` *compliance: mandatory -- This method must be implemented.* """ # Implemented from template for osid.grading.GradeSystemFo...
Clears the completion. raise: NoAccess - ``Metadata.isRequired()`` or ``Metadata.isReadOnly()`` is ``true`` *compliance: mandatory -- This method must be implemented.*
Below is the the instruction that describes the task: ### Input: Clears the completion. raise: NoAccess - ``Metadata.isRequired()`` or ``Metadata.isReadOnly()`` is ``true`` *compliance: mandatory -- This method must be implemented.* ### Response: def clear_completion(self): ...
def plotOneInferenceRun(stats, fields, basename, itemType="", plotDir="plots", ymax=100, trialNumber=0): """ Plots individual inference runs. """ if not os.path.exists(...
Plots individual inference runs.
Below is the the instruction that describes the task: ### Input: Plots individual inference runs. ### Response: def plotOneInferenceRun(stats, fields, basename, itemType="", plotDir="plots", ymax...
def record_close(object_id, input_params={}, always_retry=True, **kwargs): """ Invokes the /record-xxxx/close API method. For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Data-Object-Lifecycle#API-method%3A-%2Fclass-xxxx%2Fclose """ return DXHTTPRequest('/%s/close' % object_id...
Invokes the /record-xxxx/close API method. For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Data-Object-Lifecycle#API-method%3A-%2Fclass-xxxx%2Fclose
Below is the the instruction that describes the task: ### Input: Invokes the /record-xxxx/close API method. For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Data-Object-Lifecycle#API-method%3A-%2Fclass-xxxx%2Fclose ### Response: def record_close(object_id, input_params={}, always_retry=T...
def ticker(self, contract: Contract) -> Ticker: """ Get ticker of the given contract. It must have been requested before with reqMktData with the same contract object. The ticker may not be ready yet if called directly after :meth:`.reqMktData`. Args: contract: Contr...
Get ticker of the given contract. It must have been requested before with reqMktData with the same contract object. The ticker may not be ready yet if called directly after :meth:`.reqMktData`. Args: contract: Contract to get ticker for.
Below is the the instruction that describes the task: ### Input: Get ticker of the given contract. It must have been requested before with reqMktData with the same contract object. The ticker may not be ready yet if called directly after :meth:`.reqMktData`. Args: contract: Cont...
def check_array(array, accept_sparse=None, dtype="numeric", order=None, copy=False, force_all_finite=True, ensure_2d=True, allow_nd=False, ensure_min_samples=1, ensure_min_features=1): """Input validation on an array, list, sparse matrix or similar. By default, the input is conv...
Input validation on an array, list, sparse matrix or similar. By default, the input is converted to an at least 2nd numpy array. If the dtype of the array is object, attempt converting to float, raising on failure. Parameters ---------- array : object Input object to check / convert. ...
Below is the the instruction that describes the task: ### Input: Input validation on an array, list, sparse matrix or similar. By default, the input is converted to an at least 2nd numpy array. If the dtype of the array is object, attempt converting to float, raising on failure. Parameters ---...
def send_by_packet(self, data): """ Send data by packet on socket """ total_sent = 0 while total_sent < PACKET_SIZE: sent = self.sock.send(data[total_sent:]) if sent == 0: raise RuntimeError("socket connection broken") total_sen...
Send data by packet on socket
Below is the the instruction that describes the task: ### Input: Send data by packet on socket ### Response: def send_by_packet(self, data): """ Send data by packet on socket """ total_sent = 0 while total_sent < PACKET_SIZE: sent = self.sock.send(data[total_sent...
def special_target_typecheck(value): """ Special type checking for the target object :param value: <dict> :return: <bool> """ result = True # if key:Optional exists, it must be a dict object result &= isinstance(value.get(TARGET_OPTIONAL_FIELD, dict()), dict) return result
Special type checking for the target object :param value: <dict> :return: <bool>
Below is the the instruction that describes the task: ### Input: Special type checking for the target object :param value: <dict> :return: <bool> ### Response: def special_target_typecheck(value): """ Special type checking for the target object :param value: <dict> :return: <bool> """ ...
def register(self, name, description, obj, plugin): """ Registers a new shared object. :param name: Unique name for shared object :type name: str :param description: Description of shared object :type description: str :param obj: The object, which shall be shared...
Registers a new shared object. :param name: Unique name for shared object :type name: str :param description: Description of shared object :type description: str :param obj: The object, which shall be shared :type obj: any type :param plugin: Plugin, which regist...
Below is the the instruction that describes the task: ### Input: Registers a new shared object. :param name: Unique name for shared object :type name: str :param description: Description of shared object :type description: str :param obj: The object, which shall be shared ...
def funname(file): """Return variable names from file names.""" if isinstance(file, str): files = [file] else: files = file bases = [os.path.basename(f) for f in files] names = [os.path.splitext(b)[0] for b in bases] if isinstance(file, str): return names[0] else: ...
Return variable names from file names.
Below is the the instruction that describes the task: ### Input: Return variable names from file names. ### Response: def funname(file): """Return variable names from file names.""" if isinstance(file, str): files = [file] else: files = file bases = [os.path.basename(f) for f in fil...
def join_locale(comps): ''' Join a locale specifier split in the format returned by split_locale. ''' loc = comps['language'] if comps.get('territory'): loc += '_' + comps['territory'] if comps.get('codeset'): loc += '.' + comps['codeset'] if comps.get('modifier'): lo...
Join a locale specifier split in the format returned by split_locale.
Below is the the instruction that describes the task: ### Input: Join a locale specifier split in the format returned by split_locale. ### Response: def join_locale(comps): ''' Join a locale specifier split in the format returned by split_locale. ''' loc = comps['language'] if comps.get('territ...
def list_objects(self, path='', relative=False, first_level=False, max_request_entries=None): """ List objects. Args: path (str): Path or URL. relative (bool): Path is relative to current root. first_level (bool): It True, returns only fi...
List objects. Args: path (str): Path or URL. relative (bool): Path is relative to current root. first_level (bool): It True, returns only first level objects. Else, returns full tree. max_request_entries (int): If specified, maximum entries return...
Below is the the instruction that describes the task: ### Input: List objects. Args: path (str): Path or URL. relative (bool): Path is relative to current root. first_level (bool): It True, returns only first level objects. Else, returns full tree. ...
def argmax(self): """Index of the maximum, ignorning nans.""" if "argmax" not in self.attrs.keys(): def f(dataset, s): arr = dataset[s] try: amin = np.nanargmax(arr) except ValueError: amin = 0 ...
Index of the maximum, ignorning nans.
Below is the the instruction that describes the task: ### Input: Index of the maximum, ignorning nans. ### Response: def argmax(self): """Index of the maximum, ignorning nans.""" if "argmax" not in self.attrs.keys(): def f(dataset, s): arr = dataset[s] t...
def evaluate(best_processed_path, model): """ Evaluate model on splitted 10 percent testing set """ x_test_char, x_test_type, y_test = prepare_feature(best_processed_path, option='test') y_predict = model.predict([x_test_char, x_test_type]) y_predict = (y_predict.ravel() > 0.5).astype(int) ...
Evaluate model on splitted 10 percent testing set
Below is the the instruction that describes the task: ### Input: Evaluate model on splitted 10 percent testing set ### Response: def evaluate(best_processed_path, model): """ Evaluate model on splitted 10 percent testing set """ x_test_char, x_test_type, y_test = prepare_feature(best_processed_path...
def get_encryption_key_status(self): """Read information about the current encryption key used by Vault. Supported methods: GET: /sys/key-status. Produces: 200 application/json :return: JSON response with information regarding the current encryption key used by Vault. :rtyp...
Read information about the current encryption key used by Vault. Supported methods: GET: /sys/key-status. Produces: 200 application/json :return: JSON response with information regarding the current encryption key used by Vault. :rtype: dict
Below is the the instruction that describes the task: ### Input: Read information about the current encryption key used by Vault. Supported methods: GET: /sys/key-status. Produces: 200 application/json :return: JSON response with information regarding the current encryption key used by...
def current(cls): """Get the current event loop singleton object. """ try: return _tls.loop except AttributeError: # create loop only for main thread if threading.current_thread().name == 'MainThread': _tls.loop = cls() ...
Get the current event loop singleton object.
Below is the the instruction that describes the task: ### Input: Get the current event loop singleton object. ### Response: def current(cls): """Get the current event loop singleton object. """ try: return _tls.loop except AttributeError: # create loop only f...
def offset_gen(offset, iterable, skip_signal=None): '''A generator that applies an `offset`, skipping `offset` elements from `iterable`. If skip_signal is a callable, it will be called with every skipped element. ''' offset = int(offset) assert offset >= 0, 'negative offset' for item in iterable: if ...
A generator that applies an `offset`, skipping `offset` elements from `iterable`. If skip_signal is a callable, it will be called with every skipped element.
Below is the the instruction that describes the task: ### Input: A generator that applies an `offset`, skipping `offset` elements from `iterable`. If skip_signal is a callable, it will be called with every skipped element. ### Response: def offset_gen(offset, iterable, skip_signal=None): '''A generator that ...
def _add_resource_descriptions_to_pools(self, meta_list): """ Takes a list of resource descriptions adding them to the resource pool they belong to scheduling them for loading. """ if not meta_list: return for meta in meta_list: getattr(r...
Takes a list of resource descriptions adding them to the resource pool they belong to scheduling them for loading.
Below is the the instruction that describes the task: ### Input: Takes a list of resource descriptions adding them to the resource pool they belong to scheduling them for loading. ### Response: def _add_resource_descriptions_to_pools(self, meta_list): """ Takes a list of resource descrip...
def FetchMostRecentGraphSeries(label, report_type, token = None ): """Fetches the latest graph series for a client label from the DB. Args: label: Client label to fetch data for. report_type: rdf_stats.ClientGraphSe...
Fetches the latest graph series for a client label from the DB. Args: label: Client label to fetch data for. report_type: rdf_stats.ClientGraphSeries.ReportType to fetch data for. token: ACL token to use for reading from the legacy (non-relational) datastore. Raises: AFF4AttributeTypeError: ...
Below is the the instruction that describes the task: ### Input: Fetches the latest graph series for a client label from the DB. Args: label: Client label to fetch data for. report_type: rdf_stats.ClientGraphSeries.ReportType to fetch data for. token: ACL token to use for reading from the legacy (non...
def format(self, node_formatter=None, separator='/'): # type: (Optional[Callable[[PathParam], str]]) -> str """ Format a URL path. An optional `node_parser(PathNode)` can be supplied for converting a `PathNode` into a string to support the current web framework. ...
Format a URL path. An optional `node_parser(PathNode)` can be supplied for converting a `PathNode` into a string to support the current web framework.
Below is the the instruction that describes the task: ### Input: Format a URL path. An optional `node_parser(PathNode)` can be supplied for converting a `PathNode` into a string to support the current web framework. ### Response: def format(self, node_formatter=None, separator='/'): ...
def run_command(cmd, *args): """ Runs command on the system with given ``args``. """ command = ' '.join((cmd, args)) p = Popen(command, shell=True, stdout=PIPE, stderr=PIPE) stdout, stderr = p.communicate() return p.retcode, stdout, stderr
Runs command on the system with given ``args``.
Below is the the instruction that describes the task: ### Input: Runs command on the system with given ``args``. ### Response: def run_command(cmd, *args): """ Runs command on the system with given ``args``. """ command = ' '.join((cmd, args)) p = Popen(command, shell=True, stdout=PIPE, stderr=...
def string_to_general_float(s: str) -> float: """ Convert a string to corresponding single or double precision scientific number. :param s: a string could be '0.1', '1e-5', '1.0D-5', or any other validated number :return: a float or raise an error .. doctest:: >>> string_to_general_float(...
Convert a string to corresponding single or double precision scientific number. :param s: a string could be '0.1', '1e-5', '1.0D-5', or any other validated number :return: a float or raise an error .. doctest:: >>> string_to_general_float('1.0D-5') 1e-05 >>> string_to_general_floa...
Below is the the instruction that describes the task: ### Input: Convert a string to corresponding single or double precision scientific number. :param s: a string could be '0.1', '1e-5', '1.0D-5', or any other validated number :return: a float or raise an error .. doctest:: >>> string_to_gen...
def rgb_color_list_to_hex(color_list): """ Convert a list of RGBa colors to a list of hexadecimal color codes. Parameters ---------- color_list : list the list of RGBa colors Returns ------- color_list_hex : list """ color_list_rgb = [[int(x*255) for x in c[0:3]] for c ...
Convert a list of RGBa colors to a list of hexadecimal color codes. Parameters ---------- color_list : list the list of RGBa colors Returns ------- color_list_hex : list
Below is the the instruction that describes the task: ### Input: Convert a list of RGBa colors to a list of hexadecimal color codes. Parameters ---------- color_list : list the list of RGBa colors Returns ------- color_list_hex : list ### Response: def rgb_color_list_to_hex(color_...
def __remove_actions(self): """ Removes actions. """ LOGGER.debug("> Removing '{0}' Component actions.".format(self.__class__.__name__)) remove_project_action = "Actions|Umbra|Components|factory.script_editor|&File|Remove Project" self.__script_editor.command_menu.remov...
Removes actions.
Below is the the instruction that describes the task: ### Input: Removes actions. ### Response: def __remove_actions(self): """ Removes actions. """ LOGGER.debug("> Removing '{0}' Component actions.".format(self.__class__.__name__)) remove_project_action = "Actions|Umbra|C...
def from_file(cls, fname, version=None, require_https=True): """ Create a Hive object based on JSON located in a local file. """ if os.path.exists(fname): with open(fname) as hive_file: return cls(**json.load(hive_file)).from_version(version, require_https=req...
Create a Hive object based on JSON located in a local file.
Below is the the instruction that describes the task: ### Input: Create a Hive object based on JSON located in a local file. ### Response: def from_file(cls, fname, version=None, require_https=True): """ Create a Hive object based on JSON located in a local file. """ if os.path.exis...
def _ProcessArtifactFilesSource(self, source): """Get artifact responses, extract paths and send corresponding files.""" if source.path_type != rdf_paths.PathSpec.PathType.OS: raise ValueError("Only supported path type is OS.") # TODO(user): Check paths for GlobExpressions. # If it contains a * ...
Get artifact responses, extract paths and send corresponding files.
Below is the the instruction that describes the task: ### Input: Get artifact responses, extract paths and send corresponding files. ### Response: def _ProcessArtifactFilesSource(self, source): """Get artifact responses, extract paths and send corresponding files.""" if source.path_type != rdf_paths.PathS...
def p_static_non_empty_array_pair_list_pair(p): '''static_non_empty_array_pair_list : static_non_empty_array_pair_list COMMA static_scalar DOUBLE_ARROW static_scalar | static_scalar DOUBLE_ARROW static_scalar''' if len(p) == 6: p[0] = p[1] + [ast.ArrayElement(p[3]...
static_non_empty_array_pair_list : static_non_empty_array_pair_list COMMA static_scalar DOUBLE_ARROW static_scalar | static_scalar DOUBLE_ARROW static_scalar
Below is the the instruction that describes the task: ### Input: static_non_empty_array_pair_list : static_non_empty_array_pair_list COMMA static_scalar DOUBLE_ARROW static_scalar | static_scalar DOUBLE_ARROW static_scalar ### Response: def p_static_non_empty_array_pair_list...
def _client(self, host, port, unix_socket, auth): """Return a redis client for the configuration. :param str host: redis host :param int port: redis port :rtype: redis.Redis """ db = int(self.config['db']) timeout = int(self.config['timeout']) try: cli = redis.Redis...
Return a redis client for the configuration. :param str host: redis host :param int port: redis port :rtype: redis.Redis
Below is the the instruction that describes the task: ### Input: Return a redis client for the configuration. :param str host: redis host :param int port: redis port :rtype: redis.Redis ### Response: def _client(self, host, port, unix_socket, auth): """Return a redis client for the configuration. :param ...
def _parse_function_expression(function_specification): """ Parse a complex function expression like: ((((powerlaw{1} + (sin{2} * 3)) + (sin{2} * 25)) - (powerlaw{1} * 16)) + (sin{2} ** 3.0)) and return a composite function instance :param function_specification: :return: a composite function...
Parse a complex function expression like: ((((powerlaw{1} + (sin{2} * 3)) + (sin{2} * 25)) - (powerlaw{1} * 16)) + (sin{2} ** 3.0)) and return a composite function instance :param function_specification: :return: a composite function instance
Below is the the instruction that describes the task: ### Input: Parse a complex function expression like: ((((powerlaw{1} + (sin{2} * 3)) + (sin{2} * 25)) - (powerlaw{1} * 16)) + (sin{2} ** 3.0)) and return a composite function instance :param function_specification: :return: a composite functio...
def manage_fits(list_of_frame): """Manage a list of FITS resources""" import astropy.io.fits as fits import numina.types.dataframe as df refs = [] for frame in list_of_frame: if isinstance(frame, str): ref = fits.open(frame) refs.append(ref) elif isinstance(...
Manage a list of FITS resources
Below is the the instruction that describes the task: ### Input: Manage a list of FITS resources ### Response: def manage_fits(list_of_frame): """Manage a list of FITS resources""" import astropy.io.fits as fits import numina.types.dataframe as df refs = [] for frame in list_of_frame: ...
def scroll_down(lines=1, file=sys.stdout): """ Scroll the whole page down a number of lines, new lines are added to the top. Esc[<lines>T """ scroll.down(lines).write(file=file)
Scroll the whole page down a number of lines, new lines are added to the top. Esc[<lines>T
Below is the the instruction that describes the task: ### Input: Scroll the whole page down a number of lines, new lines are added to the top. Esc[<lines>T ### Response: def scroll_down(lines=1, file=sys.stdout): """ Scroll the whole page down a number of lines, new lines are added to ...
def publish_table_notification(table_key, message, message_types, subject=None): """ Publish a notification for a specific table :type table_key: str :param table_key: Table configuration option key name :type message: str :param message: Message to send via SNS :type message_types: list :p...
Publish a notification for a specific table :type table_key: str :param table_key: Table configuration option key name :type message: str :param message: Message to send via SNS :type message_types: list :param message_types: List with types: - scale-up - scale-down ...
Below is the the instruction that describes the task: ### Input: Publish a notification for a specific table :type table_key: str :param table_key: Table configuration option key name :type message: str :param message: Message to send via SNS :type message_types: list :param message_types: ...
def get_cookies_for_class(session, class_name, cookies_file=None, username=None, password=None): """ Get the cookies for the given class. We do not validate the cookies if they are loaded from a cookies file because this is i...
Get the cookies for the given class. We do not validate the cookies if they are loaded from a cookies file because this is intended for debugging purposes or if the coursera authentication process has changed.
Below is the the instruction that describes the task: ### Input: Get the cookies for the given class. We do not validate the cookies if they are loaded from a cookies file because this is intended for debugging purposes or if the coursera authentication process has changed. ### Response: def get_cooki...
def bss_eval_images_framewise(reference_sources, estimated_sources, window=30 * 44100, hop=15 * 44100, compute_permutation=False): """ BSS Eval v3 bss_eval_images_framewise Framewise computation of bss_eval_images. Wrapper to ``bss_eval`` with...
BSS Eval v3 bss_eval_images_framewise Framewise computation of bss_eval_images. Wrapper to ``bss_eval`` with the right parameters.
Below is the the instruction that describes the task: ### Input: BSS Eval v3 bss_eval_images_framewise Framewise computation of bss_eval_images. Wrapper to ``bss_eval`` with the right parameters. ### Response: def bss_eval_images_framewise(reference_sources, estimated_sources, ...
def get(self, field=None, index=None, lpar=0, prompt=1, native=0, mode="h"): """Return value of this parameter as a string (or in native format if native is non-zero.)""" if field: return self._getField(field,native=native,prompt=prompt) # may prompt for value if prompt flag is set ...
Return value of this parameter as a string (or in native format if native is non-zero.)
Below is the the instruction that describes the task: ### Input: Return value of this parameter as a string (or in native format if native is non-zero.) ### Response: def get(self, field=None, index=None, lpar=0, prompt=1, native=0, mode="h"): """Return value of this parameter as a string (or in na...
def post_request(self, request, response): # type: (BaseHttpRequest, HttpResponse) -> HttpResponse """ Post-request hook to allow CORS headers to responses. """ if request.method != api.Method.OPTIONS: response.headers.update(self.request_headers(request)) ret...
Post-request hook to allow CORS headers to responses.
Below is the the instruction that describes the task: ### Input: Post-request hook to allow CORS headers to responses. ### Response: def post_request(self, request, response): # type: (BaseHttpRequest, HttpResponse) -> HttpResponse """ Post-request hook to allow CORS headers to responses. ...
def generate_span_requests(self, span_datas): """Span request generator. :type span_datas: list of :class:`~opencensus.trace.span_data.SpanData` :param span_datas: SpanData tuples to convert to protobuf spans and send to opensensusd agent ...
Span request generator. :type span_datas: list of :class:`~opencensus.trace.span_data.SpanData` :param span_datas: SpanData tuples to convert to protobuf spans and send to opensensusd agent :rtype: list of `~gen.opencensus.age...
Below is the the instruction that describes the task: ### Input: Span request generator. :type span_datas: list of :class:`~opencensus.trace.span_data.SpanData` :param span_datas: SpanData tuples to convert to protobuf spans and send to opensensus...
def get_metrics(awsclient, name): """Print out cloudformation metrics for a lambda function. :param awsclient :param name: name of the lambda function :return: exit_code """ metrics = ['Duration', 'Errors', 'Invocations', 'Throttles'] client_cw = awsclient.get_client('cloudwatch') for m...
Print out cloudformation metrics for a lambda function. :param awsclient :param name: name of the lambda function :return: exit_code
Below is the the instruction that describes the task: ### Input: Print out cloudformation metrics for a lambda function. :param awsclient :param name: name of the lambda function :return: exit_code ### Response: def get_metrics(awsclient, name): """Print out cloudformation metrics for a lambda fun...
def _sample(self, position, trajectory_length, stepsize, lsteps=None): """ Runs a single sampling iteration to return a sample """ # Resampling momentum momentum = np.reshape(np.random.normal(0, 1, len(position)), position.shape) # position_m here will be the previous sa...
Runs a single sampling iteration to return a sample
Below is the the instruction that describes the task: ### Input: Runs a single sampling iteration to return a sample ### Response: def _sample(self, position, trajectory_length, stepsize, lsteps=None): """ Runs a single sampling iteration to return a sample """ # Resampling momentum...
def python_2_nonzero_compatible(klass): """ Adds a `__nonzero__()` method to classes that define a `__bool__()` method, so boolean conversion works in Python 2. Has no effect in Python 3. :param klass: The class to modify. Must define `__bool__()`. :return: The possibly patched class. """ i...
Adds a `__nonzero__()` method to classes that define a `__bool__()` method, so boolean conversion works in Python 2. Has no effect in Python 3. :param klass: The class to modify. Must define `__bool__()`. :return: The possibly patched class.
Below is the the instruction that describes the task: ### Input: Adds a `__nonzero__()` method to classes that define a `__bool__()` method, so boolean conversion works in Python 2. Has no effect in Python 3. :param klass: The class to modify. Must define `__bool__()`. :return: The possibly patched cla...
def simplex_determine_leaving_arc(self, t, k, l): ''' API: simplex_determine_leaving_arc(self, t, k, l) Description: Determines and returns the leaving arc. Input: t: current spanning tree solution. k: tail of the entering arc. ...
API: simplex_determine_leaving_arc(self, t, k, l) Description: Determines and returns the leaving arc. Input: t: current spanning tree solution. k: tail of the entering arc. l: head of the entering arc. Return: Returns the t...
Below is the the instruction that describes the task: ### Input: API: simplex_determine_leaving_arc(self, t, k, l) Description: Determines and returns the leaving arc. Input: t: current spanning tree solution. k: tail of the entering arc. l...
def read(cls, root_tex_path): """Construct an `LsstLatexDoc` instance by reading and parsing the LaTeX source. Parameters ---------- root_tex_path : `str` Path to the LaTeX source on the filesystem. For multi-file LaTeX projects this should be the path to...
Construct an `LsstLatexDoc` instance by reading and parsing the LaTeX source. Parameters ---------- root_tex_path : `str` Path to the LaTeX source on the filesystem. For multi-file LaTeX projects this should be the path to the root document. Notes ...
Below is the the instruction that describes the task: ### Input: Construct an `LsstLatexDoc` instance by reading and parsing the LaTeX source. Parameters ---------- root_tex_path : `str` Path to the LaTeX source on the filesystem. For multi-file LaTeX project...
def _graph_add_edge(self, cfg_node, src_node, src_jumpkind, src_ins_addr, src_stmt_idx): """ Add edge between nodes, or add node if entry point :param CFGNode cfg_node: node which is jumped to :param CFGNode src_node: node which is jumped from none if entry point :param str src_...
Add edge between nodes, or add node if entry point :param CFGNode cfg_node: node which is jumped to :param CFGNode src_node: node which is jumped from none if entry point :param str src_jumpkind: what type of jump the edge takes :param int or str src_stmt_idx: source statements ID ...
Below is the the instruction that describes the task: ### Input: Add edge between nodes, or add node if entry point :param CFGNode cfg_node: node which is jumped to :param CFGNode src_node: node which is jumped from none if entry point :param str src_jumpkind: what type of jump the edge tak...
def update(self, forecasts, observations): """ Update the statistics with forecasts and observations. Args: forecasts: The discrete Cumulative Distribution Functions of observations: """ if len(observations.shape) == 1: obs_cdfs = np.zeros((ob...
Update the statistics with forecasts and observations. Args: forecasts: The discrete Cumulative Distribution Functions of observations:
Below is the the instruction that describes the task: ### Input: Update the statistics with forecasts and observations. Args: forecasts: The discrete Cumulative Distribution Functions of observations: ### Response: def update(self, forecasts, observations): """ Upda...
def register_module(self, module, **options): """Registers a module with this application. The keyword argument of this function are the same as the ones for the constructor of the :class:`Module` class and will override the values of the module if provided. .. versionchanged::...
Registers a module with this application. The keyword argument of this function are the same as the ones for the constructor of the :class:`Module` class and will override the values of the module if provided. .. versionchanged:: 0.7 The module system was deprecated in favor...
Below is the the instruction that describes the task: ### Input: Registers a module with this application. The keyword argument of this function are the same as the ones for the constructor of the :class:`Module` class and will override the values of the module if provided. .. vers...
def update_meta_data(meta=None): """ Modify the metadata dictionary. DATE, PROGRAM, and PROGVER are added/modified. Parameters ---------- meta : dict The dictionary to be modified, default = None (empty) Returns ------- An updated dictionary. """ if meta is None...
Modify the metadata dictionary. DATE, PROGRAM, and PROGVER are added/modified. Parameters ---------- meta : dict The dictionary to be modified, default = None (empty) Returns ------- An updated dictionary.
Below is the the instruction that describes the task: ### Input: Modify the metadata dictionary. DATE, PROGRAM, and PROGVER are added/modified. Parameters ---------- meta : dict The dictionary to be modified, default = None (empty) Returns ------- An updated dictionary. ###...
def load_rnn_checkpoint(cells, prefix, epoch): """Load model checkpoint from file. Pack weights after loading. Parameters ---------- cells : mxnet.rnn.RNNCell or list of RNNCells The RNN cells used by this symbol. prefix : str Prefix of model name. epoch : int Epoch ...
Load model checkpoint from file. Pack weights after loading. Parameters ---------- cells : mxnet.rnn.RNNCell or list of RNNCells The RNN cells used by this symbol. prefix : str Prefix of model name. epoch : int Epoch number of model we would like to load. Returns ...
Below is the the instruction that describes the task: ### Input: Load model checkpoint from file. Pack weights after loading. Parameters ---------- cells : mxnet.rnn.RNNCell or list of RNNCells The RNN cells used by this symbol. prefix : str Prefix of model name. epoch : int...
def update_device_info_list(self): """ Updates the device information list. You'll have to call this method every time you added CTI files or plugged/unplugged devices. :return: None. """ # self._release_gentl_producers() try: self._open_gent...
Updates the device information list. You'll have to call this method every time you added CTI files or plugged/unplugged devices. :return: None.
Below is the the instruction that describes the task: ### Input: Updates the device information list. You'll have to call this method every time you added CTI files or plugged/unplugged devices. :return: None. ### Response: def update_device_info_list(self): """ Updates the device ...
def run(self): """Run the App main logic. This method should contain the core logic of the App. """ # read inputs indent = int(self.tcex.playbook.read(self.args.indent)) json_data = self.tcex.playbook.read(self.args.json_data) # get the playbook variable type ...
Run the App main logic. This method should contain the core logic of the App.
Below is the the instruction that describes the task: ### Input: Run the App main logic. This method should contain the core logic of the App. ### Response: def run(self): """Run the App main logic. This method should contain the core logic of the App. """ # read inputs ...
def create_treecolumn(self, objectlist): """Create a gtk.TreeViewColumn for the configuration. """ col = gtk.TreeViewColumn(self.title) col.set_data('pygtkhelpers::objectlist', objectlist) col.set_data('pygtkhelpers::column', self) col.props.visible = self.visible ...
Create a gtk.TreeViewColumn for the configuration.
Below is the the instruction that describes the task: ### Input: Create a gtk.TreeViewColumn for the configuration. ### Response: def create_treecolumn(self, objectlist): """Create a gtk.TreeViewColumn for the configuration. """ col = gtk.TreeViewColumn(self.title) col.set_data('pyg...
def ModuleLogger(globs): """Create a module level logger. To debug a module, create a _debug variable in the module, then use the ModuleLogger function to create a "module level" logger. When a handler is added to this logger or a child of this logger, the _debug variable will be incremented. ...
Create a module level logger. To debug a module, create a _debug variable in the module, then use the ModuleLogger function to create a "module level" logger. When a handler is added to this logger or a child of this logger, the _debug variable will be incremented. All of the calls within functio...
Below is the the instruction that describes the task: ### Input: Create a module level logger. To debug a module, create a _debug variable in the module, then use the ModuleLogger function to create a "module level" logger. When a handler is added to this logger or a child of this logger, the _debug v...
def create_store(): """ A helper for setting the _proxy and slapping the store object for us. :return: A thread-local storage as a dictionary """ new_storage = _proxy('store') _state.store = type('store', (object,), {}) new_storage.store = dict() return new_storage.store
A helper for setting the _proxy and slapping the store object for us. :return: A thread-local storage as a dictionary
Below is the the instruction that describes the task: ### Input: A helper for setting the _proxy and slapping the store object for us. :return: A thread-local storage as a dictionary ### Response: def create_store(): """ A helper for setting the _proxy and slapping the store object for us. ...
def encode(self, x): """ Given an input array `x` it returns its associated encoding `y(x)`, that is, a stable configuration (local energy minimum) of the hidden units while the visible units are clampled to `x`. Note that NO learning takes place. """ E...
Given an input array `x` it returns its associated encoding `y(x)`, that is, a stable configuration (local energy minimum) of the hidden units while the visible units are clampled to `x`. Note that NO learning takes place.
Below is the the instruction that describes the task: ### Input: Given an input array `x` it returns its associated encoding `y(x)`, that is, a stable configuration (local energy minimum) of the hidden units while the visible units are clampled to `x`. Note that NO learning takes ...
def as_child(cls, global_config, parent=None): '''Run a single job in a child process. This method never returns; it always calls :func:`sys.exit` with an error code that says what it did. ''' try: setproctitle('rejester worker') random.seed() # otherwi...
Run a single job in a child process. This method never returns; it always calls :func:`sys.exit` with an error code that says what it did.
Below is the the instruction that describes the task: ### Input: Run a single job in a child process. This method never returns; it always calls :func:`sys.exit` with an error code that says what it did. ### Response: def as_child(cls, global_config, parent=None): '''Run a single job in a ...
def is_bit_mask(enumeration, potential_mask): """ A utility function that checks if the provided value is a composite bit mask of enumeration values in the specified enumeration class. Args: enumeration (class): One of the mask enumeration classes found in this file. These include: ...
A utility function that checks if the provided value is a composite bit mask of enumeration values in the specified enumeration class. Args: enumeration (class): One of the mask enumeration classes found in this file. These include: * Cryptographic Usage Mask ...
Below is the the instruction that describes the task: ### Input: A utility function that checks if the provided value is a composite bit mask of enumeration values in the specified enumeration class. Args: enumeration (class): One of the mask enumeration classes found in this file. Thes...
def content_type(self, value=None): """ Set (replace) and or get "Content-Type" header value :param value: value to set (if specified) :return: None if header doesn't exist, otherwise - str """ content_type = self.normalize_name('Content-Type') if value is not None: self.replace_headers(content_type, va...
Set (replace) and or get "Content-Type" header value :param value: value to set (if specified) :return: None if header doesn't exist, otherwise - str
Below is the the instruction that describes the task: ### Input: Set (replace) and or get "Content-Type" header value :param value: value to set (if specified) :return: None if header doesn't exist, otherwise - str ### Response: def content_type(self, value=None): """ Set (replace) and or get "Content-Type"...
def get_kernel_spec(self, kernel_name): """Returns a :class:`KernelSpec` instance for the given kernel_name. Raises :exc:`NoSuchKernel` if the given kernel name is not found. """ if kernel_name == CURRENT_ENV_KERNEL_NAME: return self.kernel_spec_class( resour...
Returns a :class:`KernelSpec` instance for the given kernel_name. Raises :exc:`NoSuchKernel` if the given kernel name is not found.
Below is the the instruction that describes the task: ### Input: Returns a :class:`KernelSpec` instance for the given kernel_name. Raises :exc:`NoSuchKernel` if the given kernel name is not found. ### Response: def get_kernel_spec(self, kernel_name): """Returns a :class:`KernelSpec` instance for t...
def reset_to_flows(self, force=False): """ Keeps only the absolute values. This removes all attributes which can not be aggregated and must be recalculated after the aggregation. Parameters ---------- force: boolean, optional If True, reset to flows althoug...
Keeps only the absolute values. This removes all attributes which can not be aggregated and must be recalculated after the aggregation. Parameters ---------- force: boolean, optional If True, reset to flows although the system can not be recalculated. D...
Below is the the instruction that describes the task: ### Input: Keeps only the absolute values. This removes all attributes which can not be aggregated and must be recalculated after the aggregation. Parameters ---------- force: boolean, optional If True, rese...
def list(self, request, *args, **kwargs): """ To get a list of default price list items, run **GET** against */api/default-price-list-items/* as authenticated user. Price lists can be filtered by: - ?key=<string> - ?item_type=<string> has to be from list of available i...
To get a list of default price list items, run **GET** against */api/default-price-list-items/* as authenticated user. Price lists can be filtered by: - ?key=<string> - ?item_type=<string> has to be from list of available item_types (available options: 'flavor', 'storage', ...
Below is the the instruction that describes the task: ### Input: To get a list of default price list items, run **GET** against */api/default-price-list-items/* as authenticated user. Price lists can be filtered by: - ?key=<string> - ?item_type=<string> has to be from list of avai...
def update_func_body(original, updater=None): """Update all function body using the updating function.""" updated = '' regex = r'([_\w][_\w\d]*)\s*\(.*\)\s*\{' match = re.search(regex, original) while match: name = match.group(1) logging.debug(_('Found candidate: %s'), name) ...
Update all function body using the updating function.
Below is the the instruction that describes the task: ### Input: Update all function body using the updating function. ### Response: def update_func_body(original, updater=None): """Update all function body using the updating function.""" updated = '' regex = r'([_\w][_\w\d]*)\s*\(.*\)\s*\{' match ...
def block_range(self, lineno): """Get a range from the given line number to where this node ends. :param lineno: The line number to start the range at. :type lineno: int :returns: The range of line numbers that this node belongs to, starting at the given line number. ...
Get a range from the given line number to where this node ends. :param lineno: The line number to start the range at. :type lineno: int :returns: The range of line numbers that this node belongs to, starting at the given line number. :rtype: tuple(int, int)
Below is the the instruction that describes the task: ### Input: Get a range from the given line number to where this node ends. :param lineno: The line number to start the range at. :type lineno: int :returns: The range of line numbers that this node belongs to, starting at th...
def evaluate(g: Graph, schema: Union[str, ShExJ.Schema], focus: Optional[Union[str, URIRef, IRIREF]], start: Optional[Union[str, URIRef, IRIREF, START, START_TYPE]]=None, debug_trace: bool = False) -> Tuple[bool, Optional[str]]: """ Evaluate focus node `focus` in ...
Evaluate focus node `focus` in graph `g` against shape `shape` in ShEx schema `schema` :param g: Graph containing RDF :param schema: ShEx Schema -- if str, it will be parsed :param focus: focus node in g. If not specified, all URI subjects in G will be evaluated. :param start: Starting shape. If omitt...
Below is the the instruction that describes the task: ### Input: Evaluate focus node `focus` in graph `g` against shape `shape` in ShEx schema `schema` :param g: Graph containing RDF :param schema: ShEx Schema -- if str, it will be parsed :param focus: focus node in g. If not specified, all URI subject...
def _merge_outfile_fname(out_file, bam_files, work_dir, batch): """Derive correct name of BAM file based on batching. """ if out_file is None: out_file = os.path.join(work_dir, os.path.basename(sorted(bam_files)[0])) if batch is not None: base, ext = os.path.splitext(out_file) ou...
Derive correct name of BAM file based on batching.
Below is the the instruction that describes the task: ### Input: Derive correct name of BAM file based on batching. ### Response: def _merge_outfile_fname(out_file, bam_files, work_dir, batch): """Derive correct name of BAM file based on batching. """ if out_file is None: out_file = os.path.joi...
def get_request_body_chunk(self, content: bytes, closed: bool, more_content: bool) -> Dict[str, Any]: ''' http://channels.readthedocs.io/en/stable/asgi/www.html#request-body-chunk ''' return { 'content': content, 'closed': closed, ...
http://channels.readthedocs.io/en/stable/asgi/www.html#request-body-chunk
Below is the the instruction that describes the task: ### Input: http://channels.readthedocs.io/en/stable/asgi/www.html#request-body-chunk ### Response: def get_request_body_chunk(self, content: bytes, closed: bool, more_content: bool) -> Dict[str, Any]: ''' http://ch...
def computePi(self,method='power'): """ Calculate the steady state distribution using your preferred method and store it in the attribute `pi`. By default uses the most robust method, 'power'. Other methods are 'eigen','linear', and 'krylov' Parameters ---------- ...
Calculate the steady state distribution using your preferred method and store it in the attribute `pi`. By default uses the most robust method, 'power'. Other methods are 'eigen','linear', and 'krylov' Parameters ---------- method : string, optional(default='power') ...
Below is the the instruction that describes the task: ### Input: Calculate the steady state distribution using your preferred method and store it in the attribute `pi`. By default uses the most robust method, 'power'. Other methods are 'eigen','linear', and 'krylov' Parameters ----...
def get_subadres_by_id(self, id): ''' Retrieve a `Subadres` by the Id. :param integer id: the Id of the `Subadres` :rtype: :class:`Subadres` ''' def creator(): res = crab_gateway_request( self.client, 'GetSubadresWithStatusBySubadresId', id ...
Retrieve a `Subadres` by the Id. :param integer id: the Id of the `Subadres` :rtype: :class:`Subadres`
Below is the the instruction that describes the task: ### Input: Retrieve a `Subadres` by the Id. :param integer id: the Id of the `Subadres` :rtype: :class:`Subadres` ### Response: def get_subadres_by_id(self, id): ''' Retrieve a `Subadres` by the Id. :param integer id: t...
def delete_by_id(self, webhook, params={}, **options): """This method permanently removes a webhook. Note that it may be possible to receive a request that was already in flight after deleting the webhook, but no further requests will be issued. Parameters ---------- we...
This method permanently removes a webhook. Note that it may be possible to receive a request that was already in flight after deleting the webhook, but no further requests will be issued. Parameters ---------- webhook : {Id} The webhook to delete.
Below is the the instruction that describes the task: ### Input: This method permanently removes a webhook. Note that it may be possible to receive a request that was already in flight after deleting the webhook, but no further requests will be issued. Parameters ---------- ...
def upload_html(destination, html, name=None): """ Uploads the HTML to a file on the server """ [project, path, n] = parse_destination(destination) try: dxfile = dxpy.upload_string(html, media_type="text/html", project=project, folder=path, hidden=True, name=name or None) return dxfi...
Uploads the HTML to a file on the server
Below is the the instruction that describes the task: ### Input: Uploads the HTML to a file on the server ### Response: def upload_html(destination, html, name=None): """ Uploads the HTML to a file on the server """ [project, path, n] = parse_destination(destination) try: dxfile = dxpy....
def create_logger(app: 'Quart') -> Logger: """Create a logger for the app based on the app settings. This creates a logger named quart.app that has a log level based on the app configuration. """ logger = getLogger('quart.app') if app.debug and logger.level == NOTSET: logger.setLevel(D...
Create a logger for the app based on the app settings. This creates a logger named quart.app that has a log level based on the app configuration.
Below is the the instruction that describes the task: ### Input: Create a logger for the app based on the app settings. This creates a logger named quart.app that has a log level based on the app configuration. ### Response: def create_logger(app: 'Quart') -> Logger: """Create a logger for the app bas...
def _change_generic(env, model_name, record_ids, target_record_id, exclude_columns, method='orm'): """ Update known generic style res_id/res_model references """ for model_to_replace, res_id_column, model_column in [ ('calendar.event', 'res_id', 'res_model'), ('ir.att...
Update known generic style res_id/res_model references
Below is the the instruction that describes the task: ### Input: Update known generic style res_id/res_model references ### Response: def _change_generic(env, model_name, record_ids, target_record_id, exclude_columns, method='orm'): """ Update known generic style res_id/res_model references...
def subscribe(self): """ Subscribe to contact and conversation events. These are accessible through :meth:`getEvents`. """ self.conn("POST", "{0}/users/ME/endpoints/{1}/subscriptions".format(self.conn.msgsHost, self.id), auth=SkypeConnection.Auth.RegToken, ...
Subscribe to contact and conversation events. These are accessible through :meth:`getEvents`.
Below is the the instruction that describes the task: ### Input: Subscribe to contact and conversation events. These are accessible through :meth:`getEvents`. ### Response: def subscribe(self): """ Subscribe to contact and conversation events. These are accessible through :meth:`getEvents`. ...
def close_client_stream(client_stream, unix_path): """ Closes provided client stream """ try: client_stream.shutdown(socket.SHUT_RDWR) if unix_path: logger.debug('%s: Connection closed', unix_path) else: peer = client_stream.getpeername() logger.debug(...
Closes provided client stream
Below is the the instruction that describes the task: ### Input: Closes provided client stream ### Response: def close_client_stream(client_stream, unix_path): """ Closes provided client stream """ try: client_stream.shutdown(socket.SHUT_RDWR) if unix_path: logger.debug('%s: Con...
def conformPadding(cls, chars): """ Ensure alternate input padding formats are conformed to formats defined in PAD_MAP If chars is already a format defined in PAD_MAP, then it is returned unmodified. Example:: '#' -> '#' '@@@@' -> '@@@@' ...
Ensure alternate input padding formats are conformed to formats defined in PAD_MAP If chars is already a format defined in PAD_MAP, then it is returned unmodified. Example:: '#' -> '#' '@@@@' -> '@@@@' '%04d' -> '#' Args: char...
Below is the the instruction that describes the task: ### Input: Ensure alternate input padding formats are conformed to formats defined in PAD_MAP If chars is already a format defined in PAD_MAP, then it is returned unmodified. Example:: '#' -> '#' '@@@@...
def prefix(self, prefix, lowercase=True): ''' Returns a dictionary of keys with the same prefix. Compat with kr/env, lowercased. > xdg = env.prefix('XDG_') > for key, value in xdg.items(): print('%-20s' % key, value[:6], '…') config_dirs /e...
Returns a dictionary of keys with the same prefix. Compat with kr/env, lowercased. > xdg = env.prefix('XDG_') > for key, value in xdg.items(): print('%-20s' % key, value[:6], '…') config_dirs /etc/x… current_desktop MATE da...
Below is the the instruction that describes the task: ### Input: Returns a dictionary of keys with the same prefix. Compat with kr/env, lowercased. > xdg = env.prefix('XDG_') > for key, value in xdg.items(): print('%-20s' % key, value[:6], '…') conf...
def run_notebook(self, skip_exceptions=False, progress_callback=None): """ Run all the notebook cells in order and update the outputs in-place. If ``skip_exceptions`` is set, then if exceptions occur in a cell, the subsequent cells are run (by default, the notebook execution stops). ...
Run all the notebook cells in order and update the outputs in-place. If ``skip_exceptions`` is set, then if exceptions occur in a cell, the subsequent cells are run (by default, the notebook execution stops).
Below is the the instruction that describes the task: ### Input: Run all the notebook cells in order and update the outputs in-place. If ``skip_exceptions`` is set, then if exceptions occur in a cell, the subsequent cells are run (by default, the notebook execution stops). ### Response: def run_no...
def _convert_option(self): ''' Determines how to convert CDF byte ordering to the system byte ordering. ''' if sys.byteorder == 'little' and self._endian() == 'big-endian': # big->little order = '>' elif sys.byteorder == 'big' and self._endian() =...
Determines how to convert CDF byte ordering to the system byte ordering.
Below is the the instruction that describes the task: ### Input: Determines how to convert CDF byte ordering to the system byte ordering. ### Response: def _convert_option(self): ''' Determines how to convert CDF byte ordering to the system byte ordering. ''' if sys...
def backup(outputdir): """ Backup an anchore installation to a tarfile. """ ecode = 0 try: anchore_print('Backing up anchore system to directory '+str(outputdir)+' ...') backupfile = config.backup(outputdir) anchore_print({"anchore_backup_tarball":str(backupfile)}, do_format...
Backup an anchore installation to a tarfile.
Below is the the instruction that describes the task: ### Input: Backup an anchore installation to a tarfile. ### Response: def backup(outputdir): """ Backup an anchore installation to a tarfile. """ ecode = 0 try: anchore_print('Backing up anchore system to directory '+str(outputdir)+...
def _condition_entries(self): """Extracts any ARNs, Account Numbers, UserIDs, Usernames, CIDRs, VPCs, and VPC Endpoints from a condition block. Ignores any negated condition operators like StringNotLike. Ignores weak condition keys like referer, date, etc. Reason: A con...
Extracts any ARNs, Account Numbers, UserIDs, Usernames, CIDRs, VPCs, and VPC Endpoints from a condition block. Ignores any negated condition operators like StringNotLike. Ignores weak condition keys like referer, date, etc. Reason: A condition is meant to limit the principal in...
Below is the the instruction that describes the task: ### Input: Extracts any ARNs, Account Numbers, UserIDs, Usernames, CIDRs, VPCs, and VPC Endpoints from a condition block. Ignores any negated condition operators like StringNotLike. Ignores weak condition keys like referer, date, etc. ...
def load(self, format=None, *, kwargs={}): ''' deserialize object from the file. auto detect format by file extension name if `format` is None. for example, `.json` will detect as `json`. * raise `FormatNotFoundError` on unknown format. * raise `SerializeError` on any s...
deserialize object from the file. auto detect format by file extension name if `format` is None. for example, `.json` will detect as `json`. * raise `FormatNotFoundError` on unknown format. * raise `SerializeError` on any serialize exceptions.
Below is the the instruction that describes the task: ### Input: deserialize object from the file. auto detect format by file extension name if `format` is None. for example, `.json` will detect as `json`. * raise `FormatNotFoundError` on unknown format. * raise `SerializeError` on...
def create_gemini_db_orig(gemini_vcf, data, gemini_db=None, ped_file=None): """Original GEMINI specific data loader, only works with hg19/GRCh37. """ if not gemini_db: gemini_db = "%s.db" % utils.splitext_plus(gemini_vcf)[0] if not utils.file_exists(gemini_db): if not vcfutils.vcf_has_va...
Original GEMINI specific data loader, only works with hg19/GRCh37.
Below is the the instruction that describes the task: ### Input: Original GEMINI specific data loader, only works with hg19/GRCh37. ### Response: def create_gemini_db_orig(gemini_vcf, data, gemini_db=None, ped_file=None): """Original GEMINI specific data loader, only works with hg19/GRCh37. """ if not ...
def _align(self, axis): """ Align spark bolt array so that axes for iteration are in the keys. This operation is applied before most functional operators. It ensures that the specified axes are valid, and swaps key/value axes so that functional operators can be applied o...
Align spark bolt array so that axes for iteration are in the keys. This operation is applied before most functional operators. It ensures that the specified axes are valid, and swaps key/value axes so that functional operators can be applied over the correct records. Parameters...
Below is the the instruction that describes the task: ### Input: Align spark bolt array so that axes for iteration are in the keys. This operation is applied before most functional operators. It ensures that the specified axes are valid, and swaps key/value axes so that functional operators...
def file_is_present(self, file_path): """ check if file 'file_path' is present, raises IOError if file_path is not a file :param file_path: str, path to the file :return: True if file exists, False if file does not exist """ real_path = self.cont_path(file_path) ...
check if file 'file_path' is present, raises IOError if file_path is not a file :param file_path: str, path to the file :return: True if file exists, False if file does not exist
Below is the the instruction that describes the task: ### Input: check if file 'file_path' is present, raises IOError if file_path is not a file :param file_path: str, path to the file :return: True if file exists, False if file does not exist ### Response: def file_is_present(self, file_pa...
def container_similarity_vector(container1=None,packages_set=None,by=None): '''container similarity_vector is similar to compare_packages, but intended to compare a container object (singularity image or singularity hub container) to a list of packages. If packages_set is not provided, the default used is ...
container similarity_vector is similar to compare_packages, but intended to compare a container object (singularity image or singularity hub container) to a list of packages. If packages_set is not provided, the default used is 'docker-os'. This can be changed to 'docker-library', or if the user wants a cu...
Below is the the instruction that describes the task: ### Input: container similarity_vector is similar to compare_packages, but intended to compare a container object (singularity image or singularity hub container) to a list of packages. If packages_set is not provided, the default used is 'docker-os...
def Gharagheizi_gas(T, MW, Tb, Pc, omega): r'''Estimates the thermal conductivity of a gas as a function of temperature using the CSP method of Gharagheizi [1]_. A convoluted method claiming high-accuracy and using only statistically significant variable following analalysis. Requires temperature,...
r'''Estimates the thermal conductivity of a gas as a function of temperature using the CSP method of Gharagheizi [1]_. A convoluted method claiming high-accuracy and using only statistically significant variable following analalysis. Requires temperature, molecular weight, boiling temperature and crit...
Below is the the instruction that describes the task: ### Input: r'''Estimates the thermal conductivity of a gas as a function of temperature using the CSP method of Gharagheizi [1]_. A convoluted method claiming high-accuracy and using only statistically significant variable following analalysis. ...
def securityEventSSE(symbols=None, on_data=None, token='', version=''): '''The Security event message is used to indicate events that apply to a security. A Security event message will be sent whenever such event occurs https://iexcloud.io/docs/api/#deep-security-event Args: symbols (string); Tick...
The Security event message is used to indicate events that apply to a security. A Security event message will be sent whenever such event occurs https://iexcloud.io/docs/api/#deep-security-event Args: symbols (string); Tickers to request on_data (function): Callback on data token (stri...
Below is the the instruction that describes the task: ### Input: The Security event message is used to indicate events that apply to a security. A Security event message will be sent whenever such event occurs https://iexcloud.io/docs/api/#deep-security-event Args: symbols (string); Tickers to req...
def kitchen_list(backend): """ List all Kitchens """ click.echo(click.style('%s - Getting the list of kitchens' % get_datetime(), fg='green')) check_and_print(DKCloudCommandRunner.list_kitchen(backend.dki))
List all Kitchens
Below is the the instruction that describes the task: ### Input: List all Kitchens ### Response: def kitchen_list(backend): """ List all Kitchens """ click.echo(click.style('%s - Getting the list of kitchens' % get_datetime(), fg='green')) check_and_print(DKCloudCommandRunner.list_kitchen(backe...
def start(self): """Start the timer.""" if not self._is_running: self._t_start = time() self._is_running = True self._t_last = time()
Start the timer.
Below is the the instruction that describes the task: ### Input: Start the timer. ### Response: def start(self): """Start the timer.""" if not self._is_running: self._t_start = time() self._is_running = True self._t_last = time()
def read_stack_dwords(self, count, offset = 0): """ Reads DWORDs from the top of the stack. @type count: int @param count: Number of DWORDs to read. @type offset: int @param offset: Offset from the stack pointer to begin reading. @rtype: tuple( int... ) ...
Reads DWORDs from the top of the stack. @type count: int @param count: Number of DWORDs to read. @type offset: int @param offset: Offset from the stack pointer to begin reading. @rtype: tuple( int... ) @return: Tuple of integers read from the stack. @raise ...
Below is the the instruction that describes the task: ### Input: Reads DWORDs from the top of the stack. @type count: int @param count: Number of DWORDs to read. @type offset: int @param offset: Offset from the stack pointer to begin reading. @rtype: tuple( int... ) ...