code
stringlengths
75
104k
docstring
stringlengths
1
46.9k
text
stringlengths
164
112k
def delete_agile_board(self, board_id): """ Delete agile board by id :param board_id: :return: """ url = 'rest/agile/1.0/board/{}'.format(str(board_id)) return self.delete(url)
Delete agile board by id :param board_id: :return:
Below is the the instruction that describes the task: ### Input: Delete agile board by id :param board_id: :return: ### Response: def delete_agile_board(self, board_id): """ Delete agile board by id :param board_id: :return: """ url = 'rest/agile/1.0/...
def do_execute_direct(self, code: str, silent: bool = False) -> [str, dict]: """ This is the main method that takes code from the Jupyter cell and submits it to the SAS server :param code: code from the cell :param silent: :return: str with either the log or list """ ...
This is the main method that takes code from the Jupyter cell and submits it to the SAS server :param code: code from the cell :param silent: :return: str with either the log or list
Below is the the instruction that describes the task: ### Input: This is the main method that takes code from the Jupyter cell and submits it to the SAS server :param code: code from the cell :param silent: :return: str with either the log or list ### Response: def do_execute_direct(self, ...
def unregister(self, id): ''' Remove the service with id `id` from the service registry. ''' result = self.rr.table(self.table).get(id).delete().run() if result != { 'deleted':1, 'errors':0,'inserted':0, 'replaced':0,'skipped':0,'unchanged':0}: ...
Remove the service with id `id` from the service registry.
Below is the the instruction that describes the task: ### Input: Remove the service with id `id` from the service registry. ### Response: def unregister(self, id): ''' Remove the service with id `id` from the service registry. ''' result = self.rr.table(self.table).get(id).delete()....
def _left_click(self, event): """Function bound to left click event for marker canvas""" self.update_active() iid = self.current_iid if iid is None: return args = (iid, event.x_root, event.y_root) self.call_callbacks(iid, "left_callback", args)
Function bound to left click event for marker canvas
Below is the the instruction that describes the task: ### Input: Function bound to left click event for marker canvas ### Response: def _left_click(self, event): """Function bound to left click event for marker canvas""" self.update_active() iid = self.current_iid if iid is None: ...
def should_submit(stack): """Tests whether a stack should be submitted to CF for update/create Args: stack (:class:`stacker.stack.Stack`): The stack object to check. Returns: bool: If the stack should be submitted, return True. """ if stack.enabled: return True logger...
Tests whether a stack should be submitted to CF for update/create Args: stack (:class:`stacker.stack.Stack`): The stack object to check. Returns: bool: If the stack should be submitted, return True.
Below is the the instruction that describes the task: ### Input: Tests whether a stack should be submitted to CF for update/create Args: stack (:class:`stacker.stack.Stack`): The stack object to check. Returns: bool: If the stack should be submitted, return True. ### Response: def should_...
def index_data(self, data, index_name, doc_type): """Take an arbitrary dictionary of data and index it with ELS. Args: data: data to be Indexed. Should be a dictionary. index_name: Name of the index. doc_type: The type of the document. Raises: Ru...
Take an arbitrary dictionary of data and index it with ELS. Args: data: data to be Indexed. Should be a dictionary. index_name: Name of the index. doc_type: The type of the document. Raises: RuntimeError: When the Indexing fails.
Below is the the instruction that describes the task: ### Input: Take an arbitrary dictionary of data and index it with ELS. Args: data: data to be Indexed. Should be a dictionary. index_name: Name of the index. doc_type: The type of the document. Raises: ...
def t_direction(self, s): r'^[+-]$' # Used in the "list" command self.add_token('DIRECTION', s) self.pos += len(s)
r'^[+-]$
Below is the the instruction that describes the task: ### Input: r'^[+-]$ ### Response: def t_direction(self, s): r'^[+-]$' # Used in the "list" command self.add_token('DIRECTION', s) self.pos += len(s)
def skipline(self): """ Skip the next line and returns position and size of line. Raises IOError if pre- and suffix of line do not match. """ position = self.tell() prefix = self._fix() self.seek(prefix, 1) # skip content suffix = self._fix() if ...
Skip the next line and returns position and size of line. Raises IOError if pre- and suffix of line do not match.
Below is the the instruction that describes the task: ### Input: Skip the next line and returns position and size of line. Raises IOError if pre- and suffix of line do not match. ### Response: def skipline(self): """ Skip the next line and returns position and size of line. Raises I...
def accuracy(y_true: [list, np.ndarray], y_predicted: [list, np.ndarray]) -> float: """ Calculate accuracy in terms of absolute coincidence Args: y_true: array of true values y_predicted: array of predicted values Returns: portion of absolutely coincidental samples """ ...
Calculate accuracy in terms of absolute coincidence Args: y_true: array of true values y_predicted: array of predicted values Returns: portion of absolutely coincidental samples
Below is the the instruction that describes the task: ### Input: Calculate accuracy in terms of absolute coincidence Args: y_true: array of true values y_predicted: array of predicted values Returns: portion of absolutely coincidental samples ### Response: def accuracy(y_true: [li...
def data(self, data): """Overwrite the file with new data. You probably shouldn't do this yourself, it's easy to screw up your whole file with this.""" if self.is_caching: self.cache = data else: fcontents = self.file_contents with open(self.path, "w")...
Overwrite the file with new data. You probably shouldn't do this yourself, it's easy to screw up your whole file with this.
Below is the the instruction that describes the task: ### Input: Overwrite the file with new data. You probably shouldn't do this yourself, it's easy to screw up your whole file with this. ### Response: def data(self, data): """Overwrite the file with new data. You probably shouldn't do thi...
def get_decision(self, child, is_missing = False): """ Get the decision from this node to a child node. Parameters ---------- child: Node A child node of this node. Returns ------- dict: A dictionary that describes how to get from this node t...
Get the decision from this node to a child node. Parameters ---------- child: Node A child node of this node. Returns ------- dict: A dictionary that describes how to get from this node to the child node.
Below is the the instruction that describes the task: ### Input: Get the decision from this node to a child node. Parameters ---------- child: Node A child node of this node. Returns ------- dict: A dictionary that describes how to get from this node to ...
def get_port(self): """ Return a port to use to talk to this cluster. """ if len(self.client_nodes) > 0: node = self.client_nodes[0] else: node = self.nodes[0] return node.get_port()
Return a port to use to talk to this cluster.
Below is the the instruction that describes the task: ### Input: Return a port to use to talk to this cluster. ### Response: def get_port(self): """ Return a port to use to talk to this cluster. """ if len(self.client_nodes) > 0: node = self.client_nodes[0] else: nod...
def CountClientPlatformReleasesByLabel(self, day_buckets): """Computes client-activity stats for OS-release strings in the DB.""" return self._CountClientStatisticByLabel( day_buckets, lambda client_info: client_info.last_snapshot.Uname())
Computes client-activity stats for OS-release strings in the DB.
Below is the the instruction that describes the task: ### Input: Computes client-activity stats for OS-release strings in the DB. ### Response: def CountClientPlatformReleasesByLabel(self, day_buckets): """Computes client-activity stats for OS-release strings in the DB.""" return self._CountClientStatistic...
def get_public_url(self, doc_id, branch='master'): """Returns a GitHub URL for the doc in question (study, collection, ...) """ name, path_frag = self.get_repo_and_path_fragment(doc_id) return 'https://raw.githubusercontent.com/OpenTreeOfLife/' + name + '/' + branch + '/' + path_frag
Returns a GitHub URL for the doc in question (study, collection, ...)
Below is the the instruction that describes the task: ### Input: Returns a GitHub URL for the doc in question (study, collection, ...) ### Response: def get_public_url(self, doc_id, branch='master'): """Returns a GitHub URL for the doc in question (study, collection, ...) """ name, path_fra...
def check_sum(buf, csum): """ 检查数据的校验和 :param buf: :type buf: :param csum: :type csum: :return: :rtype: """ csum = csum.encode('utf-8') _csum = ord(buf[0]) for x in buf[1:]: _csum ^= ord(x) _csum = binascii.b2a_hex(chr(_csum).encode('utf-8')).upper() if _...
检查数据的校验和 :param buf: :type buf: :param csum: :type csum: :return: :rtype:
Below is the the instruction that describes the task: ### Input: 检查数据的校验和 :param buf: :type buf: :param csum: :type csum: :return: :rtype: ### Response: def check_sum(buf, csum): """ 检查数据的校验和 :param buf: :type buf: :param csum: :type csum: :return: :rtype: ...
def raw_input(prompt=""): """raw_input([prompt]) -> string Read a string from standard input. The trailing newline is stripped. If the user hits EOF (Unix: Ctl-D, Windows: Ctl-Z+Return), raise EOFError. On Unix, GNU readline is used if enabled. The prompt string, if given, is printed without a trailing newline befo...
raw_input([prompt]) -> string Read a string from standard input. The trailing newline is stripped. If the user hits EOF (Unix: Ctl-D, Windows: Ctl-Z+Return), raise EOFError. On Unix, GNU readline is used if enabled. The prompt string, if given, is printed without a trailing newline before reading.
Below is the the instruction that describes the task: ### Input: raw_input([prompt]) -> string Read a string from standard input. The trailing newline is stripped. If the user hits EOF (Unix: Ctl-D, Windows: Ctl-Z+Return), raise EOFError. On Unix, GNU readline is used if enabled. The prompt string, if given, is ...
def execCommand(Argv, collect_missing): r"""Executes the given task with parameters. """ try: return _execCommand(Argv, collect_missing) except Exception as e: if Settings['errorHandler']: Settings['errorHandler'](e) if Settings['debug']: # #ToDo: Have an option to debug throug...
r"""Executes the given task with parameters.
Below is the the instruction that describes the task: ### Input: r"""Executes the given task with parameters. ### Response: def execCommand(Argv, collect_missing): r"""Executes the given task with parameters. """ try: return _execCommand(Argv, collect_missing) except Exception as e: if Setti...
def addDataset(self, dataset): """ Creates a new dataset instance for this scene. :param dataset | <XChartDataset> :return <XChartDatasetItem> """ item = XChartDatasetItem() self.addItem(item) item.setDataset(dataset) ...
Creates a new dataset instance for this scene. :param dataset | <XChartDataset> :return <XChartDatasetItem>
Below is the the instruction that describes the task: ### Input: Creates a new dataset instance for this scene. :param dataset | <XChartDataset> :return <XChartDatasetItem> ### Response: def addDataset(self, dataset): """ Creates a new dataset instan...
def _compute_hparam_info_from_values(self, name, values): """Builds an HParamInfo message from the hparam name and list of values. Args: name: string. The hparam name. values: list of google.protobuf.Value messages. The list of values for the hparam. Returns: An api_pb2.HParamInf...
Builds an HParamInfo message from the hparam name and list of values. Args: name: string. The hparam name. values: list of google.protobuf.Value messages. The list of values for the hparam. Returns: An api_pb2.HParamInfo message.
Below is the the instruction that describes the task: ### Input: Builds an HParamInfo message from the hparam name and list of values. Args: name: string. The hparam name. values: list of google.protobuf.Value messages. The list of values for the hparam. Returns: An api_pb2.HPara...
def nvmlDeviceSetAccountingMode(handle, mode): r""" /** * Enables or disables per process accounting. * * For Kepler &tm; or newer fully supported devices. * Requires root/admin permissions. * * @note This setting is not persistent and will default to disabled after driver unloads....
r""" /** * Enables or disables per process accounting. * * For Kepler &tm; or newer fully supported devices. * Requires root/admin permissions. * * @note This setting is not persistent and will default to disabled after driver unloads. * Enable persistence mode to be sure th...
Below is the the instruction that describes the task: ### Input: r""" /** * Enables or disables per process accounting. * * For Kepler &tm; or newer fully supported devices. * Requires root/admin permissions. * * @note This setting is not persistent and will default to disabled aft...
def save_var(self, key, value, **kwargs): 'Save one variable to the database.' # Check whether Highwall's variables table exists self.__check_or_create_vars_table() column_type = get_column_type(value) tmp = quote(self.__vars_table_tmp) self.execute(u'DROP TABLE IF EXISTS %s' % tmp, commit = ...
Save one variable to the database.
Below is the the instruction that describes the task: ### Input: Save one variable to the database. ### Response: def save_var(self, key, value, **kwargs): 'Save one variable to the database.' # Check whether Highwall's variables table exists self.__check_or_create_vars_table() column_type = get_...
def truncate(value: Decimal, n_digits: int) -> Decimal: """Truncates a value to a number of decimals places""" return Decimal(math.trunc(value * (10 ** n_digits))) / (10 ** n_digits)
Truncates a value to a number of decimals places
Below is the the instruction that describes the task: ### Input: Truncates a value to a number of decimals places ### Response: def truncate(value: Decimal, n_digits: int) -> Decimal: """Truncates a value to a number of decimals places""" return Decimal(math.trunc(value * (10 ** n_digits))) / (10 ** n_digi...
def create_organization(self, name): """ To create an organization Jira administrator global permission or agent permission is required depending on the settings :param name: str :return: Organization data """ log.warning('Creating organization...') url =...
To create an organization Jira administrator global permission or agent permission is required depending on the settings :param name: str :return: Organization data
Below is the the instruction that describes the task: ### Input: To create an organization Jira administrator global permission or agent permission is required depending on the settings :param name: str :return: Organization data ### Response: def create_organization(self, name): "...
def n_bifurcation_points(neurites, neurite_type=NeuriteType.all): '''number of bifurcation points in a collection of neurites''' return n_sections(neurites, neurite_type=neurite_type, iterator_type=Tree.ibifurcation_point)
number of bifurcation points in a collection of neurites
Below is the the instruction that describes the task: ### Input: number of bifurcation points in a collection of neurites ### Response: def n_bifurcation_points(neurites, neurite_type=NeuriteType.all): '''number of bifurcation points in a collection of neurites''' return n_sections(neurites, neurite_type=n...
def is_consecutive(self, rtol: float = 1.e-5, atol: float = 1.e-8) -> bool: """Whether all bins are in a growing order. Parameters ---------- rtol, atol : numpy tolerance parameters """ if self.inconsecutive_allowed: if self._consecutive is None: ...
Whether all bins are in a growing order. Parameters ---------- rtol, atol : numpy tolerance parameters
Below is the the instruction that describes the task: ### Input: Whether all bins are in a growing order. Parameters ---------- rtol, atol : numpy tolerance parameters ### Response: def is_consecutive(self, rtol: float = 1.e-5, atol: float = 1.e-8) -> bool: """Whether all bins are ...
def update(self): """ This method should be called when you want to ensure all cached attributes are in sync with the actual object attributes at runtime. This happens because attributes could store mutable objects and be modified outside the scope of this class. The most...
This method should be called when you want to ensure all cached attributes are in sync with the actual object attributes at runtime. This happens because attributes could store mutable objects and be modified outside the scope of this class. The most common idiom that isn't automagically...
Below is the the instruction that describes the task: ### Input: This method should be called when you want to ensure all cached attributes are in sync with the actual object attributes at runtime. This happens because attributes could store mutable objects and be modified outside the scope ...
def property_observer(self, name): """Function decorator to register a property observer. See ``MPV.observe_property`` for details.""" def wrapper(fun): self.observe_property(name, fun) fun.unobserve_mpv_properties = lambda: self.unobserve_property(name, fun) return f...
Function decorator to register a property observer. See ``MPV.observe_property`` for details.
Below is the the instruction that describes the task: ### Input: Function decorator to register a property observer. See ``MPV.observe_property`` for details. ### Response: def property_observer(self, name): """Function decorator to register a property observer. See ``MPV.observe_property`` for details."""...
def main(): """ NAME apwp.py DESCRIPTION returns predicted paleolatitudes, directions and pole latitude/longitude from apparent polar wander paths of Besse and Courtillot (2002). SYNTAX apwp.py [command line options][< filename] OPTIONS -h prints help messa...
NAME apwp.py DESCRIPTION returns predicted paleolatitudes, directions and pole latitude/longitude from apparent polar wander paths of Besse and Courtillot (2002). SYNTAX apwp.py [command line options][< filename] OPTIONS -h prints help message and quits -i ...
Below is the the instruction that describes the task: ### Input: NAME apwp.py DESCRIPTION returns predicted paleolatitudes, directions and pole latitude/longitude from apparent polar wander paths of Besse and Courtillot (2002). SYNTAX apwp.py [command line options][< filena...
def setUpImports(self): '''set import statements ''' i = self.imports print >>i, 'from pyremotevbox.ZSI.schema import GED, GTD' print >>i, 'from pyremotevbox.ZSI.TCcompound import ComplexType, Struct' module = self.getTypesModuleName() package = self.getTypesModu...
set import statements
Below is the the instruction that describes the task: ### Input: set import statements ### Response: def setUpImports(self): '''set import statements ''' i = self.imports print >>i, 'from pyremotevbox.ZSI.schema import GED, GTD' print >>i, 'from pyremotevbox.ZSI.TCcompound i...
def setup(app): ''' Required Sphinx extension setup function. ''' # These two are deprecated and no longer have any effect, to be removed 2.0 app.add_config_value('bokeh_plot_pyfile_include_dirs', [], 'html') app.add_config_value('bokeh_plot_use_relative_paths', False, 'html') app.add_directive('b...
Required Sphinx extension setup function.
Below is the the instruction that describes the task: ### Input: Required Sphinx extension setup function. ### Response: def setup(app): ''' Required Sphinx extension setup function. ''' # These two are deprecated and no longer have any effect, to be removed 2.0 app.add_config_value('bokeh_plot_pyfile...
def module_checkpoint(mod, prefix, period=1, save_optimizer_states=False): """Callback to checkpoint Module to prefix every epoch. Parameters ---------- mod : subclass of BaseModule The module to checkpoint. prefix : str The file prefix for this checkpoint. period : int ...
Callback to checkpoint Module to prefix every epoch. Parameters ---------- mod : subclass of BaseModule The module to checkpoint. prefix : str The file prefix for this checkpoint. period : int How many epochs to wait before checkpointing. Defaults to 1. save_optimizer_st...
Below is the the instruction that describes the task: ### Input: Callback to checkpoint Module to prefix every epoch. Parameters ---------- mod : subclass of BaseModule The module to checkpoint. prefix : str The file prefix for this checkpoint. period : int How many epoc...
def _format_dict(self, info_dict): """Replaces empty content with 'NA's""" for key, value in info_dict.items(): if not value: info_dict[key] = "NA" return info_dict
Replaces empty content with 'NA's
Below is the the instruction that describes the task: ### Input: Replaces empty content with 'NA's ### Response: def _format_dict(self, info_dict): """Replaces empty content with 'NA's""" for key, value in info_dict.items(): if not value: info_dict[key] = "NA" re...
def iteritems(self): """Iterate over all header lines, including duplicate ones.""" for key in self: vals = _dict_getitem(self, key) for val in vals[1:]: yield vals[0], val
Iterate over all header lines, including duplicate ones.
Below is the the instruction that describes the task: ### Input: Iterate over all header lines, including duplicate ones. ### Response: def iteritems(self): """Iterate over all header lines, including duplicate ones.""" for key in self: vals = _dict_getitem(self, key) for va...
def on_view_not_found( self, environ: Dict[str, Any], start_response: Callable) -> Iterable[bytes]: # pragma: nocover """ called when view is not found""" raise NotImplementedError()
called when view is not found
Below is the the instruction that describes the task: ### Input: called when view is not found ### Response: def on_view_not_found( self, environ: Dict[str, Any], start_response: Callable) -> Iterable[bytes]: # pragma: nocover """ called when view is not found""" ...
def _getProcessedImage(self): """Returns the image data after it has been processed by any normalization options in use. This method also sets the attributes self.levelMin and self.levelMax to indicate the range of data in the image.""" if self.imageDisp is None: self.imageD...
Returns the image data after it has been processed by any normalization options in use. This method also sets the attributes self.levelMin and self.levelMax to indicate the range of data in the image.
Below is the the instruction that describes the task: ### Input: Returns the image data after it has been processed by any normalization options in use. This method also sets the attributes self.levelMin and self.levelMax to indicate the range of data in the image. ### Response: def _getProcessedI...
def tvdb_login(api_key): """ Logs into TVDb using the provided api key Note: You can register for a free TVDb key at thetvdb.com/?tab=apiregister Online docs: api.thetvdb.com/swagger#!/Authentication/post_login= """ url = "https://api.thetvdb.com/login" body = {"apikey": api_key} status, co...
Logs into TVDb using the provided api key Note: You can register for a free TVDb key at thetvdb.com/?tab=apiregister Online docs: api.thetvdb.com/swagger#!/Authentication/post_login=
Below is the the instruction that describes the task: ### Input: Logs into TVDb using the provided api key Note: You can register for a free TVDb key at thetvdb.com/?tab=apiregister Online docs: api.thetvdb.com/swagger#!/Authentication/post_login= ### Response: def tvdb_login(api_key): """ Logs into T...
def apply_step(self, variables, deltas): """ Applies the given (and already calculated) step deltas to the variable values. Args: variables: List of variables. deltas: List of deltas of same length. Returns: The step-applied operation. A tf.group of ...
Applies the given (and already calculated) step deltas to the variable values. Args: variables: List of variables. deltas: List of deltas of same length. Returns: The step-applied operation. A tf.group of tf.assign_add ops.
Below is the the instruction that describes the task: ### Input: Applies the given (and already calculated) step deltas to the variable values. Args: variables: List of variables. deltas: List of deltas of same length. Returns: The step-applied operation. A tf.g...
def data_changed(self, change): """ Notify the model that data has changed in this cell! """ index = self.index if index: self.view.model.dataChanged.emit(index, index)
Notify the model that data has changed in this cell!
Below is the the instruction that describes the task: ### Input: Notify the model that data has changed in this cell! ### Response: def data_changed(self, change): """ Notify the model that data has changed in this cell! """ index = self.index if index: self.view.model.dataChang...
def get_dev_alarms(auth, url, devid=None, devip=None): """ function takes the devId of a specific device and issues a RESTFUL call to get the current alarms for the target device. :param devid: int or str value of the target device :param devip: str of ipv4 address of the target device :param...
function takes the devId of a specific device and issues a RESTFUL call to get the current alarms for the target device. :param devid: int or str value of the target device :param devip: str of ipv4 address of the target device :param auth: requests auth object #usually auth.creds from auth pyhpeimc....
Below is the the instruction that describes the task: ### Input: function takes the devId of a specific device and issues a RESTFUL call to get the current alarms for the target device. :param devid: int or str value of the target device :param devip: str of ipv4 address of the target device :par...
def reset_password(self, token): """ View function verify a users reset password token from the email we sent to them. It also handles the form for them to set a new password. Supports html and json requests. """ expired, invalid, user = \ self.security_utils_...
View function verify a users reset password token from the email we sent to them. It also handles the form for them to set a new password. Supports html and json requests.
Below is the the instruction that describes the task: ### Input: View function verify a users reset password token from the email we sent to them. It also handles the form for them to set a new password. Supports html and json requests. ### Response: def reset_password(self, token): """ ...
def live_unread_notification_list(request): ''' Return a json with a unread notification list ''' try: user_is_authenticated = request.user.is_authenticated() except TypeError: # Django >= 1.11 user_is_authenticated = request.user.is_authenticated if not user_is_authenticated: ...
Return a json with a unread notification list
Below is the the instruction that describes the task: ### Input: Return a json with a unread notification list ### Response: def live_unread_notification_list(request): ''' Return a json with a unread notification list ''' try: user_is_authenticated = request.user.is_authenticated() except Type...
def solveConsAggMarkov(solution_next,IncomeDstn,LivPrb,DiscFac,CRRA,MrkvArray, PermGroFac,PermGroFacAgg,aXtraGrid,BoroCnstArt,Mgrid, AFunc,Rfunc,wFunc,DeprFac): ''' Solve one period of a consumption-saving problem with idiosyncratic and aggregate shocks (transit...
Solve one period of a consumption-saving problem with idiosyncratic and aggregate shocks (transitory and permanent). Moreover, the macroeconomic state follows a Markov process that determines the income distribution and aggregate permanent growth factor. This is a basic solver that can't handle cubic s...
Below is the the instruction that describes the task: ### Input: Solve one period of a consumption-saving problem with idiosyncratic and aggregate shocks (transitory and permanent). Moreover, the macroeconomic state follows a Markov process that determines the income distribution and aggregate permanen...
def lookup_zone_exception(self, callsign, timestamp=datetime.utcnow().replace(tzinfo=UTC)): """ Returns a CQ Zone if an exception exists for the given callsign Args: callsign (string): Amateur radio callsign timestamp (datetime, optional): datetime in UTC (tzinfo=pytz.UTC) ...
Returns a CQ Zone if an exception exists for the given callsign Args: callsign (string): Amateur radio callsign timestamp (datetime, optional): datetime in UTC (tzinfo=pytz.UTC) Returns: int: Value of the the CQ Zone exception which exists for this callsign (at the given ti...
Below is the the instruction that describes the task: ### Input: Returns a CQ Zone if an exception exists for the given callsign Args: callsign (string): Amateur radio callsign timestamp (datetime, optional): datetime in UTC (tzinfo=pytz.UTC) Returns: int: Value of the ...
def __parse_json_data(self, data): """Process Json data :@param data :@type data: json/dict :throws TypeError """ if isinstance(data, dict) or isinstance(data, list): self._raw_data = data self._json_data = copy.deepcopy(self._raw_data) e...
Process Json data :@param data :@type data: json/dict :throws TypeError
Below is the the instruction that describes the task: ### Input: Process Json data :@param data :@type data: json/dict :throws TypeError ### Response: def __parse_json_data(self, data): """Process Json data :@param data :@type data: json/dict :throws Type...
def extract(self, text: str, confidence=0.5, filter=['Person', 'Place', 'Organisation']) -> List[Extraction]: """ Extract with the input text, confidence and fields filter to be used. Args: text (str): text input to be annotated confidence (float): the con...
Extract with the input text, confidence and fields filter to be used. Args: text (str): text input to be annotated confidence (float): the confidence of the annotation filter (List[str]): the fields that to be extracted Returns: Li...
Below is the the instruction that describes the task: ### Input: Extract with the input text, confidence and fields filter to be used. Args: text (str): text input to be annotated confidence (float): the confidence of the annotation filter (List[str]): the...
def debug_sync(self, conn_id, cmd_name, cmd_args, progress_callback): """Asynchronously complete a named debug command. The command name and arguments are passed to the underlying device adapter and interpreted there. If the command is long running, progress_callback may be used to pro...
Asynchronously complete a named debug command. The command name and arguments are passed to the underlying device adapter and interpreted there. If the command is long running, progress_callback may be used to provide status updates. Callback is called when the command has finished. ...
Below is the the instruction that describes the task: ### Input: Asynchronously complete a named debug command. The command name and arguments are passed to the underlying device adapter and interpreted there. If the command is long running, progress_callback may be used to provide status ...
def submit_async_work(self, work, workunit_parent=None, on_success=None, on_failure=None): """Submit work to be executed in the background. :param work: The work to execute. :param workunit_parent: If specified, work is accounted for under this workunit. :param on_success: If specified, a callable taki...
Submit work to be executed in the background. :param work: The work to execute. :param workunit_parent: If specified, work is accounted for under this workunit. :param on_success: If specified, a callable taking a single argument, which will be a list of return values of each invocation, ...
Below is the the instruction that describes the task: ### Input: Submit work to be executed in the background. :param work: The work to execute. :param workunit_parent: If specified, work is accounted for under this workunit. :param on_success: If specified, a callable taking a single argument, which w...
def _get_summary_struct(self): """ Returns a structured description of the model, including (where relevant) the schema of the training data, description of the training data, training statistics, and model hyperparameters. Returns ------- sections : list (of lis...
Returns a structured description of the model, including (where relevant) the schema of the training data, description of the training data, training statistics, and model hyperparameters. Returns ------- sections : list (of list of tuples) A list of summary sections...
Below is the the instruction that describes the task: ### Input: Returns a structured description of the model, including (where relevant) the schema of the training data, description of the training data, training statistics, and model hyperparameters. Returns ------- secti...
def run(self, b, compute, times=[], **kwargs): """ if within mpirun, workers should call _run_worker instead of run """ self.run_checks(b, compute, times, **kwargs) logger.debug("rank:{}/{} calling get_packet_and_syns".format(mpi.myrank, mpi.nprocs)) packet, new_syns = s...
if within mpirun, workers should call _run_worker instead of run
Below is the the instruction that describes the task: ### Input: if within mpirun, workers should call _run_worker instead of run ### Response: def run(self, b, compute, times=[], **kwargs): """ if within mpirun, workers should call _run_worker instead of run """ self.run_checks(b, ...
def match(self, text): """If text is matched with pattern, return variable names specified(%{pattern:variable name}) in pattern and their corresponding values.If not matched, return None. custom patterns can be passed in by custom_patterns(pattern name, pattern regular expression pair) o...
If text is matched with pattern, return variable names specified(%{pattern:variable name}) in pattern and their corresponding values.If not matched, return None. custom patterns can be passed in by custom_patterns(pattern name, pattern regular expression pair) or custom_patterns_dir.
Below is the the instruction that describes the task: ### Input: If text is matched with pattern, return variable names specified(%{pattern:variable name}) in pattern and their corresponding values.If not matched, return None. custom patterns can be passed in by custom_patterns(pattern name, pattern...
def get_artifact_info(self): """Returns a tuple composed of a :class:`pants.java.jar.JarDependency` describing the jar for this target and a bool indicating if this target is exportable. """ exported = bool(self.provides) org = self.provides.org if exported else 'internal' name = self.provides....
Returns a tuple composed of a :class:`pants.java.jar.JarDependency` describing the jar for this target and a bool indicating if this target is exportable.
Below is the the instruction that describes the task: ### Input: Returns a tuple composed of a :class:`pants.java.jar.JarDependency` describing the jar for this target and a bool indicating if this target is exportable. ### Response: def get_artifact_info(self): """Returns a tuple composed of a :class:`pan...
def _load_github_repo(): """ Loads the GitHub repository from the users config. """ if 'TRAVIS' in os.environ: raise RuntimeError('Detected that we are running in Travis. ' 'Stopping to prevent infinite loops.') try: with open(os.path.join(config_dir, 'repo'), 'r')...
Loads the GitHub repository from the users config.
Below is the the instruction that describes the task: ### Input: Loads the GitHub repository from the users config. ### Response: def _load_github_repo(): """ Loads the GitHub repository from the users config. """ if 'TRAVIS' in os.environ: raise RuntimeError('Detected that we are running in Travis...
def allocate_elastic_ip(self): """Allocates an elastic IP address :return: Dict with allocation ID and Public IP that were created :raises: AWSAPIError, EC2UtilError """ log = logging.getLogger(self.cls_logger + '.allocate_elastic_ip') # Attempt to allocate a new elasti...
Allocates an elastic IP address :return: Dict with allocation ID and Public IP that were created :raises: AWSAPIError, EC2UtilError
Below is the the instruction that describes the task: ### Input: Allocates an elastic IP address :return: Dict with allocation ID and Public IP that were created :raises: AWSAPIError, EC2UtilError ### Response: def allocate_elastic_ip(self): """Allocates an elastic IP address :ret...
def _get_fields(mcs, bases, namespace): """Create fields dictionary to be used in resource class namespace. Pop all field objects from attributes dict (namespace) and store them under _field_storage_key atrribute. Also collect all fields from base classes in order that ensures fields ca...
Create fields dictionary to be used in resource class namespace. Pop all field objects from attributes dict (namespace) and store them under _field_storage_key atrribute. Also collect all fields from base classes in order that ensures fields can be overriden. Args: bases: a...
Below is the the instruction that describes the task: ### Input: Create fields dictionary to be used in resource class namespace. Pop all field objects from attributes dict (namespace) and store them under _field_storage_key atrribute. Also collect all fields from base classes in order that...
def gets(self, conn, key, default=None): """Gets a single value from the server together with the cas token. :param key: ``bytes``, is the key for the item being fetched :param default: default value if there is no value. :return: ``bytes``, ``bytes tuple with the value and the cas ...
Gets a single value from the server together with the cas token. :param key: ``bytes``, is the key for the item being fetched :param default: default value if there is no value. :return: ``bytes``, ``bytes tuple with the value and the cas
Below is the the instruction that describes the task: ### Input: Gets a single value from the server together with the cas token. :param key: ``bytes``, is the key for the item being fetched :param default: default value if there is no value. :return: ``bytes``, ``bytes tuple with the value...
def flick(self, xspeed, yspeed): """ Flicks, starting anywhere on the screen. :Args: - xspeed: The X speed in pixels per second. - yspeed: The Y speed in pixels per second. """ self._actions.append(lambda: self._driver.execute( Command.FLICK, { ...
Flicks, starting anywhere on the screen. :Args: - xspeed: The X speed in pixels per second. - yspeed: The Y speed in pixels per second.
Below is the the instruction that describes the task: ### Input: Flicks, starting anywhere on the screen. :Args: - xspeed: The X speed in pixels per second. - yspeed: The Y speed in pixels per second. ### Response: def flick(self, xspeed, yspeed): """ Flicks, starting any...
def _result(self) -> ResultLazyType: """ ``self.config.replacer_function``(``Callable[[str], str]``) must exists. """ config = cast(IntervalsCollectionBasedReplacerConfig, self.config) diff_acc = 0 for interval, aggregated_mark in self.continuous_intervals(): ...
``self.config.replacer_function``(``Callable[[str], str]``) must exists.
Below is the the instruction that describes the task: ### Input: ``self.config.replacer_function``(``Callable[[str], str]``) must exists. ### Response: def _result(self) -> ResultLazyType: """ ``self.config.replacer_function``(``Callable[[str], str]``) must exists. """ config = cast...
def convert(self, request, response, data): """ Performs the desired Conversion. :param request: The webob Request object describing the request. :param response: The webob Response object describing the response. :param data: The...
Performs the desired Conversion. :param request: The webob Request object describing the request. :param response: The webob Response object describing the response. :param data: The data dictionary returned by the prepare() ...
Below is the the instruction that describes the task: ### Input: Performs the desired Conversion. :param request: The webob Request object describing the request. :param response: The webob Response object describing the response. :param data...
def match_rows(rows1, rows2, key, sort_keys=True): """ Yield triples of `(value, left_rows, right_rows)` where `left_rows` and `right_rows` are lists of rows that share the same column value for *key*. This means that both *rows1* and *rows2* must have a column with the same name *key*. .. warn...
Yield triples of `(value, left_rows, right_rows)` where `left_rows` and `right_rows` are lists of rows that share the same column value for *key*. This means that both *rows1* and *rows2* must have a column with the same name *key*. .. warning:: Both *rows1* and *rows2* will exist in memory for...
Below is the the instruction that describes the task: ### Input: Yield triples of `(value, left_rows, right_rows)` where `left_rows` and `right_rows` are lists of rows that share the same column value for *key*. This means that both *rows1* and *rows2* must have a column with the same name *key*. ....
def _spanning_tree_algorithm(self): """ Update tree roles. - Root bridge: all port is DESIGNATED_PORT. - Non root bridge: select one ROOT_PORT and some DESIGNATED_PORT, and the other port is set to NON_DESIGNATED_PORT.""" port_rol...
Update tree roles. - Root bridge: all port is DESIGNATED_PORT. - Non root bridge: select one ROOT_PORT and some DESIGNATED_PORT, and the other port is set to NON_DESIGNATED_PORT.
Below is the the instruction that describes the task: ### Input: Update tree roles. - Root bridge: all port is DESIGNATED_PORT. - Non root bridge: select one ROOT_PORT and some DESIGNATED_PORT, and the other port is set to NON_DESIGNATED_PORT...
def _remove_non_serializable_store_entries(store: Store) -> dict: """ Copy all serializable data into a new dict, and skip the rest. This makes sure to keep the items during runtime, even if the user edits and saves the script. """ cleaned_store_data = {} for key, value i...
Copy all serializable data into a new dict, and skip the rest. This makes sure to keep the items during runtime, even if the user edits and saves the script.
Below is the the instruction that describes the task: ### Input: Copy all serializable data into a new dict, and skip the rest. This makes sure to keep the items during runtime, even if the user edits and saves the script. ### Response: def _remove_non_serializable_store_entries(store: Store) -> dict: ...
def setup_cluster(self, cluster, extra_args=tuple()): """ Configure the cluster by running an Ansible playbook. The ElastiCluster configuration attribute `<kind>_groups` determines, for each node kind, what Ansible groups nodes of that kind are assigned to. :param clust...
Configure the cluster by running an Ansible playbook. The ElastiCluster configuration attribute `<kind>_groups` determines, for each node kind, what Ansible groups nodes of that kind are assigned to. :param cluster: cluster to configure :type cluster: :py:class:`elasticluster.c...
Below is the the instruction that describes the task: ### Input: Configure the cluster by running an Ansible playbook. The ElastiCluster configuration attribute `<kind>_groups` determines, for each node kind, what Ansible groups nodes of that kind are assigned to. :param cluster: c...
def create_with_claims(self, claims): """Create credentials that specify additional claims. Args: claims: dict, key-value pairs for claims. Returns: ServiceAccountCredentials, a copy of the current service account credentials with updated claims to use when ...
Create credentials that specify additional claims. Args: claims: dict, key-value pairs for claims. Returns: ServiceAccountCredentials, a copy of the current service account credentials with updated claims to use when obtaining access tokens.
Below is the the instruction that describes the task: ### Input: Create credentials that specify additional claims. Args: claims: dict, key-value pairs for claims. Returns: ServiceAccountCredentials, a copy of the current service account credentials with updated...
def get_dataset_date(self, date_format=None): # type: (Optional[str]) -> Optional[str] """Get dataset date as string in specified format. For range returns start date. If no format is supplied, an ISO 8601 string is returned. Args: date_format (Optional[str]): Date format. N...
Get dataset date as string in specified format. For range returns start date. If no format is supplied, an ISO 8601 string is returned. Args: date_format (Optional[str]): Date format. None is taken to be ISO 8601. Defaults to None. Returns: Optional[str]: Dataset date s...
Below is the the instruction that describes the task: ### Input: Get dataset date as string in specified format. For range returns start date. If no format is supplied, an ISO 8601 string is returned. Args: date_format (Optional[str]): Date format. None is taken to be ISO 8601. Defaults...
def set_tts(self, level): """ Set the values for :data:`~aeneas.runtimeconfiguration.RuntimeConfiguration.TTS` and :data:`~aeneas.runtimeconfiguration.RuntimeConfiguration.TTS_PATH` matching the given granularity level. Currently supported levels: * ``1`...
Set the values for :data:`~aeneas.runtimeconfiguration.RuntimeConfiguration.TTS` and :data:`~aeneas.runtimeconfiguration.RuntimeConfiguration.TTS_PATH` matching the given granularity level. Currently supported levels: * ``1`` (paragraph) * ``2`` (sentence) ...
Below is the the instruction that describes the task: ### Input: Set the values for :data:`~aeneas.runtimeconfiguration.RuntimeConfiguration.TTS` and :data:`~aeneas.runtimeconfiguration.RuntimeConfiguration.TTS_PATH` matching the given granularity level. Currently supported ...
def _to_bel_lines_header(graph) -> Iterable[str]: """Iterate the lines of a BEL graph's corresponding BEL script's header. :param pybel.BELGraph graph: A BEL graph """ yield '# This document was created by PyBEL v{} and bel-resources v{} on {}\n'.format( VERSION, bel_resources.constants.VERSION...
Iterate the lines of a BEL graph's corresponding BEL script's header. :param pybel.BELGraph graph: A BEL graph
Below is the the instruction that describes the task: ### Input: Iterate the lines of a BEL graph's corresponding BEL script's header. :param pybel.BELGraph graph: A BEL graph ### Response: def _to_bel_lines_header(graph) -> Iterable[str]: """Iterate the lines of a BEL graph's corresponding BEL script's h...
def set_default_host(cls, value): """ Default: "http://127.0.0.1:80" A string that will be automatically included at the beginning of the url generated for doing each http request. """ if value is None: cls.DEFAULT_HOST = "http://127.0.0.1:80" else: ...
Default: "http://127.0.0.1:80" A string that will be automatically included at the beginning of the url generated for doing each http request.
Below is the the instruction that describes the task: ### Input: Default: "http://127.0.0.1:80" A string that will be automatically included at the beginning of the url generated for doing each http request. ### Response: def set_default_host(cls, value): """ Default: "http://127.0.0.1:80"...
def _fill_function(*args): """Fills in the rest of function data into the skeleton function object The skeleton itself is create by _make_skel_func(). """ if len(args) == 2: func = args[0] state = args[1] elif len(args) == 5: # Backwards compat for cloudpickle v0.4.0, after ...
Fills in the rest of function data into the skeleton function object The skeleton itself is create by _make_skel_func().
Below is the the instruction that describes the task: ### Input: Fills in the rest of function data into the skeleton function object The skeleton itself is create by _make_skel_func(). ### Response: def _fill_function(*args): """Fills in the rest of function data into the skeleton function object Th...
def touch(self, mode=0o666, exist_ok=True): """Create this file with the given access mode, if it doesn't exist. Based on: https://github.com/python/cpython/blob/master/Lib/pathlib.py) """ if exist_ok: # First try to bump modificat...
Create this file with the given access mode, if it doesn't exist. Based on: https://github.com/python/cpython/blob/master/Lib/pathlib.py)
Below is the the instruction that describes the task: ### Input: Create this file with the given access mode, if it doesn't exist. Based on: https://github.com/python/cpython/blob/master/Lib/pathlib.py) ### Response: def touch(self, mode=0o666, exist_ok=True): """Creat...
def config_args(self, section="main"): """ Additional method for feeding input arguments from a config file. :param section: current config section name """ if self._config_parsed: return for a in self._filtered_actions("config"): for o in...
Additional method for feeding input arguments from a config file. :param section: current config section name
Below is the the instruction that describes the task: ### Input: Additional method for feeding input arguments from a config file. :param section: current config section name ### Response: def config_args(self, section="main"): """ Additional method for feeding input arguments from...
def check_verifier(self, verifier): """Checks that the verifier contains only safe characters and is no shorter than lower and no longer than upper. """ lower, upper = self.verifier_length return (set(verifier) <= self.safe_characters and lower <= len(verifier) <=...
Checks that the verifier contains only safe characters and is no shorter than lower and no longer than upper.
Below is the the instruction that describes the task: ### Input: Checks that the verifier contains only safe characters and is no shorter than lower and no longer than upper. ### Response: def check_verifier(self, verifier): """Checks that the verifier contains only safe characters and is n...
def normalize_lat_lng(arg): """Take the various lat/lng representations and return a tuple. Accepts various representations: 1) dict with two entries - "lat" and "lng" 2) list or tuple - e.g. (-33, 151) or [-33, 151] :param arg: The lat/lng pair. :type arg: dict or list or tuple :rtype: t...
Take the various lat/lng representations and return a tuple. Accepts various representations: 1) dict with two entries - "lat" and "lng" 2) list or tuple - e.g. (-33, 151) or [-33, 151] :param arg: The lat/lng pair. :type arg: dict or list or tuple :rtype: tuple (lat, lng)
Below is the the instruction that describes the task: ### Input: Take the various lat/lng representations and return a tuple. Accepts various representations: 1) dict with two entries - "lat" and "lng" 2) list or tuple - e.g. (-33, 151) or [-33, 151] :param arg: The lat/lng pair. :type arg: di...
def get_specific(self, id, **kwargs): """ Get specific License This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(...
Get specific License This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> ...
Below is the the instruction that describes the task: ### Input: Get specific License This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callbac...
def transform_file_output(result): """ Transform to convert SDK file/dir list output to something that more clearly distinguishes between files and directories. """ from collections import OrderedDict new_result = [] iterable = result if isinstance(result, list) else result.get('items', result) ...
Transform to convert SDK file/dir list output to something that more clearly distinguishes between files and directories.
Below is the the instruction that describes the task: ### Input: Transform to convert SDK file/dir list output to something that more clearly distinguishes between files and directories. ### Response: def transform_file_output(result): """ Transform to convert SDK file/dir list output to something that ...
def parse(region_string): """Parse DS9 region string into a ShapeList. Parameters ---------- region_string : str Region string Returns ------- shapes : `ShapeList` List of `~pyregion.Shape` """ rp = RegionParser() ss = rp.parse(region_string) sss1 = rp.conve...
Parse DS9 region string into a ShapeList. Parameters ---------- region_string : str Region string Returns ------- shapes : `ShapeList` List of `~pyregion.Shape`
Below is the the instruction that describes the task: ### Input: Parse DS9 region string into a ShapeList. Parameters ---------- region_string : str Region string Returns ------- shapes : `ShapeList` List of `~pyregion.Shape` ### Response: def parse(region_string): """...
def jdbc(self, url, table, column=None, lowerBound=None, upperBound=None, numPartitions=None, predicates=None, properties=None): """ Construct a :class:`DataFrame` representing the database table named ``table`` accessible via JDBC URL ``url`` and connection ``properties``. ...
Construct a :class:`DataFrame` representing the database table named ``table`` accessible via JDBC URL ``url`` and connection ``properties``. Partitions of the table will be retrieved in parallel if either ``column`` or ``predicates`` is specified. ``lowerBound`, ``upperBound`` and ``numPartiti...
Below is the the instruction that describes the task: ### Input: Construct a :class:`DataFrame` representing the database table named ``table`` accessible via JDBC URL ``url`` and connection ``properties``. Partitions of the table will be retrieved in parallel if either ``column`` or ``pred...
def _diff_emit_update(self, new_bookmarks): """ Diff the bookmark cache and the new bookmark state, emit signals as needed and set the bookmark cache to the new data. """ self.logger.debug("diffing %s, %s", self._bookmark_cache, new_bookmarks) ...
Diff the bookmark cache and the new bookmark state, emit signals as needed and set the bookmark cache to the new data.
Below is the the instruction that describes the task: ### Input: Diff the bookmark cache and the new bookmark state, emit signals as needed and set the bookmark cache to the new data. ### Response: def _diff_emit_update(self, new_bookmarks): """ Diff the bookmark cache and the new bookmark ...
def memorize(func): """ Simply memorize the calculated result :data:`func`. previously returned. Simply cached all calculated results from the decorated method/function into a global `dict`. """ @wraps(func) def wrapped_func(*args, **kwargs): if (len(args) > 0 and len(kwargs) > 0): ...
Simply memorize the calculated result :data:`func`. previously returned. Simply cached all calculated results from the decorated method/function into a global `dict`.
Below is the the instruction that describes the task: ### Input: Simply memorize the calculated result :data:`func`. previously returned. Simply cached all calculated results from the decorated method/function into a global `dict`. ### Response: def memorize(func): """ Simply memorize the calculat...
def resolve_path(schema, fragment): """ Return definition from path. Path is unescaped according https://tools.ietf.org/html/rfc6901 """ fragment = fragment.lstrip('/') parts = unquote(fragment).split('/') if fragment else [] for part in parts: part = part.replace('~1', '/'...
Return definition from path. Path is unescaped according https://tools.ietf.org/html/rfc6901
Below is the the instruction that describes the task: ### Input: Return definition from path. Path is unescaped according https://tools.ietf.org/html/rfc6901 ### Response: def resolve_path(schema, fragment): """ Return definition from path. Path is unescaped according https://tools.ietf.org...
def delete_grade_entry(self, grade_entry_id): """Deletes the ``GradeEntry`` identified by the given ``Id``. arg: grade_entry_id (osid.id.Id): the ``Id`` of the ``GradeEntry`` to delete raise: NotFound - a ``GradeEntry`` was not found identified by the given `...
Deletes the ``GradeEntry`` identified by the given ``Id``. arg: grade_entry_id (osid.id.Id): the ``Id`` of the ``GradeEntry`` to delete raise: NotFound - a ``GradeEntry`` was not found identified by the given ``Id`` raise: NullArgument - ``grade_entry_id`` i...
Below is the the instruction that describes the task: ### Input: Deletes the ``GradeEntry`` identified by the given ``Id``. arg: grade_entry_id (osid.id.Id): the ``Id`` of the ``GradeEntry`` to delete raise: NotFound - a ``GradeEntry`` was not found identified by ...
def fetchmany(self, size=None): """Fetch up to size rows from the cursor. Result set may be smaller than size. If size is not defined, cursor.arraysize is used.""" self._check_executed() r = self._fetch_row(size or self.arraysize) self.rownumber = self.rownumber + len(r) ...
Fetch up to size rows from the cursor. Result set may be smaller than size. If size is not defined, cursor.arraysize is used.
Below is the the instruction that describes the task: ### Input: Fetch up to size rows from the cursor. Result set may be smaller than size. If size is not defined, cursor.arraysize is used. ### Response: def fetchmany(self, size=None): """Fetch up to size rows from the cursor. Result set may be sm...
def clean_indicators(indicators): """Remove any extra details from indicators.""" output = list() for indicator in indicators: strip = ['http://', 'https://'] for item in strip: indicator = indicator.replace(item, '') indicator = indicator.strip('.').strip() parts...
Remove any extra details from indicators.
Below is the the instruction that describes the task: ### Input: Remove any extra details from indicators. ### Response: def clean_indicators(indicators): """Remove any extra details from indicators.""" output = list() for indicator in indicators: strip = ['http://', 'https://'] for ite...
def listen(bot, receivers=None, token=None, port=10245, status_report=False, status_receiver=None, status_interval=DEFAULT_REPORT_TIME): """ 传入 bot 实例并启动 wechat_sender 服务 :param bot: (必填|Bot对象) - wxpy 的 Bot 对象实例 :param receivers: (选填|wxpy.Chat 对象|Chat 对象列表) - 消息接收者,wxpy 的 Chat 对象实例, 或 Chat 对...
传入 bot 实例并启动 wechat_sender 服务 :param bot: (必填|Bot对象) - wxpy 的 Bot 对象实例 :param receivers: (选填|wxpy.Chat 对象|Chat 对象列表) - 消息接收者,wxpy 的 Chat 对象实例, 或 Chat 对象列表,如果为 list 第一个 Chat 为默认接收者。如果为 Chat 对象,则默认接收者也是此对象。 不填为当前 bot 对象的文件接收者 :param token: (选填|str) - 信令,防止 receiver 被非法滥用,建议加上 token 防止非法使用,如果使用 token 请在初始化 `S...
Below is the the instruction that describes the task: ### Input: 传入 bot 实例并启动 wechat_sender 服务 :param bot: (必填|Bot对象) - wxpy 的 Bot 对象实例 :param receivers: (选填|wxpy.Chat 对象|Chat 对象列表) - 消息接收者,wxpy 的 Chat 对象实例, 或 Chat 对象列表,如果为 list 第一个 Chat 为默认接收者。如果为 Chat 对象,则默认接收者也是此对象。 不填为当前 bot 对象的文件接收者 :param token: ...
def convert_values(self, value, field): """ Coerce the value returned by the database backend into a consistent type that is compatible with the field type. In our case, cater for the fact that SQL Server < 2008 has no separate Date and Time data types. TODO: See how we'...
Coerce the value returned by the database backend into a consistent type that is compatible with the field type. In our case, cater for the fact that SQL Server < 2008 has no separate Date and Time data types. TODO: See how we'll handle this for SQL Server >= 2008
Below is the the instruction that describes the task: ### Input: Coerce the value returned by the database backend into a consistent type that is compatible with the field type. In our case, cater for the fact that SQL Server < 2008 has no separate Date and Time data types. TODO: Se...
def get_config_value(self, overrides, skip_environment=False): """Get the configuration value from all overrides. Iterates over all overrides given to see if a value can be pulled out from them. It will convert each of these values to ensure they are the correct type. Args: ...
Get the configuration value from all overrides. Iterates over all overrides given to see if a value can be pulled out from them. It will convert each of these values to ensure they are the correct type. Args: overrides: A list of tuples where each tuple is a label and a ...
Below is the the instruction that describes the task: ### Input: Get the configuration value from all overrides. Iterates over all overrides given to see if a value can be pulled out from them. It will convert each of these values to ensure they are the correct type. Args: ...
def binned_bitsets_by_chrom( f, chrom, chrom_col=0, start_col=1, end_col=2): """Read a file by chrom name into a bitset""" bitset = BinnedBitSet( MAX ) for line in f: if line.startswith("#"): continue fields = line.split() if fields[chrom_col] == chrom: start, end = int( ...
Read a file by chrom name into a bitset
Below is the the instruction that describes the task: ### Input: Read a file by chrom name into a bitset ### Response: def binned_bitsets_by_chrom( f, chrom, chrom_col=0, start_col=1, end_col=2): """Read a file by chrom name into a bitset""" bitset = BinnedBitSet( MAX ) for line in f: if line.s...
def CAS_from_any(ID, autoload=False): '''Looks up the CAS number of a chemical by searching and testing for the string being any of the following types of chemical identifiers: * Name, in IUPAC form or common form or a synonym registered in PubChem * InChI name, prefixed by 'InChI=1S/' or 'InChI=1/...
Looks up the CAS number of a chemical by searching and testing for the string being any of the following types of chemical identifiers: * Name, in IUPAC form or common form or a synonym registered in PubChem * InChI name, prefixed by 'InChI=1S/' or 'InChI=1/' * InChI key, prefixed by 'InChIKey=' ...
Below is the the instruction that describes the task: ### Input: Looks up the CAS number of a chemical by searching and testing for the string being any of the following types of chemical identifiers: * Name, in IUPAC form or common form or a synonym registered in PubChem * InChI name, prefixed by ...
def get_recipients(self, name): """ For example get_recipients('to') """ to_str = self.render_string(self.data[name]) formatted_emails = [ email.utils.formataddr(addr_pair) for addr_pair in email.utils.getaddresses([to_str]) ] return [i for...
For example get_recipients('to')
Below is the the instruction that describes the task: ### Input: For example get_recipients('to') ### Response: def get_recipients(self, name): """ For example get_recipients('to') """ to_str = self.render_string(self.data[name]) formatted_emails = [ email.utils....
def get_network_by_name(self, nwk_name): """Search for a openstack network by name. """ ret_net_lst = [] try: body = {} net_list = self.neutronclient.list_networks(body=body) net_list = net_list.get('networks') for net in net_list: ...
Search for a openstack network by name.
Below is the the instruction that describes the task: ### Input: Search for a openstack network by name. ### Response: def get_network_by_name(self, nwk_name): """Search for a openstack network by name. """ ret_net_lst = [] try: body = {} net_list = self.neutronclien...
def edit(self, body): """ :calls: `PATCH /repos/:owner/:repo/pulls/comments/:number <http://developer.github.com/v3/pulls/comments>`_ :param body: string :rtype: None """ assert isinstance(body, (str, unicode)), body post_parameters = { "body": body, ...
:calls: `PATCH /repos/:owner/:repo/pulls/comments/:number <http://developer.github.com/v3/pulls/comments>`_ :param body: string :rtype: None
Below is the the instruction that describes the task: ### Input: :calls: `PATCH /repos/:owner/:repo/pulls/comments/:number <http://developer.github.com/v3/pulls/comments>`_ :param body: string :rtype: None ### Response: def edit(self, body): """ :calls: `PATCH /repos/:owner/:repo/pu...
def _closeElements(childs, HTMLElement): """ Create `endtags` to elements which looks like openers, but doesn't have proper :attr:`HTMLElement.endtag`. Args: childs (list): List of childs (:class:`HTMLElement` obj) - typically from :attr:`HTMLElement.childs` property. Return...
Create `endtags` to elements which looks like openers, but doesn't have proper :attr:`HTMLElement.endtag`. Args: childs (list): List of childs (:class:`HTMLElement` obj) - typically from :attr:`HTMLElement.childs` property. Returns: list: List of closed elements.
Below is the the instruction that describes the task: ### Input: Create `endtags` to elements which looks like openers, but doesn't have proper :attr:`HTMLElement.endtag`. Args: childs (list): List of childs (:class:`HTMLElement` obj) - typically from :attr:`HTMLElement.childs` prope...
def load_external_types(self, path): """ Given a path to a python package or module, load that module, search for all defined variables inside of it that do not start with _ or __ and inject them into the type system. If any of the types cannot be injected, silently ignore them unless v...
Given a path to a python package or module, load that module, search for all defined variables inside of it that do not start with _ or __ and inject them into the type system. If any of the types cannot be injected, silently ignore them unless verbose is True. If path points to a module it sh...
Below is the the instruction that describes the task: ### Input: Given a path to a python package or module, load that module, search for all defined variables inside of it that do not start with _ or __ and inject them into the type system. If any of the types cannot be injected, silently ignore t...
def process_jwt(jwt): """ Process a JSON Web Token without verifying it. Call this before :func:`verify_jwt` if you need access to the header or claims in the token before verifying it. For example, the claims might identify the issuer such that you can retrieve the appropriate public key. :param jwt:...
Process a JSON Web Token without verifying it. Call this before :func:`verify_jwt` if you need access to the header or claims in the token before verifying it. For example, the claims might identify the issuer such that you can retrieve the appropriate public key. :param jwt: The JSON Web Token to verify. ...
Below is the the instruction that describes the task: ### Input: Process a JSON Web Token without verifying it. Call this before :func:`verify_jwt` if you need access to the header or claims in the token before verifying it. For example, the claims might identify the issuer such that you can retrieve the appro...
def validate_revocation_request(self, request): """Ensure the request is valid. The client constructs the request by including the following parameters using the "application/x-www-form-urlencoded" format in the HTTP request entity-body: token (REQUIRED). The token that the cl...
Ensure the request is valid. The client constructs the request by including the following parameters using the "application/x-www-form-urlencoded" format in the HTTP request entity-body: token (REQUIRED). The token that the client wants to get revoked. token_type_hint (OPTION...
Below is the the instruction that describes the task: ### Input: Ensure the request is valid. The client constructs the request by including the following parameters using the "application/x-www-form-urlencoded" format in the HTTP request entity-body: token (REQUIRED). The token t...
def percent_overlapping_calls(records, min_gab=300): """ Return the percentage of calls that overlap with the next call. Parameters ---------- records : list The records for a single user. min_gab : int Number of seconds that the calls must overlap to be considered an issue. ...
Return the percentage of calls that overlap with the next call. Parameters ---------- records : list The records for a single user. min_gab : int Number of seconds that the calls must overlap to be considered an issue. Defaults to 5 minutes.
Below is the the instruction that describes the task: ### Input: Return the percentage of calls that overlap with the next call. Parameters ---------- records : list The records for a single user. min_gab : int Number of seconds that the calls must overlap to be considered an issue....
def set_cache_implementation(self, cache_name, impl_name, maxsize, **kwargs): """ Changes the cache implementation for the named cache """ self._get_cache(cache_name).set_cache_impl(impl_name, maxsize, **kwargs)
Changes the cache implementation for the named cache
Below is the the instruction that describes the task: ### Input: Changes the cache implementation for the named cache ### Response: def set_cache_implementation(self, cache_name, impl_name, maxsize, **kwargs): """ Changes the cache implementation for the named cache """ self._get_ca...
def _inject_synthetic_target(self, vt, sources): """Create, inject, and return a synthetic target for the given target and workdir. :param vt: A codegen input VersionedTarget to inject a synthetic target for. :param sources: A FilesetWithSpec to inject for the target. """ target = vt.target # ...
Create, inject, and return a synthetic target for the given target and workdir. :param vt: A codegen input VersionedTarget to inject a synthetic target for. :param sources: A FilesetWithSpec to inject for the target.
Below is the the instruction that describes the task: ### Input: Create, inject, and return a synthetic target for the given target and workdir. :param vt: A codegen input VersionedTarget to inject a synthetic target for. :param sources: A FilesetWithSpec to inject for the target. ### Response: def _injec...
def sync(self, raw_data, row_change_callback=None): """ Equivalent to the inject method but will delete rows from the google spreadsheet if their key is not found in the input (raw_data) dictionary. Args: raw_data (dict): See inject method row_change_...
Equivalent to the inject method but will delete rows from the google spreadsheet if their key is not found in the input (raw_data) dictionary. Args: raw_data (dict): See inject method row_change_callback (Optional) (func): See inject method Returns:...
Below is the the instruction that describes the task: ### Input: Equivalent to the inject method but will delete rows from the google spreadsheet if their key is not found in the input (raw_data) dictionary. Args: raw_data (dict): See inject method row_cha...
def synchronize_simultaneous(self, node_ip): """ Because adjacent mappings for certain NAT types can be stolen by other connections, the purpose of this function is to ensure the last connection by a passive simultaneous node is recent compared to the time for a can...
Because adjacent mappings for certain NAT types can be stolen by other connections, the purpose of this function is to ensure the last connection by a passive simultaneous node is recent compared to the time for a candidate to increase the chance that the precited mappings r...
Below is the the instruction that describes the task: ### Input: Because adjacent mappings for certain NAT types can be stolen by other connections, the purpose of this function is to ensure the last connection by a passive simultaneous node is recent compared to the time for a c...
def _init_metadata(self): """stub""" DecimalValuesFormRecord._init_metadata(self) IntegerValuesFormRecord._init_metadata(self) TextAnswerFormRecord._init_metadata(self) super(MultiLanguageCalculationInteractionFeedbackAndFilesAnswerFormRecord, self)._init_metadata() self....
stub
Below is the the instruction that describes the task: ### Input: stub ### Response: def _init_metadata(self): """stub""" DecimalValuesFormRecord._init_metadata(self) IntegerValuesFormRecord._init_metadata(self) TextAnswerFormRecord._init_metadata(self) super(MultiLanguageCal...